Message ID | cover.1736792486.git.g@b4.vu (mailing list archive) |
---|---|
State | New |
Headers | show |
On Mon, 13 Jan 2025 20:41:02 +0100, Geoffrey D. Bennett wrote: > > > Hmm, this special is a special use of TLV in non-standard way, which > > needs definitely documentation. The use is no longer TLV, just some > > raw read/write of a bulk data for the kcontrol , after all. > >- > > Also, I couldn't figure out what exactly this "meter_labels" stuff > > serves for. It's not referred from anywhere else than TLV read? > > The user-space driver stores meter labels in the Level Meter control's > TLV data so users can determine what each channel of the control > corresponds to. > > As the kernel doesn't need to interpret what's stored there, I've > renamed it from meter_labels to the more generic "meter_metadata" in > case future uses are discovered. (snip) > On Mon, Jan 13, 2025 at 06:14:03PM +0100, Jaroslav Kysela wrote: > > The data format _must_ be in TLV encapsulation also for such R/W operations. > > The user-space driver stores the data in the correct type-length-data > format (with the length a multiple of sizeof(unsigned int)). This is > similar to how sound/control.c read_user_tlv() and replace_user_tlv() > operate. > > > So, a new type should be defined. Perhaps, we can define a driver specific > > data type, because the meter levels (and the whole extensions) seem as > > device specific. > > Are you thinking like this? > > diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h > index b99a2414b53d..965c64796b6a 100644 > --- a/include/uapi/sound/tlv.h > +++ b/include/uapi/sound/tlv.h > @@ -18,6 +18,8 @@ > #define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ > #define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ > > +#define SNDRV_CTL_TLVT_FCP_METER_METADATA 0x110 /* FCP driver meter metadata */ > + > [...] > > I was thinking it wouldn't be needed as the kernel doesn't need to > interpret the data I'm storing, and user-created ALSA controls (which > this is very similar to) are free to store whatever they like in the > TLV data anyway? I suppose this data is set by the configuration program just like other fcp register writes at the probe time, and the applications are supposed just to read them, instead, right? If so, it's safer to set this via ioctl instead of TLV write. Every application is permitted to write TLV, hence everyone can write a malformed data there, too. Judging from your comment, it's a single TLV entry? Then passing the data via ioctl should be straightforward and you can verify the data length there, too. The TLV read can return the value set by the ioctl only after it's set up. thanks, Takashi
diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h index b99a2414b53d..965c64796b6a 100644 --- a/include/uapi/sound/tlv.h +++ b/include/uapi/sound/tlv.h @@ -18,6 +18,8 @@ #define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ #define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ +#define SNDRV_CTL_TLVT_FCP_METER_METADATA 0x110 /* FCP driver meter metadata */ + [...] I was thinking it wouldn't be needed as the kernel doesn't need to