In the case of "screen size and resolution," for example, that is probably being maintained by XWindows, a user-land daemon program, not by the kernel at all.
One of the pointers in the device-block is a pointer to driver data, and there's a similar per-instance pointer available in the file-block for each open instance of a (device) file. So there are various places to squirrel away what you need. But none of these are persistent, because for devices you generally don't "save state." You initialize the device the way that you want it, or you ask the device what its current state is and, in the case of removable devices, you make sure that you have a way of being notified of changes. The previous (saved) state of a device has absolutely no bearing on what its state might be now: all that you can do is ask, and tell.
The way that I think I would approach this problem is by adding one additional layer of user-land code to the mix: a shared library. This code would know all about your specific IOCTLs and, if it needed to save some state information it would do that, using an ordinary user-land file in the user's home directory.
For example, the initialization-sequence for your joystick cum mouse, as implemented in the library, might consist of opening the device, ordering it to go into joystick mode, reading the latest patch-number, writing one or more patches to it, and so-on. Perhaps dozens of specialized IOCTL calls. Your interface library, not the low-level kernel code, is "the real smartypants" here.
Last edited by sundialsvcs; 08-11-2006 at 06:41 AM.
|