[Libdlo] Multiseat device numbering bug

Alexander Todorov atodorov at otb.bg
Mon Oct 11 12:55:38 PDT 2010


Hi all,
I have discovered a bug in the current udev rules that handle multi seat 
configuration.

The udev rules take into account only devnum which is not globally unique. When 
a system has multiple USB buses (mine latest has 3) then different devices can 
have the same devnum. In my particular case both docking stations happened to 
have a devnum of 5 although they were plugged into ports on different buses (2 
and 3 respectively).

This had some strange consequences like for example one of the seats not 
starting or one of the mouse and keyboard beeing assigned to the other screen, etc.

My quick solution was to use busnum concatenated with devnum for the usbseat 
number. Thus I get /dev/usbseat/25 and /dev/usbseat/35. I've used this approach 
because both GDM and X expect a numeric value for the display number.

This has some drawbacks as well:
- my system has 12 USB buses but 2.0 ones are enumerated first. If it was the 
other way around or some mixed order then there's still a possibility that bus 
12, device 1 will collide with bus 1 device 21.

- the numbering scheme doesn't start from 1 and the seat numbers could be 
relatively high (2 or 3 digits). I'm not sure how well will GDM and Xorg work 
work those numbers, 25 and 35 seems to be OK for now.

To overcome those issues I wanted to group the mouse, kbd, display devices under 
/dev/hub/<busnum>/<devnum> and then symlink under /dev/usbseat/<number> where 
number is 1, 2, 3, etc. However I didn't find a clean and easy way to generate 
global sequential numbers on linux (something like auto increment in SQL but 
valid for all processes).

This is easily implemented in a daemon or some user space tool, however I 
couldn't find such already available. If I have to implement it myself I'd 
rather do something similar to /dev/zero (say /dev/next_int) which will return 
the next integer number upon read.

Regards,
Alexander.


More information about the Libdlo mailing list