I would like to support something like the following user interaction:
xrestrict --device-file=~/.config/xrestrict/mytablet -i
- User performs interactive selection of screen
- xrestrict saves persistent identifier to provided file
xrestrict --device-file=~/.config/xrestrict/mytablet [OPTIONS] behaves the same as xrestrict -d $DEVICEID [OPTIONS] except $DEVICEID is discovered based on information in provided file
At present USB VID:PID:Interface numbers seem like the best choice for a persistent identifier.
On linux this "requires" retrieving the "Device Node" property from the XInput2 device, and then querying the device node via udev to discover the VID:PID:Interface numbers.
At least on FreeBSD the XInput2 devices do not appear to have a "Device Node" property so that may not work.
Alternatively, some combination of property values, available valuators and buttons, etc might be combined to create a "fingerprint" of a device, but that's a lot of work and seems like it would be brittle as well.
Finally, this might make sense to implement as a separate utility, the proposed user interaction could be emulated via something like:
xfindusbdev $(xrestrict --verbose -i | grep XID | cut -f 2) > ~/.config/xrestrict/mytablet
- User performs interactive selection of screen
xrestrict -d $(xfindusbdev --usbid-file ~/.config/xrestrict/mytablet) [OPTIONS]
The final problem with this is that VID:PID:Interface is not completely unique, two tablet devices of the same make and model may share this triple unfortunately. However, I feel that it's unique enough for the purposes of this utility and most of its potential users.
I would like to support something like the following user interaction:
xrestrict --device-file=~/.config/xrestrict/mytablet -ixrestrict --device-file=~/.config/xrestrict/mytablet [OPTIONS]behaves the same asxrestrict -d $DEVICEID [OPTIONS]except $DEVICEID is discovered based on information in provided fileAt present USB VID:PID:Interface numbers seem like the best choice for a persistent identifier.
On linux this "requires" retrieving the "Device Node" property from the XInput2 device, and then querying the device node via udev to discover the VID:PID:Interface numbers.
At least on FreeBSD the XInput2 devices do not appear to have a "Device Node" property so that may not work.
Alternatively, some combination of property values, available valuators and buttons, etc might be combined to create a "fingerprint" of a device, but that's a lot of work and seems like it would be brittle as well.
Finally, this might make sense to implement as a separate utility, the proposed user interaction could be emulated via something like:
xfindusbdev $(xrestrict --verbose -i | grep XID | cut -f 2) > ~/.config/xrestrict/mytabletxrestrict -d $(xfindusbdev --usbid-file ~/.config/xrestrict/mytablet) [OPTIONS]The final problem with this is that VID:PID:Interface is not completely unique, two tablet devices of the same make and model may share this triple unfortunately. However, I feel that it's unique enough for the purposes of this utility and most of its potential users.