Aaron Zang wrote: > Hi James, > > > James Carlson wrote: >> Garrett D'Amore - sun microsystems writes: >> >>> To solve the above problem, two new HID ioctls are introduced: >>> >> >> Two questions: >> >> - How do these ioctls solve the problem? Who will issue the ioctls >> and under what conditions? What happens if they're not used (if, >> for example, something kills the Xorg server)? >> >> > > First, Xorg will open the hid devices upon startup. So the input goes > to Xorg. > While switching back to console, Xorg is in charge of issuing the > ioctls to switch input > to console since only Xorg has the context of which devices it keeps > opening. > > If something kills the Xorg server, the opened files will be closed, > so the input will > automatically directed to the internal stream again. > >> - Why not just send copies of the input to all open streams? >> Wouldn't that be simpler? >> >> > > If we send the input to both the internal and external streams, when > you are on console > again no matter by switching back or Xorg exits, all the input > characters typed under > X will be shown on console, that would be messy. > Sorry, I was not 100% correct when trying to answer the latter question. If all the input were sent to both the internal and external streams. The upper conskbd (virtual keyboard "/dev/kbd") would also get the input. If Xorg opens /dev/kbd which is the case for now, Xorg will get 2 copies of input. If Xorg does not open "/dev/kbd", console will get the input and echo back, that would be the mess.
Actually we have already have a pair of similar ioctls (KIOC[GS]DIRECT]) to direct the input in conskbd since conskbd also keeps 2 streams as you can see from the diagram in the case material. Regards, Aaron