jokeman
Member
hi!
i've a working USB host port... now i want to write a program using a USB mouse...
i downloaded the usb modules from http://www.artaylor.co.uk/~richard/gp2x/
i load the following modules:
usbcore.o
input.o
hid.o
keybdev.o
mousedev.o
mmsp2_usbh.o
usb-ohci.o
usb-ohci-mmsp2.o
i don't have much linux experience so i don't know, if all these modules are nessesary
when i connect a mouse i get
i tried cat /dev/input/mice like described in the linux USB guide and i got "bizarre looking characters" as i moved the mouse
then i modified SDLTest by Guyfawkes to catch mouse events:
but it doesn't work....
i also tried to connect a keyboard and also get no SDL_KEY events
instead, the letters i type are displayed along the screen
any idea, how to use the mouse?
i don't think, the code is wrong... i think it's a driver (kernel?) thing and i havn't enough linux experience to figure it out
thanks for any help
i've a working USB host port... now i want to write a program using a USB mouse...
i downloaded the usb modules from http://www.artaylor.co.uk/~richard/gp2x/
i load the following modules:
usbcore.o
input.o
hid.o
keybdev.o
mousedev.o
mmsp2_usbh.o
usb-ohci.o
usb-ohci-mmsp2.o
i don't have much linux experience so i don't know, if all these modules are nessesary
when i connect a mouse i get
Code:
hub.c: new USB device <NULL>-1, assigned address 4
input: USB HID v1.11 Mouse [Logitech USB Receiver] on usb1:4.0
i tried cat /dev/input/mice like described in the linux USB guide and i got "bizarre looking characters" as i moved the mouse
then i modified SDLTest by Guyfawkes to catch mouse events:
Code:
void TestInput()
{
bool endtest = false;
char g_string[255];
strcpy(g_string," ");
while (!endtest)
{
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0,0,0));
drawText(screen, "Input Test", 0, 0, 255, 255, 255);
drawText(screen, g_string, 0, 30, 255, 255, 255);
drawText(screen, "Press START to exit", 0, 215, 255, 0, 0);
SDL_Flip(screen);
SDL_Event event;
while( SDL_PollEvent( &event ) )
{
if(event.type == SDL_MOUSEBUTTONDOWN)
strcpy(g_string,"Mouse is down.");
if(event.type == SDL_MOUSEBUTTONUP)
strcpy(g_string,"Mouse is up.");
if(event.type == SDL_MOUSEMOTION)
strcpy(g_string,"Mouse is being moved.");
if(event.type == SDL_JOYBUTTONDOWN)
if(event.jbutton.button == GP2X_BUTTON_START)
{
endtest=true;
}
}
}
}
but it doesn't work....
i also tried to connect a keyboard and also get no SDL_KEY events
instead, the letters i type are displayed along the screen
any idea, how to use the mouse?
i don't think, the code is wrong... i think it's a driver (kernel?) thing and i havn't enough linux experience to figure it out
thanks for any help