[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Numeric wireless keyboard



Pierre,
no, it shouldn't be hard.  If you figure out where the USB device is mounted (it'll be in /dev/usb1 or /deb/kb1 or some such, use lsusb to figure out) you can read the raw data in in Python, it's very easy.  You just open it as a regular file and read() your data and add them to Pygame's event queue.  You'd just do this every frame before processing events.  I'm not sure if Pygame is eating the keyboard input, though, so you might not be able to get access to it while Pygame is running.  I only do Windows development so that is why I am being vague, I don't know the exact way to solve this.  I assume you have already tested a regular keyboard and using the numeric keypad and that works on the ARM platform, right?  It's just this specific device that's not working?

On Wed, Aug 19, 2009 at 8:36 PM, PierreLafrance1@xxxxxxxxxxxx <PierreLafrance1@xxxxxxxxxxxx> wrote:
Luke Paireepinart wrote:
> They're on the list, if they get a chance to reply they will.  I'm not
> sure if it's a Pygame error or SDL or what.  Do you know what device
> your keyboard is mounting to?  Try using lsusb on your dev platform and
> again on your ARM platform, and see if they're mounting to different
> locations.  Then you might be able to force it to mount to the same
> location on the ARM platform as it does on your dev platform, and then
> perhaps the event parsing will be correct.  You should not be getting
> identical events for different keypresses though.
>
> On Wed, Aug 19, 2009 at 7:46 PM, PierreLafrance1@xxxxxxxxxxxx
> <mailto:PierreLafrance1@xxxxxxxxxxxx> <PierreLafrance1@xxxxxxxxxxxx
> <mailto:PierreLafrance1@xxxxxxxxxxxx>> wrote:
>
>     Luke Paireepinart wrote:
>     > Sorry, no idea.  You could perhaps dig into the event processing
>     part of
>     > Pygame but the hardware interface may be on the C/SDL side rather than
>     > Python.  I'm sure Rene or Lenard or someone more knowledgeable can
>     help.
>     >
>     > On Wed, Aug 19, 2009 at 4:34 PM, PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     > <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>> <PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     > <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>>> wrote:
>     >
>     >     Luke Paireepinart wrote:
>     >     > If it's working in a text editor then Linux has the drivers
>     working on
>     >     > your embedded platform.  I would first try just printing out
>     every
>     >     event:
>     >     >
>     >     > while 1:
>     >     >     for event in pygame.event.get():
>     >     >         print event
>     >     >
>     >     > If pygame is not getting the event then you probably will
>     need to look
>     >     > into mapping the device (from /dev/kb1 or whatever) so
>     Pygame reads it
>     >     > for event input.
>     >     >
>     >     > On Wed, Aug 19, 2009 at 3:36 PM,
>     PierreLafrance1@xxxxxxxxxxxx <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     >     <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>>
>     >     > <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     >     <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>>>
>     <PierreLafrance1@xxxxxxxxxxxx <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     >     <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>>
>     >     > <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>
>     >     <mailto:PierreLafrance1@xxxxxxxxxxxx
>     <mailto:PierreLafrance1@xxxxxxxxxxxx>>>> wrote:
>     >     >
>     >     >     Hi
>     >     >     I have a question on keyboard, about an issue we have.
>     >     >
>     >     >     We develop a pygame application on a desktop, using Ubuntu
>     >     7.10.  But
>     >     >     target is an embedded ARM board, runing a custom made linux
>     >     distro, base
>     >     >     on Debian (kernel 2.4).  So far, we managed to make
>     >     application works on
>     >     >     both platforms.
>     >     >
>     >     >     But now we're trying final setup, using a Logitech wireless
>     >     numeric
>     >     >     keyboard (pruduct number : 920-000217).
>     >     >
>     >
>     http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en>
>     >
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en>>
>     >     >
>     >
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en>
>     >
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en
>     <http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3075&cl=ca,en>>>
>     >     >
>     >     >     The Pygame application works this wireless keyboard on
>     Ubuntu
>     >     7.10.
>     >     >     The Pygame application doesn't work with this wireless
>     keyboard on
>     >     >     embedded ARM platform.
>     >     >
>     >     >     But, keyboard works fine on embedded ARM platform, in a text
>     >     editor, or
>     >     >     at command line.  So the custom Linux distro detect the USB
>     >     dongle and
>     >     >     keyboard works fine.  But only Pygame application on
>     embedded ARM
>     >     >     doesn't work with  this keyboard.
>     >     >
>     >     >     Do you have any suggestion to help me debug this problem ?
>     >     >     Thanks
>     >     >
>     >     >
>     >     >     Pierre
>     >     >
>     >     >
>     >
>     >     Hi
>     >     This is event received on Pygame apps, runing on our embedded ARM
>     >     plateform, when pressing key 1 to 9 on the wireless keyboard :
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >     <Event(2-KeyDown {'key': 300, 'unicode': u'', 'mod': 0})>
>     >     <Event(3-KeyUp {'key': 300, 'mod': 0})>
>     >
>     >     Any idea on whats happening ?
>     >     Thanks
>     >
>     >     Pierre
>     >
>     >
>
>     Hi
>     Thanks for your support.
>     How can I get in touch with these guys ?
>     Thanks
>
>     Pierre
>
>
Lets say I want to write my own code to get keyboad event.
Is this something I need to be expert to do that (wich I'm not) ?
What language would you use to do that ?
I will look onto usb dev, but I need options.  This wireless keyboard is
critical for our project.

Thanks for your support

Pierre