Raf Czlonka <[email protected]> wrote:

> Hi all,
> 
> I use a Philips USB foot pedal[0] as an additional input device.
> With usbhidaction(1), I can "program" its four "buttons".
> 
> After recent changes to uhid(4) device nodes' permissions, my USB
> foot pedal "stopped working".
> 
> I understand that it is a *very recent* change but I rely on this
> input device for my day-to-day computer usage and have a couple of
> questions. I understand that the below permissions are final(?).
> 
>       crw-------  1 root  wheel   62,   0 Dec 16 11:17 /dev/uhid0
>       crw-------  1 root  wheel   62,   1 Dec 16 11:17 /dev/uhid1
>       crw-------  1 root  wheel   62,   2 Dec 16 11:17 /dev/uhid2
>       crw-------  1 root  wheel   62,   3 Dec 16 11:17 /dev/uhid3
>       crw-------  1 root  wheel   62,   4 Dec 16 11:17 /dev/uhid4
>       crw-------  1 root  wheel   62,   5 Dec 16 11:17 /dev/uhid5
>       crw-------  1 root  wheel   62,   6 Dec 16 11:17 /dev/uhid6
>       crw-------  1 root  wheel   62,   7 Dec 16 11:17 /dev/uhid7

Final.

Things might get tightened further.

> I use(d) the below script (executed from .xsession) in order to
> configure and use the foot pedal:
> 
>       #!/bin/sh
>       test -r $HOME/.footpedal.conf && {
>               pgrep usbhidaction > /dev/null ||
>                       usbhidaction -f $(dmesg | awk '/Footcontrol USB/ {
>                               getline
>                               getline
>                               print $1
>                       }' | tail -n 1) -c $HOME/.footpedal.conf -i
>               }
> 
>       $ cat $HOME/.footpedal.conf
>       Generic_Desktop:Joystick.Generic_Desktop:Pointer.Button:Button_1        
> 1
>               action1
>       Generic_Desktop:Joystick.Generic_Desktop:Pointer.Button:Button_2        
> 1
>               action2
>       Generic_Desktop:Joystick.Generic_Desktop:Pointer.Button:Button_3        
> 1
>               action3
>       Generic_Desktop:Joystick.Generic_Desktop:Pointer.Button:Button_4        
> 1
>               action4
> 
> 1. Shall I *simply* introduce chmod(1)/chown(8) step in the above script?

Your .xsession doesn't run as root, so I expect some security comedy
where you use 'doas' in your .xsession, and then all your applications
can doas.

I expect it will go poorly.

> 2. Is the situation still more of a "watch this space"?

Perhaps.

There should probably be a usb joystick driver, which can be managed
with fbtab, or this should be integrated into ukbd.

None of that is easy.

> 3. Is there any other way to get the uhid(4) device node (-f option) for
>    a particular USB device, other than the above dmesg(8)|awk(1) hack?

usbdevs -vv might provide better information about what device is exported
as what, but again the listed nodes are for root use only. 

But the entire configuration and handling you're about to do is
really fragile.

> 4. Or perhaps I'm doing it all wrong?

Everyone was doing it wrong.  The concept of exposing all arbitrary unknown
devices directly to userland, and writing userland drivers is crazy.

We don't have answers for how to fix this yet, but people on the average
host shouldn't be automatically registered into the unsafe model.

Reply via email to