Hi all,
I'm a FreeBSD newbie trying to work out how to run an eGalax Touch Screen in X11 on a very standard looking install of FreeBSD 8.1 (and X server 1.7.5). I have no Unix or Linux background, so I may be missing something fundamental and overcomplicating my touch screen problem.
Having enabled HALD, DBUS, and UEP modules, I installed the eGalax X11 driver and succeeded in getting the screen to move the cursor. The problem is that the x and y axes are inverted - i.e. movement up/down on the screen results in left/right cursor movement, and vice versa.
I have the following questions:
1. Is it possible to invert the x and y axes of an input device within X11?
2. Where could I find the source for the eGalax X11 driver?
3. Is there any good documentation for explaining the interface between device nodes (i.e. /dev/uep0) and X11 device drivers (i.e. eGalax)?
4. Any other advice? Is there anything obvious that I am missing, or anywhere else I should be looking?
Below are details of what I have tried...
I tried exploring 'xinput' to see if I could make the change within X11, but couldn't find anything there that could help me. The X11 driver has no options to swap x and y within xorg.conf (only 'invert y', which doesn't solve the issue), so I though I'd have a crack at modifying it but I have not been able to track down the source for it (ok, I know it's out there, but evidently I'm too much of a newbie to know where to find it!). Failing there, I decided to have had a crack at the UEP driver. A copy of UEP.c can be viewed here: http://code.bsd64.org/browse/freebsd/RELENG_8/src/sys/dev/usb/input/uep.c
I found the function 'uep_process_pkt' and thought I'd hit the jackpot - the comment clearly explains how the packets look and what they mean - so I first tried swapping the variables 'x' and 'y'. That did nothing. So I tried a full swap of the relevant bytes in the buffer within that function, and this time it had an effect: the cursor generally did the same thing, but acted 'jumpy'. I concluded that this function is actually populating a log file somewhere, and then sending the 'confirmed' data back to the screen (I think?). So my new thinking is that I need to change the data as soon as it comes in, and this is when I go cross-eyed...
Obviously everything is happening in 'uep_intr_callback', and the data is read by the function 'usbd_copy_out'. I only want to change uep, so I haven't gone any deeper than this. Because the data can be read in whole packets or partial packets, I don't want to always swap those x and y bytes. I only want to do it when they're stored into where-ever-the-x11-driver-reads-the-data-from... This is where I'm really in over my head - I don't understand the x11-egalax-driver / uep interface. I assumed that - somehow - x11 was reading the raw data placed into the 'uep_softc' structure ("sc"). But then this logically doesn't work because this buffer is not used at all if a complete packet comes in.
So after all that I am left scratching my head. How can I feed reversed information to the eGalax x11 driver? If anyone can offer some direction it would be greatly appreciated.
Thanks.
I'm a FreeBSD newbie trying to work out how to run an eGalax Touch Screen in X11 on a very standard looking install of FreeBSD 8.1 (and X server 1.7.5). I have no Unix or Linux background, so I may be missing something fundamental and overcomplicating my touch screen problem.
Having enabled HALD, DBUS, and UEP modules, I installed the eGalax X11 driver and succeeded in getting the screen to move the cursor. The problem is that the x and y axes are inverted - i.e. movement up/down on the screen results in left/right cursor movement, and vice versa.
I have the following questions:
1. Is it possible to invert the x and y axes of an input device within X11?
2. Where could I find the source for the eGalax X11 driver?
3. Is there any good documentation for explaining the interface between device nodes (i.e. /dev/uep0) and X11 device drivers (i.e. eGalax)?
4. Any other advice? Is there anything obvious that I am missing, or anywhere else I should be looking?
Below are details of what I have tried...
I tried exploring 'xinput' to see if I could make the change within X11, but couldn't find anything there that could help me. The X11 driver has no options to swap x and y within xorg.conf (only 'invert y', which doesn't solve the issue), so I though I'd have a crack at modifying it but I have not been able to track down the source for it (ok, I know it's out there, but evidently I'm too much of a newbie to know where to find it!). Failing there, I decided to have had a crack at the UEP driver. A copy of UEP.c can be viewed here: http://code.bsd64.org/browse/freebsd/RELENG_8/src/sys/dev/usb/input/uep.c
I found the function 'uep_process_pkt' and thought I'd hit the jackpot - the comment clearly explains how the packets look and what they mean - so I first tried swapping the variables 'x' and 'y'. That did nothing. So I tried a full swap of the relevant bytes in the buffer within that function, and this time it had an effect: the cursor generally did the same thing, but acted 'jumpy'. I concluded that this function is actually populating a log file somewhere, and then sending the 'confirmed' data back to the screen (I think?). So my new thinking is that I need to change the data as soon as it comes in, and this is when I go cross-eyed...
Obviously everything is happening in 'uep_intr_callback', and the data is read by the function 'usbd_copy_out'. I only want to change uep, so I haven't gone any deeper than this. Because the data can be read in whole packets or partial packets, I don't want to always swap those x and y bytes. I only want to do it when they're stored into where-ever-the-x11-driver-reads-the-data-from... This is where I'm really in over my head - I don't understand the x11-egalax-driver / uep interface. I assumed that - somehow - x11 was reading the raw data placed into the 'uep_softc' structure ("sc"). But then this logically doesn't work because this buffer is not used at all if a complete packet comes in.
So after all that I am left scratching my head. How can I feed reversed information to the eGalax x11 driver? If anyone can offer some direction it would be greatly appreciated.
Thanks.