|
|
View Full Version : Building USB HID modules for 2.4.19-rmk7
hudson 03-31-2007, 06:29 PM EDIT: evkb-0.2 Application (http://www.mobileread.com/forums/showthread.php?t=10214&page=2&pp=15) 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
hudson 04-01-2007, 01:18 AM 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.
Antartica 04-01-2007, 05:01 AM No guarantees that it will work for you, but it works great for me with the mrxvt application.
So, is it working using the module and your evdev-XTEST conversion app?
If so, those are great news :-))).
henkvdg 04-01-2007, 09:46 AM Hudson, it works for me too!
Thank you very much!
hudson 04-01-2007, 09:52 AM So, is it working using the module and your evdev-XTEST conversion app?
It is working with the keyboard and fairly useful. I can run vi in the mrxvt application and use the iLiad as a very interesting text editor. I suspect that emacs could be compiled as well with little difficulty other than memory usage and the lack of any swap device.
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?
Robert Marquard 04-01-2007, 10:39 AM Is that a standard mouse or a mouse-keyboard combo? It could be the ReportID then.
hudson 04-01-2007, 12:04 PM Is that a standard mouse or a mouse-keyboard combo? It could be the ReportID then.
It's through a combined PS/2 keyboard/mouse to USB converter with my trusty 1991 Model-M and a random mouse from some other system. I don't have a true USB mouse to test with.
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.
Robert Marquard 04-02-2007, 03:12 AM 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.
Matthijs 04-02-2007, 03:48 AM 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.
hudson 04-02-2007, 09:18 AM For configs: see arch/arm/def-configs/irex*
That's very useful, thanks!
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).
Adam B. 04-02-2007, 09:36 AM 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.
Matthijs 04-02-2007, 09:51 AM 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.
hudson 04-02-2007, 09:58 AM 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
I'm not sure what the problem is -- it works great for me. I've been able to use insmod to load the HID modules and route the events to the X server via the Xtest extension. The application that I posted sets up everything with the kernel modules and runs the event redirector in the background.
Matthijs 04-02-2007, 10:37 AM 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 :blush: )
Nice job!
henkvdg 04-02-2007, 10:51 AM I'm not sure what the problem is -- it works great for me. I've been able to use insmod to load the HID modules and route the events to the X server via the Xtest extension. The application that I posted sets up everything with the kernel modules and runs the event redirector in the background.
As I found out, the keyboard works if it is fist connected before the application is started. When removed and reconnected, the application has to be started again to use the keyboard. Not every key of my keyboard is recognized correctly, so it seems the right keyboard description file has to be used.
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.
hudson 04-02-2007, 11:29 AM As I found out, the keyboard works if it is fist connected before the application is started. When removed and reconnected, the application has to be started again to use the keyboard.
The first version of the event redirector was really simple and didn't handle the /dev/input/event0 file going away (or not being present). I've made it loop now until the device file is available and sleep for 5 seconds after it goes away before trying again. This allows you to start it and plug/unplug the keyboard at anytime. I've also added the xev program and a command line event-dump to help debug other problems and input devices.
To install the easiest method is:
bzcat evkb-0.2.tar.bz2 | ssh root@10.0.0.200 tar -C /mnt/free/documents -xvf -
Not every key of my keyboard is recognized correctly, so it seems the right keyboard description file has to be used.
I've only tried it with rxvt so far with a US charset keyboard. My evkb program doesn't have any keyboard map -- the mapping is a simple 'Xkeycode = scancode + 8', which works for most of the normal keys with a US keymap. <linux/input.h> has the scancodes and if you run 'xmodmap -pk' it will print the keycodes and the keysyms that they map to.
Is it possible to configure the keyboard in azerty?
(The combination Maj + Alt. doesn't work :s )
hudson 08-20-2007, 09:00 PM It's not possible to reconfigure it as it is currently implemented -- you would need to produce your own table mapping of the keycodes to scancodes and write a lookup function for the loop. The xev program (included in the tar file) can be used to help track down the mappings.
To install the easiest method is:
bzcat evkb-0.2.tar.bz2 | ssh root@10.0.0.200 tar -C /mnt/free/documents -xvf -
So, I can't just copy the file to MMC card? Please, for somebody with very limited computer skills (I can get stuff to work for what I need, but programming is beyond me), what would dummy steps for installing this program be?
Thanks!
EDIT:
Ok, I tried to unzip it and it worked fine :).
kissyfish 02-09-2008, 09:32 PM I cannot get the KB (the Targus Universal USB folding keyboard) mentioned in another thread to work on my iliad. I have download the .bz file, unzipped on my mac, copied it into the /install folder on my cf card, pit it in the iliad, and clicked on it's icon inb the iliad, but so far, no dice. I was trying to test it with either gargoyle, or the todo program which Adam B ported.
Is this a problem with the compatibility with the apps, or am I being quite dumb and missing something obvious>
Many thanks in advance for your patience. I
wallcraft 02-10-2008, 01:17 AM I tested it with a standard USB keyboard:
In ContentLister, select USB Keyboard
Plug in the keyboard
Use the keyboard's up and down arrow keys and return to navigate contentlister
If the above works, then the keyboard is being recognized. The next step is to try it in your favorite applications. I tried my keyboard with mrxvt and FBReader - and both worked.
kissyfish 02-10-2008, 09:32 PM I tested it with a standard USB keyboard:
In ContentLister, select USB Keyboard
Plug in the keyboard
Use the keyboard's up and down arrow keys and return to navigate contentlister
If the above works, then the keyboard is being recognized. The next step is to try it in your favorite applications. I tried my keyboard with mrxvt and FBReader - and both worked.
It still does not appear to be working...
Do I have to do something to the USB to realize if it is in a master or slave position...
I will keep plugging away.
If I can get this thing working, it will have solved pretty much every problem I wanted to address with the iliad.
Thanks to all of you for your hard work.
I am going to try to rebrush up on some linux programming/porting.
Take care all,
Jim
kissyfish 03-18-2008, 02:12 PM It still does not appear to be working...
Do I have to do something to the USB to realize if it is in a master or slave position...
I will keep plugging away.
If I can get this thing working, it will have solved pretty much every problem I wanted to address with the iliad.
Thanks to all of you for your hard work.
I am going to try to rebrush up on some linux programming/porting.
Take care all,
Jim
Still no luck, I have been able to hook it up to my laptop, and it works well, but for some reason it just will not do anything with the iliad.
I am on the latest firmware version, is there anything I need to do because of that?
Jim
Redfox 04-11-2008, 03:02 AM :thanks:
Great little app - works "out of the box" with my Samsung slimline keyboard, and I can even send text from my Alphasmart Neo into vi :)
kissyfish 05-02-2008, 12:24 PM I am still having no luck with the keyboard, I have tested it with a laptop, and the keyboard appears to be working well, so now I am suspicious of my USB port on the iliad.
Anyone know a way to test it?
Mambo 05-03-2008, 03:26 PM I have tested this utility and it is working fine straight out of the box with generic keyboards. It does not work, however, with my wireless RF keyboard (keysonic). I think you should try with several different keyboards (maybe in your office if you can't test at home) to exclude the possibility that the problem is with your iLiad.
chungo 08-06-2008, 12:29 PM Hi there,
just wanted to know if there are any recent developments concerning USB keyboard compatibility coz mine aint working.
I installed the evbk package (or more exactly: copied the unzipped/untarred (is that a word ?:blink:) ) directory in the internal documents folder. When I click on the content listing icon "USB Keyboard"the Led on the iLiad flashes for a second or so but the keyboard wont work. Or is it essential to use the bzcat ... command? That one would not work either, the command (as depicted by hudson) resulted in a console full of "2c1;" (if I only type "bzcat evkb-0.2.tar.bz2") or in the message that ssh is not known (probably not installed ?) if I type the whole line "bzcat evkb-0.2.tar.bz2 | ssh root@10.0.0.200 tar -C /mnt/free/documents -xvf -"(as depicted by hudson).
I tried plugging the keyboard in before and after clicking on the icon, also I tried three different keyboards(Dell model L100, Lenovo SK 8815 and Logitech Deluxe 250)- nothing. Also none of the keyboard LEDs flashes which to me seems to be a sign of the keyboard not being initialized or not getting any current.
Any hint would be greatly appreciated!! Anyway, in my eyes, U guys already got a lot of props just by writing all these mods...:thumbsup:
Vanessa 09-01-2008, 02:04 PM For my part, I must say everything worked like a charm.
I unzipped the file, put it in my programs folder, clicked on it, plugged my keyboard in, opened abiword and started to type.
No problem.
However, I'm a total newbie in matters of programming (especially linux and its friend unix), and I don't know what to do to map the keyboard (needing a QWERTZ, that is the same as QWERTY, but with the accented letters) or even where to start. What file should I edit ? How do I open it ?
Any help would be great. I believe the usb keyboard is a MUST addition to the iLiad, as the iLiad can be used then as a notebook on the beach or in a park, or wherever you would want to take your notebook but can't because of the sun...
rachaelandrews 09-02-2008, 06:59 AM I saw talk on the forum elsewhere that the usb keyboard support was slow. I seem to recall you saying in that thread, Vanessa, that this would be a problem for you as you type fast ? So do I ! So, having completed the steps as listed in this thread and got the keyboard working, could you comment on the speed of the keyboard response ?
I would like to get a usb keyboard for my iliad but if it's slow slow slow I may not bother (I don't have one to try at the moment so a purchase would be needed.)
Thanks for any comment.
Rachael
Vanessa 09-02-2008, 07:26 AM Hi Rachael !
Actually, it's not that the keyboard is slow. Keyboard is normal. But the display of the text is slow, because of the screen being refreshed every second or so.
If you need to see what you write and if you make a lot of typing mistakes, don't bother getting an usb keyboard on your iLiad, you'll find it very annoying.
I used to have a very old laptop, and I was typing too fast for it. It displayed the sentences two by two, and meanwhile, displayed the "wait" cursor. Horrible. At that time, I needed to see what I was seeing. Now it's different, and I plan to use the iLiad mostly to type things that I have already written on paper.
I was lucky and somebody lent me an usb keyboard. Was in your situation : no usb keyboard and didn't want to buy one without having tried it.
Now I've tried it, it's fine, but as long as I can't get the QWERTZ swiss french layout mapped on my iLiad, I won't be buying any USB keyboard.
I hope somebody will come and give some advice about the mapping of the keyboard :)
yokos 09-02-2008, 09:20 AM @Vanessa: I have started a "Switching the Layout of the USB Keyboard" thread ages ago.
http://www.mobileread.com/forums/showthread.php?t=20791
Vanessa 09-02-2008, 12:28 PM You're great :) Gonna have a look right now !
rachaelandrews 09-03-2008, 10:54 AM Hi Rachael !
Actually, it's not that the keyboard is slow. Keyboard is normal. But the display of the text is slow, because of the screen being refreshed every second or so.
If you need to see what you write and if you make a lot of typing mistakes, don't bother getting an usb keyboard on your iLiad, you'll find it very annoying.
Ah-ha, I see the issue now. Thanks for explaining.
I won't need to see what I'm typing - I am fairly severely visually impaired so I can't see what I type half the time anyway. :) I had the idea that making some notes on the iLiad in certain situations could be useful, then I could transfer the files back to my mac and read them after the event. I expect what mistakes there may be (I'm no touch typist, but I'm ok) will not make the text totally unintelligible.
I've tried making notes with the scribble function and have found that twelve years of visual impairment has rendered my handwriting akin to the tracks of a drunken spider might, and myscript notes or whatever it is (runs on xp via vmware) can't make head nor tail of it. lol.
Perhaps a usb keyboard is a purchase option afterall. Now just to find a really tiny one !
Thanks for your advice.
Rachael
Vanessa 09-03-2008, 12:15 PM I think there is a foldable keyboard that would be great for the iLiad, that's the Targus usb foldable keyboard (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&ssPageName=STRK:MEWAX:IT&item=270270223798). That's the one I want. Unfortunately, I can't order it in the USA, so I need to wait for another auction on eBay :)
Don't purchase one of those stupid plastic rollable keyboards, they are not usable if you type fast (I've tried one of those that my mother purchased some years ago in Hong Kong).
The targus is foldable, so it's tiny, and still usable exactly like a normal keyboard :)
Vanessa 09-06-2008, 07:30 AM Bought it :) I think I'll receive the Targus foldable keyboard in a couple of weeks, maybe next week if I'm lucky. I'll post my impressions here :)
leomanic 01-10-2009, 12:24 PM I tried the software and it works great. I tested it with my "Logitech Media Elite" keyboard (corded). Don't know if I will use this functionality often though, as I don't have much to write while on the move.
Still, great piece of software, thanks!
tobyforever 03-04-2009, 11:02 AM I worked for a while with my usb keyboard in the console, it is working fine.
but once I clicked the "keyboard server" icon twice from the contentlist, everything I type becomes duplicated(two inputs for a single press).:smack: is this somewhat buggy? I thought it was easy to allow for only one instance of the server at a time, if that is the cause.:blink:
|