[Qt-interest] QT 4.5 (embedded) : unable to open device file
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Tue Nov 17 10:47:37 CET 2009
An update on my query. This seems to be my board-specific problem! :)
On Tue, Nov 17, 2009 at 2:46 PM, Mandeep Sandhu
<mandeepsandhu.chd at gmail.com> wrote:
> Hi All,
>
> I'm fairly new to Qt. We're using Qt 4.5 for our embedded board
> running Linux (based on 2.6.22 with some vendor specific patches). I
> plan to use the remote control for handling user input for the Qt GUI
> apps.
>
> I've written a simple console app (using QCoreApplication), which
> opens the remote control device (/dev/ir) and installs a
> QSocketNotifier over it (I pass the file descriptor of this file
> opened using the "open" syscall). This way the moment somebody presses
> a remote control button, my app gets a notification via the
> QSocketNotifier::activated() signal and I'm able to read from the
> device file and get the key code value. All this works fine. But, the
> moment I move this code to a GUI app (using QApplication), I see that
> the app starts failing at the device opening stage, i.e open syscall
> fails (perror states : "Input/output error").
When I'm running the GUI app, the underlying DirectFB implementation
is opening the remote control device. This causes my app's open to
fail, since the remote control interface's device driver supports only
exclusive access and someone's already opened the device.
I'm curious as to why there's no remote control support for Qt
(embedded). Won't this be a fairly common requirement?
I'm considering the following 2 approaches for handling remote control input:
1) Write my own class which would open the device, listen for an key
press events. When there is data to be read, it will "emit" a
"keyPress(int keyCode)" event. Any app can then attach this signal to
it's slot for receiving remote key press events.
2) Write a plugin class (sub-classing one of the existing input
plugins - keyboard maybe?) which will call QWSServer::sendKeyEvent()
to pass a remote key press event to a running QWS Server?
Any thoughts/inputs on which one is better (or even if there's a
completely different soln to this) :)
Thanks,
-mandeep
>
> Any idea why this might be happening?
>
> I tried another thing. In the _working_ console app, I put a
> QWSServer::sendKeyEvent call() in the handler for the
> QSocketNotifier::activated() signal. With this, open started failing
> in this app with the same error (i.e "Input/output error")!!! I'm not
> sure though, if I can directly call QWSServer::sendKeyEvent call() in
> my console app. Will this event be passed on to, say, an already
> running Qt GUI app instance (run with the -qws option)?
>
> Please excuse if my questions sound n00bish! :) Thanks for your time.
>
> Regards,
> -mandeep
>
More information about the Qt-interest-old
mailing list