Quantcast
Channel: MobileRead Forums - Kobo Developer's Corner
Viewing all articles
Browse latest Browse all 1561

Clara HD USB OTG support on Clara HD — it works!

$
0
0
For several months now I've been working on a project that required keyboard input to my Clara HD, and up until now I was making it work by putting the Kobo into gadget ethernet mode, plugging the keyboard into a host computer (a Raspberry Pi), and transmitting data from the host to the Kobo over that ethernet connection. It worked, but it was kind of janky.

Then I ran across the XSoar people, who have set up Kobos as an onboard computer for gliders, using USB OTG. This gave me hope that I could get OTG working for my Clara HD.

The biggest hurdle is power; the Clara HD never supplies power via the USB port, and the keyboard does require power. However, there's a variant of OTG adapter that allows you to connect an external power supply. I ordered one such adapter from Amazon and it arrived today.

The next hurdle is that although the EHCI host controller appears in the dmesg logs, the devices I plugged in weren't actually being registered by the system.

It turns out that the devicetree configuration shipped by Kobo defaults to "gadget" mode and even an OTG adapter won't make it change its mind. But there's a way around that.

Code:

mount -t debugfs none /sys/kernel/debug
echo host > /sys/kernel/debug/ci_hdrc.0/role

Of course, once it's in host mode, you can't use the USB mass storage gadget (or any other USB gadget), so even if you tap Connect when Nickel reports a computer connection, nothing's going to happen. But that's fine, you can just go back to gadget mode.

Code:

echo gadget > /sys/kernel/debug/ci_hdrc.0/role
I ran in quite a lot of circles trying to figure out why my nice mechanical keyboard wasn't being recognized, and then I finally figured it out; I'd put the keyboard into mac layout mode (Ctrl, Alt, Logo instead of Ctrl, Logo, Alt), and it likes to report itself as being an Apple keyboard, which Linux thinks deserves a special driver. And of course the Kobo kernel doesn't have that driver compiled in.

The solution is pretty simple:

Code:

echo 1 > /sys/module/hid/parameters/ignore_special_drivers
After which point I was able to grab keycodes from /dev/input/event2.

(Plugging in USB drives appears to work as well, though the only USB drive I have handy is formatted in exfat, which the Kobo kernel doesn't support.)

Viewing all articles
Browse latest Browse all 1561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>