Hi all, During the implementation of Xorg VT (virtual console) support, a problem has been discovered when Xorg physically opens a USB keyboard (/dev/usb/hid*).
By default Xorg on Solaris opens the virtual keyboard device (/dev/kbd). The virtual keyboard (conskbd) creates two minor nodes thus has two streams. One is the internal minor node which is linked under console stream, the other is /dev/kbd which is for the use of applications. Say Xorg is running on /dev/vt/7, when /dev/vt/7 is made active, Xorg uses KIOCSDIRECT to route conskbd IO to /dev/kbd stream. And it will route the IO back when switching away to consoles. HID driver creates two minor nodes for a USB keyboard too. One minor node is internal used and the stream is plumbed under conskbd, the other is /dev/usb/hidx. When Xorg is configured to open /dev/usb/hidx as keyboard device, the internal stream is unplugged from conskbd automatically. So when switching from Xorg session back to console session, the console will not get any input from this keyboard. And Xorg can not close /dev/usb/hidx, since it has already dropped the privilege and running as a normal user at this moment. If Xorg closes /dev/usb/hidx when switching away, it loses the privilege to reopen the keyboard device when switching back. So the proposal here is to add a new ioctl to the hid driver for keyboard devices which has the similar routing functionality as KIOCSDIRECT does to conskbd driver. Before I am preparing any official documents, I would like to discuss it with the following purposes: 1) Is there any existing way to resolve this? 2) Is there any better solution? Edward and Alan, your comments are more than welcomed. Thanks a lot. Aaron -- You know some birds are not meant to be caged, their feathers are just too bright.