Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-18-2023, 03:58 AM   #1
jmacindoe
Junior Member
jmacindoe began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra H2O, Kobo Clara 2E
Using a Bluetooth keyboard with recent Kobos

Recent Kobos have Bluetooth so we can use a physical keyboard. I'm using this to turn my Kobo into an eink writing device but you can also use it in the Nickel web browser, to turn pages, or even in X11

I've only tested this with a Kobo Clara 2E and a Logitech POP KEYS keyboard, but I expect it would work for other Bluetooth devices. I'm guessing even a mouse would work in X11.

Setup
Setup is quite technical! If you're not familiar with the linux command line, you might have a tough time.
1. You'll need SSH access to your device e.g. using the SSH server built into KOReader. I like to do it over USB because it's more stable than WiFi https://www.mobileread.com/forums/sh...d.php?t=254214
2. Download the uhid.ko kernel module for your device from https://github.com/jmacindoe/kobo-kernel-modules/
3. Copy it to your device by plugging your Kobo into your computer, or use SSH to copy it wirelessly
Code:
scp uhid.ko root@192.168.2.2:/mnt/onboard/
4. Insert the module into the kernel
Code:
insmod /mnt/onboard/uhid.ko
5. Pair the keyboard. Pairing in Nickel didn't work for my keyboard but you can do it on the command line. You only have to pair it once, and then connecting/disconnecting each time can be done in Nickel. To pair, first go into the Bluetooth settings in Nickel and make sure bluetooth is turned on. Then run the command `bluetoothctl`. Inside the bluetoothctl prompt, run the following commands.
Code:
bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent NoInputNoOutput
Agent registered
If it says "Agent is already registered", run
Code:
[bluetooth]# agent off
Agent unregistered
[bluetooth]# agent NoInputNoOutput
Agent registered
Now run
Code:
[bluetooth]# default-agent 
Default agent request successful
Now we need the Bluetooth address of your keyboard. Put the keyboard in pairing mode and inside bluetoothctl run
Code:
[bluetooth]# scan on
Once you see the address show up, run `pair` with that address
Code:
[bluetooth]# pair 59:A0:E4:69:24:7B [replace with your address]
Pairing successful
This is what worked for my keyboard. If doesn't work for you, I'd suggest trying different 'agents'. These describe the tactic Bluetooth will use to pair securely (e.g. enter a 6 digit code, etc). Normally for my keyboard, MacOS/Android/etc will give me a 6 digit code I need to type on the keyboard to pair, however I couldn't get this to work with the Kobo. 'NoInputNoOutput' is designed for devices with no input or output, where you can't type a code, and so it pairs without any codes. Fortunately this worked with my keyboard. I'm not sure if it works with every keyboard, but I hope so.

You can check if your device is paired and connected using
Code:
info 59:A0:E4:69:24:7B [replace with your address]
We want to see
Code:
	Paired: yes
	Connected: yes
And if you ever forget that address you can see it again by running "paired-devices" in bluetoothctl.

Once paired, you should never need to do this pairing process again, but you will need to 'connect' each time. In Bluetooth terminology, pairing is the thing you do once so the devices know about each other, connecting is what you need to do everytime you use the device.

You should be able to connect using Nickel, or in the bluetoothctl prompt, run
Code:
connect 59:A0:E4:69:24:7B [replace with your address]
My keyboard can be paired with up to 3 different devices and there are three buttons to switch between devices. On my keyboard, after I start the connect from bluetoothctl, I need to press one of these buttons (the one I paired with) for the connect to complete. This is the same in Nickel: it won't connect unless I press the button on the keyboard.

6. Once paired and connected, you should get a new input event device at /dev/input/event3. Try running `cat /dev/input/event3` and press some keys on your keyboard. You should see some random output. It's working! Press Ctrl-C to exit that. You can also see info about your device by running `cat /proc/bus/input/devices`.
7. Once everything is looking good, let's set it up so uhid.ko loads on start up. Otherwise you'll have to run `insmod uhid.ko` after every restart.
First we will move the module onto the root filesystem. The onboard storage may not be mounted yet during startup, so it's safer this way.
Code:
mkdir /usr/local/modules
mv /mnt/onboard/uhid.ko /usr/local/modules/uhid.ko
Now we tell the OS to insert the module on every boot
Code:
echo KERNEL==\"loop0\", RUN+=\"/bin/sh -c \'insmod /usr/local/modules/uhid.ko\'\" > /etc/udev/rules.d/99-modules.rules
This will create a file `/etc/udev/rules.d/99-modules.rules` with contents
Code:
KERNEL=="loop0", RUN+="/bin/sh -c 'insmod /usr/local/modules/uhid.ko'"
which will get udev to insert the module for us on boot.

Using it in Nickel
It seems like the keyboard "just works" in Nickel 🎉. I don't use Nickel much so I haven't tested it a lot but it worked for me in search, the browser, the reader, etc.

Using it in KOReader
KOReader kills the bluetooth on launch here and here. But even if we remove that, it seems KOReader still doesn't make use of the keyboard. No doubt this could be fixed. I'll update this section if anyone gets it working!

Using it in X
You can set up X on you Kobo by following the instructions here. These commands will get the keyboard working (thanks to elinkser for first posting about this here).
1. Install udev
Code:
apk add eudev
apk add eudev-hwids
2. Launch udev. This must be done after every reboot before starting X.
Code:
udevd -d
udevadm trigger
3. Launch X
4. Hopefully the keyboard is working! If not, check /dev/input/event3 exists and check libinput can see it by running `DISPLAY=:0 libinput debug-events`

Keyboard on non-Bluetooth Kobos
I haven't tested this myself, but I think you could get the above instructions working on non-Bluetooth Kobos by having a keyboard plugged into another computer (e.g. Rasberry Pi) and then streaming the keyboard events over WiFi as detailed here
It also looks like you can theoretically use a USB keyboard, but the Kobo USB port isn't powered, so powering the keyboard is tricky, and you'll also need to compile a new kernel. So it's not very practical. See https://github.com/olup/kobowriter if interested.
inkvt also has some nice tricks for streaming keyboard events over the network.
jmacindoe is offline   Reply With Quote
Old 02-19-2023, 09:45 PM   #2
elinkser
Groupie
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 188
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
Nice instructions!

On the subject of the non-bluetooth kobos, here are some additional approaches, depending on if one's priority is entering data on the Kobo vs entering data anywhere while watching it unfold on a beautiful paper-like display!

This project also may have "keyboard potential"?
https://github.com/tylpk1216/KoboPageTurner
https://www.mobileread.com/forums/sh...=345507&page=4

