Skip to content

Provide persistent device identifier to users #15

@Ademan

Description

@Ademan

I would like to support something like the following user interaction:

  1. xrestrict --device-file=~/.config/xrestrict/mytablet -i
  2. User performs interactive selection of screen
  3. xrestrict saves persistent identifier to provided file
  4. 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:

  1. xfindusbdev $(xrestrict --verbose -i | grep XID | cut -f 2) > ~/.config/xrestrict/mytablet
  2. User performs interactive selection of screen
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions