Usb Mouse


chacali

Still Fresh
Joined
Jan 28, 2008
Messages
8
Hi everybody :lol:

I am a new comer. I am an engineer student in Belgium (---> sorry for my english).
I ve been asked to make an oscilloscope with the GP2X. The goal is to convert a digital voltage signal to numeric and send it by a usb connection to the GP2X and show it to the screen. I already made the circuit part using a microchip usb microcontroller.

Now i want to allow user using an usb mouse connected on the craddle to interract with the interface, to make it easy to use:

1. I first try to get it work using SDL, but it do not work. I read on this forum that the usb mouse wasn t already supported by SDL.

2. After that, i downloaded the source code of quake portage. I ve been searching trought the code for more than one week without understanding how the mouse was implemented.

3. Lastly, i thought it was possible to read the mouse input using on of the file in 'dev/' directory such as 'dev/mem' or '/dev/usb/mouse'. I just found to make the joystick work reading the file 'dev/joy0' but nothing for the mouse :(

4. Today, I found that Paeryn's HW SDL make it possible to use an usb mouse. I just downloaded the archive but I don t understand how to make it work. I m working on windows xp, with the GP2XSDK using DEV C++.

Could anyone tell me how to install it and also how to get the mouse work.
Thank you a lot (I hope everyone understood my [very] poor english :p )
 
Ishibashi said:
4. Today, I found that Paeryn's HW SDL make it possible to use an usb mouse. I just downloaded the archive but I don t understand how to make it work. I m working on windows xp, with the GP2XSDK using DEV C++.
As far as I know you can use a mouse with SDL, but not with the Gp2xSDK. It is not recommended for development since the SDL version is quite old and doesn't allow external libs (as you figured out)

Get the Open2x toolchain and link statically. You can use Python if your prefer. They both support mouse through SDL.

Finally, please please please opensource your code and PCB design for the oscilloscope!
 
Last edited by a moderator:
It is very easy to add support for mouse in SDL apps.

SDL_GetMouseState(&CursorX, &CursorY);

will get the X and Y location of where the mouse currently is.

to read the mouse button press you treat it like a joypad button input with SDL_BUTTON(1)

there's a useful tutorial on mouse events at http://lazyfoo.net/SDL_tutorials/lesson09/index.php

I only use paeryns SDL so not sure if other SDL builds support mouse. If you want a quick setup that will work, download my user guide at http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,23,933 and follow the instructions in it for setting up. after that download the latest SDL libs from http://www.gp32x.de/board/index.php?showtopic=23819 and extract them into the devkit folder /devkitGP2X/lib/
 
Last edited by a moderator:
Hi

I just downloaded your user guide and everything works fine !!! Thank you so much for you reply. Nows I can go on :lol:

QUOTE
Finally, please please please opensource your code and PCB design for the oscilloscope!


As soon as i finish my project i ll present it in a new topic. I ll give all the assembler code source to manage usb connection between the microcontroller and the GP2X, pics and also the circuit design. It will be done before march. But if you want i can send you the project at its actual state.

Thank you a lot :lol:
 
Back
Top