Last edited by elinkser; 02-19-2023 at 10:06 PM.
elinkser is offline   Reply With Quote
Advert
Old 02-19-2023, 11:01 PM   #3
jmacindoe
Junior Member
jmacindoe began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra H2O, Kobo Clara 2E
Oh nice. Yeah looks like there are some more instructions on using a USB keyboard here that I hadn't noticed before.
jmacindoe is offline   Reply With Quote
Old 02-20-2023, 09:20 PM   #4
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,491
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
The OTG workflow is automated in KOReader for supported devices, FWIW (as long as you didn't disable the "External keyboard" plugin).

I have yet to find time to play with bluetooth myself...
NiLuJe is offline   Reply With Quote
Old 03-01-2023, 12:48 AM   #5
kobol2
Junior Member
kobol2 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra 2
My pageturner is paired and connected but I don't see `/dev/input/event3`.. any idea what I can try?
kobol2 is offline   Reply With Quote
Advert
Old 03-01-2023, 12:55 AM   #6
kobol2
Junior Member
kobol2 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra 2
output of my `info`

```
Device XX:XX:XX:XX:XX:XX (public)
Name: S18
Alias: S18
Appearance: 0x03c1
Icon: input-keyboard
Paired: yes
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000ae40-0000-1000-8000-00805f9b34fb)
Modalias: usb:v05ACp022Cd011B
RSSI: -56
Battery Percentage: 0x61 (97)
```
kobol2 is offline   Reply With Quote
Old 03-01-2023, 01:17 AM   #7
kobol2
Junior Member
kobol2 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra 2
my logread
```
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) initializing 'BluetoothPageTurner' (version: 26e344c-dirty)
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... desc: Turn pages with Bluetooth device
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) creating failsafe
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: allocating memory
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: finding filenames
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: ensuring own lib remains in memory even if it is dlclosed after being loaded with a dlopen
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libbtpt.so to /usr/local/Kobo/imageformats/libbtpt.so.failsafe
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) checking config
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) checking for uninstall flag '/mnt/onboard/.btpt//uninstall'
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) loading libraries
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) resolving symbols
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN18BluetoothHeartbeatC1Ex' from RTLD_DEFAULT to 0x6f2633e8
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN18BluetoothHeartbeat4beatEv' from RTLD_DEFAULT to 0x6f2633ec
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN20MainWindowController14sharedInstanceEv' from RTLD_DEFAULT to 0x6f2633f0
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZNK20MainWindowController11currentViewEv' from RTLD_DEFAULT to 0x6f2633f4
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN9TimeEvent9eventTypeEv' from RTLD_DEFAULT to 0x6f2633f8
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN12PowerManager14sharedInstanceEv' from RTLD_DEFAULT to 0x6f2633fc
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) info: nh_dlsym: loading symbol '_ZN12PowerManager6filterEP7QObjectP6QEvent' from RTLD_DEFAULT to 0x6f263400
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) applying hooks
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) calling next init
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) destroying failsafe
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: scheduling restore
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) done init
Mar 1 14:08:01 nickel: (BluetoothPageTurner) starting
Mar 1 14:08:01 nickel: (BluetoothPageTurner) waiting for input devices
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: restoring after 0 seconds
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libbtpt.so.failsafe to /usr/local/Kobo/imageformats/libbtpt.so
Mar 1 14:08:01 nickel: (BluetoothPageTurner) (NickelHook) ... failsafe: info: freeing memory
Mar 1 14:08:01 nickel: (NickelMenu) cfg(NM_CONFIG_TYPE_MENU_ITEM) : 1:Bluetooth Patch (toggle) (src/config.c:367)
Mar 1 14:09:54 nickel: (NickelMenu) adding item 'Bluetooth Patch (toggle)'... (src/nickelmenu.cc:348)
Mar 1 14:11:45 nickel: (NickelMenu) adding item 'Bluetooth Patch (toggle)'... (src/nickelmenu.cc:348)
Mar 1 14:12:52 nickel: (NickelMenu) adding item 'Bluetooth Patch (toggle)'... (src/nickelmenu.cc:348)
Mar 1 14:12:53 nickel: (NickelMenu) adding item 'Bluetooth Patch (toggle)'... (src/nickelmenu.cc:348)
Mar 1 14:15:04 nickel: ( 330.999 @ 0x372f7f0 / libraryLayout.warning) void AbstractLibraryController<C>::layout(bool) [with C = BluetoothDevice] view is null
Mar 1 14:15:04 nickel: ( 331.049 @ 0x372f7f0 / libraryLayout.warning) void AbstractLibraryController<C>::layout(bool) [with C = BluetoothDevice] source has no rows
Mar 1 14:15:04 nickel: ( 331.050 @ 0x372f7f0 / libraryLayout.warning) void AbstractLibraryController<C>::layout(bool) [with C = BluetoothDevice] source has no rows
Mar 1 14:15:07 bluetoothd[1825]: Bluetooth daemon 5.63
Mar 1 14:15:07 bluetoothd[1825]: Bluetooth management interface 1.9 initialized
```
kobol2 is offline   Reply With Quote
Old Today, 06:17 AM   #8
jixbo
Junior Member
jixbo began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2024
Device: kobo clara 2e
Followed this guide and the keyboard works!!!
Now I am looking for a way to take notes, or write documents. Something basic would do... Any ideas?
I guess running a whole X would do, but seems overkill. Just a simple nano/vi would be great.
jixbo is offline   Reply With Quote
Old Today, 06:47 AM   #9
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,948
Karma: 87999999
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
A BT KB works on my Sage or Elipsa anywhere a Touch keyboard would popup, so can be used to type an annotation, but not used to input text in Notebooks (only type file names). I didn't try any other Kobos.

No need to follow any guide or install anything.

Possibly KOReader install includes something to edit text files?

I installed Jota on my Android eink and decided that while eink is great to read novels, it's rubbish for text editing, email (K9 mail), or a browser.

Last edited by Quoth; Today at 06:50 AM.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The recent Kobos seem to have darker backgrounds! gottogetout Kobo Reader 6 03-06-2019 05:12 PM
Bluetooth keyboard getting old NickyWithNook Apple Devices 0 10-16-2013 08:53 PM
HD Fire HD Keyboard and Bluetooth Keyboard? Doc109 Kindle Fire 18 01-29-2013 09:54 AM
Bluetooth keyboard Gunnerp245 enTourage eDGe 0 08-13-2011 08:56 PM
Bluetooth Keyboard jgray Android Devices 6 08-01-2011 12:42 PM


All times are GMT -4. The time now is 12:40 PM.


MobileRead.com is a privately owned, operated and funded community.