From: "Henrik Rydberg" <rydberg@euromail.se>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: linux-input@vger.kernel.org
Subject: Re: Losing events from USB barcode reader
Date: Tue, 24 May 2011 11:55:56 +0200 [thread overview]
Message-ID: <20110524095556.GA6805@polaris.bitmath.org> (raw)
In-Reply-To: <20110523210228.7738801f@surf>
Hi Thomas,
> I have a Qt-based application which reads events from a Linux input
> device through /dev/input/eventX. The device I have is an USB barcode
> scanner, which works just like a keyboard.
>
> Unfortunately, I sometimes lose events coming from this USB barcode
> scanner, and I'm worried about the size of the in-kernel buffer for
> events. The USB barcode scanner acts like a keyboard, but sends events
> much, much faster. For example, when it scans a barcode such as
> "AZERTYUIOP1234", it generates the Shift press, key press, key release,
> Shift release for every character, generating at least 56 events in a
> row, very quickly (and the kernel only buffers 64 events if I'm
> correct).
With 2.6.39, it is possible to tell if events are dropped by looking
for the (EV_SYN, SYN_DROPPED) event in the stream, for instance using
evtest.
The buffer size can be set by the driver in question, which may
utilize information about the device. Is your device exactly a
keyboard, except it has a higher event rate, or are there perhaps
other ques?
> There are even worse cases: I have an USB barcode reader which is
> connected by Bluetooth with the barcode reader itself. When the barcode
> reader is far away from the base station, it just buffers the scanned
> barcodes, and when the barcode reader is again within the Bluetooth
> range from the base station, it sends all the buffered scanned barcode
> in a row. Potentially hundreds and hundreds of Linux input events
> coming in.
Assuming we talk about a hid device, knowing the specification would help.
> Shouldn't the in-kernel buffer be larger for such devices, in order to
> leave more time for the applications to come and fetch the events ?
That seems reasonable, yes.
> As far as I could see, it doesn't seem to be possible to adjust the
> size of the in-kernel buffer from userspace (through some ioctl() call,
> for example). Did I miss something ?
Adjusting internal kernel buffers from userspace seems like the wrong
level of interaction. The kernel should be able to resolve this
internally, either dynamically or using information such as production
rate and consumption rate.
Thanks,
Henrik
next prev parent reply other threads:[~2011-05-24 9:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 19:02 Losing events from USB barcode reader Thomas Petazzoni
2011-05-24 9:55 ` Henrik Rydberg [this message]
2011-05-25 15:38 ` Thomas Petazzoni
2011-06-03 8:15 ` Thomas Petazzoni
2011-06-03 13:54 ` Thadeu Lima de Souza Cascardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110524095556.GA6805@polaris.bitmath.org \
--to=rydberg@euromail.se \
--cc=linux-input@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).