Kdrive mouse driver writing help

Orkie orkie at orkiesrealm.co.uk
Sun May 28 12:16:35 PDT 2006


Hi

I've been porting Kdrive (the Xfbdev server) to the GP2X (which runs Linux) and have got it to a point where you can use it with the GP2X controls. However, it is a bit of a hack. What I ended up doing was to run GPM in repeater mode so that the X server would be tricked into thinking that there is a bus mouse. I replaced the busParse function with one of my own. Running GPM in the background is a waste of resources, especially on such a limited system so I'd like to move everything to inside hw/kdrive/linux/mouse.c. Another advantage to doing this would be that USB mice (which can be plugged into the GP2X and accessed as a normal mouse would) could be supported using the existing code.

The problem is that to get the state of the buttons and joystick, you need to read and then process the output from /dev/GPIO in a special way. There is no header, you just read an 'unsigned long' whenever you want new values to be checked. Thus, I think (but I could be wrong about this) that it would be best to perform the read and all the processing within a single function if possible, but I'm having trouble getting the server to recognise that I want to use my own function, outside of the existing firmware due to the protocol identification code. I was thinking that maybe my driver could be used as a fallback if no mouse using any of the other protocols is found, but I can't even work out how to do that since KdEnqueueMouseEvent requires a KdMouseInfo as a parameter, which isn't created properly unless the driver it initialised properly, like the rest.

So basically, I was hoping that somebody could offer some guidance as to how to go about doing it. I will of course release the finished code, but whether there would be much point merging it into the freedesktop.org X server tree I don't know, because it would be fairly specific to the GP2X.

Thanks



More information about the xorg mailing list