How can I read the LCD3 buttons on a BBB with linux 3.8?

I don’t know if this is an acceptable approach for you, but those buttons on the LCD3 cape are mapped to keyboard keys. Even without a keyboard attached, you can probably still catch those key events. Something like:

void MyQWidgetDerivedClass::keyPressEvent(QKeyEvent e) {
switch(e->key()) {
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Up:
case Qt::Key_Down:
case Qt::Key_Return:
Handle button event */

There is no key up event that I have noticed. There is only a key down at the time that the button on the cape is pressed. I use those buttons within my BeagleSNES code to change the volume when using an LCD3 cape. I am using SDL for that, and I receive key events through the standard SDL event mechanism, so you should be able to do the same via Qt.


Interesting. Those events are currently going to the desktop. Can you prevent that? Will have to see. I’m using PyGame = SDL, as it happens.

Martin Ewing
from Nexus 7 tablet

My software runs fullscreen with a framebuffer target, so I am not even running X. Perhaps the events won’t go elsewhere if you run your X app in fullscreen mode? I would think that simulated key events would go to the current window that has focus, not the desktop.


A quick test shows the LCD keys are equivalent to keyboard arrow keys + Enter. (I see key up and down events.) I can catch them if my window has focus, as you might expect. It will be a problem if these buttons are also needed for other functions on the real keyboard. There seems to be no way to distinguish the source of the event (same keycodes, etc.)

Thanks a lot for the suggestion. It would be very nice if this behavior were a little more configurable, but I can live with it.