Skip to contentSkip to conversation

Small kernel patch for Logitech iTouch

PATCH Mike Paul 2 participants 2 messages Jan 29, 2002 Char and misc drivers

lore
Share & tools
lore

Mike Paul

author
#0 lore raw

The current discussion about dealing with patch integration in Linux has reminded me of this little patch I wrote a few months back for my Logitech iTouch cordless keyboard. It's mainly to put an end to the "unknown scancode" messages that would appear on the console every few minutes and corrupt my display, but while I was at it I added keycodes for the special-function buttons on the keyboard too.

Here's the patch, and it's a pretty straightforward one. It should apply cleanly to 2.4.17.

drivers/char/pc_keyb.c +39 -8
@@ -223,22 +223,46 @@
 #define E0_MSLW	125
 #define E0_MSRW	126
 #define E0_MSTM	127
+/*
+ * Extra buttons on the Logitech Cordless iTouch
+ *
+ * Note that the Sleep button generates both a press and release event when
+ * pressed, and ignores subsequent presses until about 4 seconds after the last
+ * time it was pressed.
+ */
+/* Power-management */
+#define E0_SLEEP  112
+/* Audio controls */
+#define E0_MUTE   113
+#define E0_VOLDN  114
+#define E0_VOLUP  115
+#define E0_PLAY   116
+#define E0_STOP   117
+#define E0_PREV   120
+#define E0_NEXT   121
+/* Internet keys */
+#define E0_EMAIL  122
+#define E0_SEARCH 123
+#define E0_RUN    124
+#define E0_HOMEPG 125
+/* Sent every few minutes for no apparent reason */
+#define E1_PING   126
 
 static unsigned char e0_keys[128] = {
   0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x00-0x07 */
   0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x08-0x0f */
-  0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x10-0x17 */
-  0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0,	      /* 0x18-0x1f */
-  0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x20-0x27 */
-  0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x28-0x2f */
-  0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR,	      /* 0x30-0x37 */
+  E0_PREV, 0, 0, 0, 0, 0, 0, 0,			      /* 0x10-0x17 */
+  E0_MUTE, E0_NEXT, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */
+  0, 0, E0_PLAY, 0, E0_STOP, 0, 0, 0,		      /* 0x20-0x27 */
+  0, 0, 0, 0, 0, 0, E0_VOLDN, 0,		      /* 0x28-0x2f */
+  E0_VOLUP, 0, E0_HOMEPG, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
   E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP,	      /* 0x38-0x3f */
   E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME,	      /* 0x40-0x47 */
   E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END,/* 0x48-0x4f */
   E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0,	      /* 0x50-0x57 */
-  0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0,	      /* 0x58-0x5f */
-  0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x60-0x67 */
-  0, 0, 0, 0, 0, 0, 0, E0_MACRO,		      /* 0x68-0x6f */
+  0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, E0_SLEEP,    /* 0x58-0x5f */
+  0, 0, 0, 0, 0, E0_SEARCH, E0_RUN, 0,		      /* 0x60-0x67 */
+  0, 0, 0, 0, E0_EMAIL, 0, 0, E0_MACRO,		      /* 0x68-0x6f */
   0, 0, 0, 0, 0, 0, 0, 0,			      /* 0x70-0x77 */
   0, 0, 0, 0, 0, 0, 0, 0			      /* 0x78-0x7f */
 };
@@ -311,6 +335,10 @@
 	  /*
 	   * usually it will be 0xe0, but a Pause key generates
 	   * e1 1d 45 e1 9d c5 when pressed, and nothing when released
+	   *
+	   * The Logitech Cordless iTouch generates e1 5c every few minutes for
+	   * no apparent reason.  It might have something to do with reporting
+	   * battery status, but I don't know.
 	   */
 	  if (prev_scancode != 0xe0) {
 	      if (prev_scancode == 0xe1 && scancode == 0x1d) {
@@ -318,6 +346,9 @@
 		  return 0;
 	      } else if (prev_scancode == 0x100 && scancode == 0x45) {
 		  *keycode = E1_PAUSE;
+		  prev_scancode = 0;
+	      } else if (prev_scancode == 0xe1 && scancode == 0x5c) {
+		  *keycode = E1_PING;
 		  prev_scancode = 0;
 	      } else {
 #ifdef KBD_REPORT_UNKN
Signature · 3 lines
Mike Paul
[email protected]
http://www.lehigh.edu/~mbp2/
#1 lore raw
Quoted 10 lines

The current discussion about dealing with patch integration in Linux has reminded me of this little patch I wrote a few months back for my Logitech iTouch cordless keyboard. It's mainly to put an end to the "unknown scancode" messages that would appear on the console every few minutes and corrupt my display, but while I was at it I added keycodes for the special-function buttons on the keyboard too.

Here's the patch, and it's a pretty straightforward one. It should apply cleanly to 2.4.17.

Can you give the DJ tree a try. We have replaced pc_keyb.c with the new input api drivers for PS/2 devices.