Results 1 to 2 of 2
Hi all, I am writing a driver for a device which acts as both mouse and joy stick based on the bits set in the status registers and uses spi ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-11-2006 #1
- Join Date
- May 2006
How drivers maintains Device state information
I am writing a driver for a device which acts as both mouse and joy stick based on the bits set in the status registers and uses spi and twi protocols . My application sends ioctl to change device mode and bus mode whenever it needs to change. I also have to load patch file into the device when the driver is initalising. My application also queries about the device state information whenever it requires through ioctl.
My question is how can a driver maintains all these information because my application don't need to know maintains this informations. So my driver has to maintain this information i.e device mode whether it is mouse or joystick and bus modes whether it is spi or twi and patch file location to load into the device. And also when the system reboots the device has to be in the previous state what ever it is before shutdown. Can any one help me in this case.
I try to store the information in a file through structure which contains device mode ,busmode and patch file location and peform file operations through driver whenever any one of the structure element changes but it is not working because we are not supposed to do file operations in a kernel module . Please help whether there is any way to do this. I also want to know how normal driver in linux are maintaining the device configuration files i.e how display driver maintains the screen height and width i.e at any time i can change the screen size and resolution when the system reboots also the screen will be in same height and resolution which i was set before shutdown. How this is maintained by the drivers whether the driver or maintaining or someelse is maintaining this information.
- 08-11-2006 #2Originally Posted by raju82
If the patch file to be loaded is some kind of firmware maybe you want to take ta look to the ipw2200 driver (Intel ProWireless)
Originally Posted by raju82
Originally Posted by raju82
That kind of information is stored in X server configuration file (/etc/X11/xorg.conf or similar). The X server (remember that the X server is a normal application, it is not a driver and it is not a module or kernel code at all) reads this information and then uses the driver to paint pixels, lines etc. The limits are stablished by the X server, not by the driver.
If you want to read files from the kernel there is a horrible and ugly hack that you can find via Google, but be careful: it will be more difficult to make this hack work than write a userland application to store and restore the values that you need.