On Sat, 04 Jan 2025 18:12:54 +0100,
Geoffrey D. Bennett wrote:
> +/* Get protocol version */
> +#define FCP_IOCTL_PVERSION _IOR('S', 0x60, int)
> +
> +/* Start the protocol */
> +
> +/* Step 0 and step 2 responses are variable length and placed in
> + * resp[] one after the other.
> + */
> +struct fcp_init_v1 {
> + __u32 version;
> + __u16 step0_resp_size;
> + __u16 step2_resp_size;
> + __u32 init1_opcode;
> + __u32 init2_opcode;
> + __u8 resp[];
> +} __attribute__((packed));
> +
> +union fcp_init {
> + __u32 version;
> + struct fcp_init_v1 v1;
> +};
> +
> +#define FCP_IOCTL_INIT _IOWR('S', 0x64, union fcp_init)
I don't think this version and union are needed.
If you need a different way of initialization, you can provide simply
a new ioctl, instead of keeping the same ioctl and handles something
conditionally in a complex way.
Also, in which situation should the init ioctl be performed?
And in which situation it shouldn't (must not) be performed?
Currently the driver seems allowing to run it at any time. e.g. what
happens if the init ioctl is called while you're playing or recording
streams? The same question is applied to the fcp_cmd, too.
> +static int fcp_hwdep_open(struct snd_hwdep *hw, struct file *file)
> +{
> + struct usb_mixer_interface *mixer = hw->private_data;
> + struct fcp_data *private = mixer->private_data;
> +
> + if (!capable(CAP_SYS_RAWIO))
> + return -EPERM;
So now you limit the hwdep operation essentially only to root user.
Is it intended, right? That is, the hwdep should be accessed only at
probe time for configuring the stuff (preferably some service or udev
stuff)?
Maybe it'd be helpful to give some "big picture" to indicate how
things should work. Also, the more proper documentation should be
provided for the hwdep interface, too. The kernel doc in comments
should be fine, too.
Last but not least, I don't think we need to split to two patches.
The second patch merely adds the setup hook, and this can be folded
into the main patch.
thanks,
Takashi
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]