Nubs And Dpad Without Sdl


crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
I'm just gathering some information about pandora programming. Currently i'm leeching sebt3's pandora virtual box image to see what's inside the toolchain.

What came to my mind now, is, how do i access the nubs and the dpad without using SDL? I've just read in the pandorawiki that with SDL the input is mapped to joystick and keyboard, but i usually like the direct way more, because i don't want to rely to much on external libs (a habit, i know).

On the wiz, i was using the mmap approach, where i was able to directly read the dpad input bits. Is there a similar way available on the pandora?
 
Check libpnd, all your answers are there. (libpnd is a handy library of utilites for pandora specific stuff, plus the .pnd-magic and daemons and minimenu.) libpnd is on every pandora, and you can link to it to get some simple APIs to do lots of stuff.. such as poll the nubs.

(We really need to publicize this more.. theres a good boatload of stuff in there :)

http://git.openpando...s.git;a=summary

Specifically, see .. pnd_io_evdev for one:
http://git.openpando...1864b01def9b024

With pnd_io_evdev, you just..
1) open the device by id-number in the header
2) once in awhile, call the 'catch up' routine (it inhales events from /dev/eventX so you don't have to parse all that)
3) you can then call the get-nub-state function to get you the current nub values.

ITs literally like 3 lines of code to be getting the nub state :) (or other buttons, including dpad.)

Theres other ways, but thats a nice simple API. You can always yank the code out of the lib, but doign so might hang oyu down the road if things ever change (which they won't, likely :)

jeff

edit: Feel free to stick some links in the wiki to libpnd if you see a good place for 'em :)
 
skeezix said:
Check libpnd, all your answers are there. (libpnd is a handy library of utilites for pandora specific stuff, plus the .pnd-magic and daemons and minimenu.) libpnd is on every pandora, and you can link to it to get some simple APIs to do lots of stuff.. such as poll the nubs.

Thanks! That's exactly what i was looking for.

I've read abot libpnd before, but mixed it up with the pnd package system - i meant libpnd was there to handle stuff with it :)
 
Last edited by a moderator:
I think there needs to be a lot more promo of libpnd .. it is indeed a very useful Pandora-specific library ..
 
bugger! I thought libpnd was just for accessing pnd files - DOH! thats where all the "hidden" open information is.....
 
Back
Top