Skip to contentSkip to conversation

Logitech Cordless Desktop Bluetooth (MX900 + Elite keyboard), bthid and a patch

Bluez-devel Vesa Halttunen 2 participants 2 messages Jun 20, 2004 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

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

Signature · 1 line
            · Vesa Halttunen - http://www.jormas.com/~vesuri/ ·
parser.c-vesuri renamed from parser.c +17 -10
@@ -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++) {
maintainer
#1 lore raw

Hi Vesa,

Quoted 6 lines

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.

may you wanna try the hidd from bluez-utils-2.7 and the hidp kernel module from the -mh patches.

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel