Re: [PATCH] avctp: Set more descriptive name for uinput device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Wednesday 27 November 2019 17:50:40 Luiz Augusto von Dentz wrote:
> Hi Pali,
> 
> On Tue, Nov 26, 2019 at 11:31 PM Pali Rohár <pali.rohar@xxxxxxxxx> wrote:
> >
> > ---
> >  profiles/audio/avctp.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
> > index 70a3e40b2..ae53587ad 100644
> > --- a/profiles/audio/avctp.c
> > +++ b/profiles/audio/avctp.c
> > @@ -1181,8 +1181,7 @@ static int uinput_create(char *name)
> >         }
> >
> >         memset(&dev, 0, sizeof(dev));
> > -       if (name)
> > -               strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE - 1);
> > +       snprintf(dev.name, sizeof(dev.name), "Bluetooth Audio/Video Remote Control%s%s", name ? " " : "", name ? name : "");
> >
> >         dev.id.bustype = BUS_BLUETOOTH;
> >         dev.id.vendor  = 0x0000;
> > --
> > 2.11.0
> 
> It is already setting a bustype to BUS_BLUETOOTH why do you need to
> make it more specific,

Because more tools shows only device name. Also in kernel dmesg is only
device name. And MAC address is really something which does not say
anything about device...

For this reason also older input devices (implemented in kernel) exports
more descriptive names, e.g. "AT Translated Set 2 keyboard" or "ETPS/2
Elantech TrackPoint" or "Integrated IR Camera".

> btw it needs to be limited to UINPUT_MAX_NAME_SIZE.

Is not this implicitly defined by sizeof()?

> Id say if we want to make it declare the connection type

Yes, connection type would be really useful.

Now I'm playing with exporting "button press even" from HSP profile via
uinput device too and therefore connection type should be there.

> that probably something that needs to be encoded in
> the bus itself, like BUS_BLUETOOTH_AVCTP, BUS_BLUETOOTH_HOG, etc.

But bus type is kernel API and there is no such AVCTP or HOG. So we need
to stick with BUS_BLUETOOH.

Other kernel devices also put protocol information into name (e.g.
touchpad / trackpoints), so it is ideal place also for bluetooth
devices.

And probably most userspace devices are mapped to BUS_VIRTUAL. There
are no subtypes.

-- 
Pali Rohár
pali.rohar@xxxxxxxxx



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux