03-31-2007, 05:29 PM | #1 |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
Building USB HID modules for 2.4.19-rmk7
EDIT: evkb-0.2 Application You can use your USB keyboard with your iLiad with this application!
I've downloaded the linux-2.4.19-rmk7-pxz2-irex1 kernel sources and patches from the iRex website. The kernel sources appear to have the patch already installed, so it is not necessary to reapply it. There is no .config file included in the tar file (and 2.4 doesn't support /proc/config.gz), so I made some guesses and built input, hid, evdev and keybdev as modules (abbreviated .config): CONFIG_ARM=y CONFIG_ARCH_PXA=y CONFIG_MACH_PXA_IREX_ER0100=y CONFIG_INPUT=m CONFIG_INPUT_KEYBDEV=m CONFIG_INPUT_MOUSEDEV=m CONFIG_INPUT_MOUSEDEV_SCREEN_X=768 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1024 CONFIG_INPUT_JOYDEV=m CONFIG_INPUT_EVDEV=m CONFIG_USB=y CONFIG_USB_DEVICEFS=y CONFIG_USB_HID=m CONFIG_USB_HIDINPUT=y CONFIG_USB_HIDDEV=y CONFIG_USB_KBD=m CONFIG_USB_MOUSE=m CONFIG_USB_WACOM=m I'm able to load them and it detects the USB keyboard/mouse on the port and I can disconnect/reconnect them without problems, but once I hit a single key it hangs the device hard. If I do not load keybdev, I can try to read /dev/input/mouse0 or /dev/input/event[01], but I never see any events in any of them. If I load the old BP usb keyboard/mouse modules (usbkbd.o) I do not see any results, either, but at least it doesn't hang. dmesg output, although I don't have any after the hang: usb.c: registered new driver hiddev usb.c: registered new driver hid input0: USB HID v1.00 Keyboard [0d3d:0001] on usb1:2.0 input1: USB HID v1.00 Mouse [0d3d:0001] on usb1:2.1 hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz> hid-core.c: USB HID support drivers Last edited by Adam B.; 07-12-2007 at 03:51 PM. Reason: Added link to updated application binary |
04-01-2007, 12:18 AM | #2 |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
USB keyboard application
Following up on my own query, I realized that cat was line buffering the output from the event device file, so I instead I wrote an event decoder that generates synthetic X events via the Xtest extension (attached). You should be able to drop this into /mnt/free/documents or wherever and have an icon to launch the USB keyboard interface. Plug in the keyboard before running so that /dev/input/event0 is already allocated. It may be possible to rebuild the kdrive tinyX server to use the evdev interface (or it may already be enabled). Either of those would allow the use of a USB keyboard without any problems.
The keyboard appears to be correct when I use the usbkbd.c modules, but the mouse is as if the data[] array in the usb_mouse.c usb_mouse_irq() function is shifted by one array position. That doesn't explain the crash with the full HID driver, but I'm less inclined to hunt it down now that I have it working. In the tarfile is the full source, as well as a pre-compiled version with the pre-compiled kernel modules for the 2.4.19-rmk7 kernel used in the iRex 2.9.1 firmware. No guarantees that it will work for you, but it works great for me with the mrxvt application. |
Advert | |
|
04-01-2007, 04:01 AM | #3 | |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Quote:
If so, those are great news :-))). |
|
04-01-2007, 08:46 AM | #4 |
Groupie
Posts: 180
Karma: 66830
Join Date: Oct 2006
Device: IREX iLiad, Pocketbook Pro 903
|
USB Keyboard
Hudson, it works for me too!
Thank you very much! |
04-01-2007, 08:52 AM | #5 | |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
Keyboard works, mouse doesn't
Quote:
The mouse device is still hosed. The data reaching the usb device driver just doesn't make sense. Here is the interrupt routine from 2.4.19: static void usb_mouse_irq(struct urb *urb) { struct usb_mouse *mouse = urb->context; signed char *data = mouse->data; struct input_dev *dev = &mouse->dev; if (urb->status) return; input_report_key(dev, BTN_LEFT, data[0] & 0x01); input_report_key(dev, BTN_RIGHT, data[0] & 0x02); input_report_key(dev, BTN_MIDDLE, data[0] & 0x04); input_report_key(dev, BTN_SIDE, data[0] & 0x08); input_report_key(dev, BTN_EXTRA, data[0] & 0x10); input_report_rel(dev, REL_X, data[1]); input_report_rel(dev, REL_Y, data[2]); input_report_rel(dev, REL_WHEEL, data[3]); } The data[] array should contain the button bitmap, the relative X, relative Y and relative wheel data (in that order). What I see is that data[0] is always 1, data[1] is the bitmap, data[2] is the X motion and data[3] is the Y motion. If I hack the routine to use 'data = mouse->data + 1' everything looks good, including the wheel and buttons. It wouldn't be too much work to add mouse support to the evkb program. Does the window manager support displaying a mouse cursor? |
|
Advert | |
|
04-01-2007, 09:39 AM | #6 |
Delphi-Guy
Posts: 285
Karma: 1151
Join Date: May 2006
Location: Berlin, Germany
Device: iLiad, Palm T3
|
Is that a standard mouse or a mouse-keyboard combo? It could be the ReportID then.
|
04-01-2007, 11:04 AM | #7 | |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
Quote:
Looking into the future, 2.6.19 uses the same logic for parsing the mouse->data[] in drivers/usb/input/usbmouse.c:usb_mouse_irq(), so the problem may be with the USB converter. I'll see if I can find a real mouse to test with, as well as a folding USB keyboard for travel. |
|
04-02-2007, 02:12 AM | #8 |
Delphi-Guy
Posts: 285
Karma: 1151
Join Date: May 2006
Location: Berlin, Germany
Device: iLiad, Palm T3
|
So the device uses PS/2 devices (mouse and keyboard) as input devices and represents a mouse/keyboard composite HID device to the OS. It is definitely possible to have such a device use ReportIDs. USB on Linux is still immature even for 2.6. I would suspect either a bug in the 2.4 kernel or a bug in the device. ReportID 1 for the mouse data is suspicious. I would have expected 2.
|
04-02-2007, 02:48 AM | #9 |
Groupie
Posts: 199
Karma: 666
Join Date: Oct 2006
Location: Eindhoven, the Netherlands
Device: iLiad, DR1000S, DR800SG
|
For configs: see arch/arm/def-configs/irex*
so, to compile use: make irex_config make oldconfig make dep make zImage Edit: so "make irex_config" installs the iRex .config file, which you can then edit. Last edited by Matthijs; 04-02-2007 at 03:06 AM. Reason: Explain some more |
04-02-2007, 08:18 AM | #10 | |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
Quote:
For anyone else who wants to build their own USB HID kernel modules, here is a diff between the official .config and my .config. Mostly I've just added the input core and USB HID modules, as well as a few other little things to make my life easier (like the NFS client and loopback filesystems). |
|
04-02-2007, 08:36 AM | #11 |
Addicted to Porting
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
|
Great work! With a full keyboard, the iLiad could really be a great platform for always-available productivity applications. It has the potential to be so much more than just a document reader.
|
04-02-2007, 08:51 AM | #12 |
Groupie
Posts: 199
Karma: 666
Join Date: Oct 2006
Location: Eindhoven, the Netherlands
Device: iLiad, DR1000S, DR800SG
|
Not to spoil the fun, but:
The problem with this will probably be that even though you have HID modules, you cannot modprobe them and make it work without reflashing a kernel (which you cannot do at this point, since you're not on 2.9.5)... See also Scotty's efforts to get a keyboard working. |
04-02-2007, 08:58 AM | #13 | |
Stunt Programmer
Posts: 31
Karma: 449
Join Date: Mar 2007
Location: Washington, DC
Device: iRex iLiad, Sony PRS500, Treo 650
|
Quote:
|
|
04-02-2007, 09:37 AM | #14 |
Groupie
Posts: 199
Karma: 666
Join Date: Oct 2006
Location: Eindhoven, the Netherlands
Device: iLiad, DR1000S, DR800SG
|
Ah, ok. In that case: ignore my message. From when Scotty tried it, I though I recalled that a new kernel would be needed. Apparently not.
(And I didn't read you first two posts well enough ) Nice job! Last edited by Matthijs; 04-02-2007 at 09:39 AM. |
04-02-2007, 09:51 AM | #15 | |
Groupie
Posts: 180
Karma: 66830
Join Date: Oct 2006
Device: IREX iLiad, Pocketbook Pro 903
|
Quote:
I could use the keyboard for the terminal program, but not for changing the name or comments with a file, by using the label icon. So at least a little bit extra will be needed to use this possibility tot the max. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Updating modules without a full dev environment? | ldolse | Calibre | 2 | 08-20-2010 01:29 PM |
Plugins and optional Python modules | pdurrant | Plugins | 14 | 03-02-2010 03:28 AM |
Process Modules | LarryLaser | Calibre | 3 | 02-10-2010 12:32 PM |
NEC develops A4, A3 e-paper modules | grimo1re | News | 2 | 10-29-2008 01:31 AM |
iLiad USB serial modules | drazvan | iRex Developer's Corner | 8 | 07-30-2007 05:43 PM |