Cannot use keyboard within Qt app without sudo

2019-02-21 01:18发布

问题:

I have an embedded Qt application crosscompiled that runs on BeagleBone Black. It works Ok, but one thing- It doesnt accept keyboard input if i wont run in directly on BeagleBone Black preceeding with sudo. This is a problem because:

  • I cannot remote debug application and use connected keyboard, as it doesnt work,
  • I cannot use keyboard when the app is in rc.local file to boot at startup (even though sudo is used there).

This is critical for me at the moment and I cannot find solution to the problem for very long. I would really apreciate all help regarding this.

My /etc/enviroment content is here:

QWS_MOUSE_PROTO=IntelliMouse:/dev/input/mouse0
QWS_KEYBOARD=LinuxInput:/dev/tty
TSLIB_CONFFILE=/etc/ts.conf
TSLIB_PLUGINDIR=/usr/lib/ts

Although I have tried many different configurations for QWS_KEYBOARD. The keyboard I would like to use is /dev/input/event1.

回答1:

I also facing this issue. But in my situation, I use remote desktop from Windows OS to raspberry / beaglebone.

My solution (make sure at least you know how to configure ssh in raspberry) :

  1. install xrdp (sudo apt-get install xrdp) on raspberry / beaglebone / other embedded linux
  2. in PC instal xming (search sourceforge)
  3. open XLaunch, select multiple windows > start no client > clipboard > finish
  4. open putty >> session, enter host name / IP address, putty >> SSH >> X11 >> check 'Enable X11 forwarding' putty >> click Open button
  5. login ssh and then type qcreator

now the keyboard should be fine