From: Vesa Halttunen <vesuri@jormas.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] Logitech Cordless Desktop Bluetooth (MX900 + Elite keyboard), bthid and a patch
Date: Sun, 20 Jun 2004 15:53:48 +0300 [thread overview]
Message-ID: <1087736028.19379.19.camel@pc.vesuri.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]
Hi,
I have a Logitech Cordless Desktop Bluetooth (an MX900 mouse and an
Elite keyboard). I've been using them in HCI mode by using hid2hci, hcid
and bthid. This setup has been working somewhat OK but I had a
problem: if I typed specific character sequences very rapidly - the
word "sources", for example, some characters got repeated and so that
"sources" came out as "sourceces". The behaviour was consistent.
Today I took a look at what is causing the problem. By debugging
parser.c I found out that when I type "ces" rapidly the device reports
input events for "c down", "ce down", then 6 times "key 1 down", then
"ce down", then "ces down"... Because the "key 1 down" event got mapped
into "no keys down" it caused the repetition of "ce".
I have no idea what the "key 1 down" event is supposed to be but I wrote
a small hack to get the problem fixed. What I'm doing is use -1 as a
special value for keys_down so that if keys_down == -1 the input event
will be ignored. If a "key 1 down" event is received I ignore the event
by using keys_down = 1.
I don't know if this solution makes any sense with any other keyboard
than this but it seems to work for me - no more duplicate characters.
If anyone knows what the strange "key 1 down" event is and knows a
better way to fix this I'm happy to hear about it. However, a patch
that works for me is attached to this message.
Regards,
-Vesa
--
· Vesa Halttunen - http://www.jormas.com/~vesuri/ ·
[-- Attachment #2: bluez-utils2-hid-parser.c-vesuri-patch.diff --]
[-- Type: text/x-patch, Size: 1473 bytes --]
--- parser.c 2004-06-20 15:30:49.000000000 +0300
+++ parser.c-vesuri 2004-06-20 15:30:24.000000000 +0300
@@ -158,8 +158,8 @@
gst.logical_min,
gst.logical_max,
gst.report_size);
- if (local_ct && (val & RPT_VAR &&
- usage++ == loc[k].usage_max ||
+ if (local_ct && ((val & RPT_VAR &&
+ usage++ == loc[k].usage_max) ||
!(val & RPT_VAR))) {
if (k < local_ct - 1)
k++;
@@ -375,10 +375,14 @@
case 0x0007: /* Keyboard */
//any_keyboard = 1;
- if (val && usage & 0xffff) {
- butt = hid_to_linux[usage & 0xffff];
- if (butt)
- parser->key_down[parser->keys_down++] = butt;
+ if (val && (usage & 0xffff)) {
+ if ((usage & 0xffff) == 1) {
+ parser->keys_down = -1;
+ } else {
+ butt = hid_to_linux[usage & 0xffff];
+ if (butt)
+ parser->key_down[parser->keys_down++] = butt;
+ }
}
return;
@@ -494,7 +498,7 @@
struct hid_report *r = NULL;
struct hid_field *f;
int prev_key_down[32];
- int prev_keys_down;
+ int prev_keys_down = 0;
if (!parser)
return -ENODEV;
@@ -519,9 +523,12 @@
return -EINVAL;
}
- for (i = 0; i < parser->keys_down; i++)
- prev_key_down[i] = parser->key_down[i];
- prev_keys_down = parser->keys_down;
+ if(parser->keys_down >= 0) {
+ for (i = 0; i < parser->keys_down; i++) {
+ prev_key_down[i] = parser->key_down[i];
+ }
+ prev_keys_down = parser->keys_down;
+ }
parser->keys_down = 0;
for (i = 0; i < r->num_fields; i++) {
next reply other threads:[~2004-06-20 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-20 12:53 Vesa Halttunen [this message]
2004-06-20 13:52 ` [Bluez-devel] Logitech Cordless Desktop Bluetooth (MX900 + Elite keyboard), bthid and a patch Marcel Holtmann
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=1087736028.19379.19.camel@pc.vesuri.net \
--to=vesuri@jormas.com \
--cc=bluez-devel@lists.sourceforge.net \
/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