Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 08-20-2024, 08:31 PM   #16
enji
Junior Member
enji has a complete set of Star Wars action figures.enji has a complete set of Star Wars action figures.enji has a complete set of Star Wars action figures.enji has a complete set of Star Wars action figures.enji has a complete set of Star Wars action figures.
 
Posts: 4
Karma: 430
Join Date: Oct 2018
Device: NUNYA
I got bluetooth working on a Libra 2 by using `rtk_hciattach` instead of `hciattach`.

Along with the rest of the instructions on github, the plugin works great after just tweaking the on/off scripts:
  1. In bluetooth.koplugin/on.sh, changed `/sbin/hciattach -p ttymxc1 any 1500000 flow -t 20` to `/sbin/rtk_hciattach -s 115200 ttymxc1 rtk_h5`. The different parameters are what dmesg showed when watching Nickel enable bluetooth.
  2. In bluetooth.koplugin/off.sh, changed `pkill hciattach` to `pkill rtk_hciattach`

No need to remove the bluetoothd kill command from the KOReader startup script or reconnect to the clicker in Nickel.

Thank you for creating this! I've been using it for a few days, and it works perfectly with bluetooth on/off and Restart KOReader commands mapped to gestures.
enji is offline   Reply With Quote
Old 08-21-2024, 12:17 AM   #17
trence
Connoisseur
trence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enough
 
Posts: 72
Karma: 548
Join Date: Nov 2018
Device: Likebook Mars
Thank you for that info, that did allow me to turn on the bluetooth. My device was listed in bluetoothctl. While doing the trust, and connect via SSH, I did receive this error message:

bluetooth]# trust E0:F8:48:04:36:23
[bluetooth]# [bluetooth]# Changing E0:F8:48:04:36:23 trust succeeded
[bluetooth]# connect E0:F8:48:04:36:23
Attempting to connect to E0:F8:48:04:36:23
[bluetooth]# [bluetooth]# Failed to connect: org.bluez.Error.NotReady br-connection-adapter-not-powered
[bluetooth]#


Would either of you know what I am doing wrong by chance?

Edit: After a reboot, connect worked and the device paired! But it does not turn pages, yet. I did restart Koreader, as well.

This is my device.patch.lua, does this look correct?

--- koreader/frontend/device/kobo/device.lua 2024-07-15 12:02:02.000000000 -0400
+++ koreader/frontend/device/kobo/device.lua 2024-08-11 17:54:44.000000000 -0400
@@ -489,6 +489,7 @@
hasEclipseWfm = yes,
canToggleChargingLED = yes,
led_uses_channel_3 = true,
+ hasKeys = yes,
hasFrontlight = yes,
display_dpi = 300,
hasNaturalLight = yes,
@@ -828,6 +829,7 @@
[4] = "RPgFwd",
[102] = "Home",
[116] = "Power",
[193] = "RPgBack",
[115] = "RPgFwd",
[194] = "RPgFwd",
[331] = "Eraser",
[332] = "Highlighter",
[304] = "RPgFwd",
[305] = "RPgFwd",
[307] = "RPgFwd",
[308] = "RPgFwd",
@@ -901,6 +903,13 @@
-- NOTE: usb hotplug event is also available in /tmp/nickel-hardware-status (... but only when Nickel is running ;p)
self.input.open("fake_events")

+ local success, err = pcall(function()
+ self.input.open("/dev/input/event4")
+ end)

Last edited by trence; 08-21-2024 at 02:01 AM.
trence is offline   Reply With Quote
Old 08-21-2024, 10:46 AM   #18
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Quote:
Originally Posted by enji View Post
I got bluetooth working on a Libra 2 by using `rtk_hciattach` instead of `hciattach`.

Along with the rest of the instructions on github, the plugin works great after just tweaking the on/off scripts:
  1. In bluetooth.koplugin/on.sh, changed `/sbin/hciattach -p ttymxc1 any 1500000 flow -t 20` to `/sbin/rtk_hciattach -s 115200 ttymxc1 rtk_h5`. The different parameters are what dmesg showed when watching Nickel enable bluetooth.
  2. In bluetooth.koplugin/off.sh, changed `pkill hciattach` to `pkill rtk_hciattach`

No need to remove the bluetoothd kill command from the KOReader startup script or reconnect to the clicker in Nickel.

Thank you for creating this! I've been using it for a few days, and it works perfectly with bluetooth on/off and Restart KOReader commands mapped to gestures.

Wow thank you for the contribution and testing this. I'll be sure to add this to the repository as a workaround for Libra!



Quote:
Originally Posted by trence View Post
This is my device.patch.lua, does this look correct?
Oh, I think that's my unclear instructions that got you again. The *.patch file was just me documenting the changes that need to be applied to the actual internal KOReader files.

The file you want to modify is at :
koreader/frontend/device/kobo/device.lua

This is outside of the plugin's folder structure.

Last edited by lumping-sugar66; 08-21-2024 at 11:13 AM.
lumping-sugar66 is offline   Reply With Quote
Old 08-21-2024, 03:46 PM   #19
trence
Connoisseur
trence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enough
 
Posts: 72
Karma: 548
Join Date: Nov 2018
Device: Likebook Mars
Success! I was able to connect and turn pages. One last question, and I swear I will never bug you again

I am finding that I have to manually connect to the bluetooth device via SSH with bluetoothctl each time I want to connect. Is this expected?

I added this section of the patch lua as well to my main config:
local success, err = pcall(function()
+ self.input.open("/dev/input/event4")
+ end)

I wasn't sure if that had something to do with the auto connection, but still no luck.

Edit: Not sure what I did wrong initially, but all is well. It is connecting now automatically. Fantastic, thank you!

Thank you again to both of you, really really cool of you to do this. If either of you have a "Buy Me a Coffee" type thing, please let me know.

Last edited by trence; 08-21-2024 at 08:01 PM.
trence is offline   Reply With Quote
Old 08-21-2024, 11:33 PM   #20
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Quote:
Originally Posted by trence View Post
Success! I was able to connect and turn pages. One last question, and I swear I will never bug you again
Great! I'm glad you have it working. It's not bugging me at all; I don't have access to a wide variety of devices so all feedback is useful for me to make a package that is closer to hands-off. It's a pleasure.


Quote:
Originally Posted by trence View Post
I am finding that I have to manually connect to the bluetooth device via SSH with bluetoothctl each time I want to connect. Is this expected?
It's not unheard of. I have 3 bluetooth devices and two of them automatically connect while the other do NOT engage the connection automatically for one reason or the other. In those circumstances Kobo device itself need to engage the pairing request by itself.

Until I make another patch, you can circumvent this by adding your custom bluetoothctl commands to the end of the on.sh script. Keep in mind that although $ bluetoothctl gives you a prompt to enter your bluetooth commands, it also works as a command line utility where you can pass your commands as arguments. In other words:
Code:
$ bluetoothctl pair <DEVICE_MAC_ADDRESS>
Is a perfectly good command that would initiate your pairing without getting into the bluetoothctl prompt, making them useful for shell scripting.
You would still need to restart KOReader after this, but your connection will have been established at that point.

P.S.I'm also looking into automating the connections without requiring restarts, my favorite clicker is a 2$ photo shutter from china and it frequently loses bluetooth, disturbing my flow. I will make the plugin not only connect automatically but renew as connections gets lost. More to come on this.
lumping-sugar66 is offline   Reply With Quote
Old 08-28-2024, 05:23 PM   #21
hilotime
Junior Member
hilotime began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2024
Device: Kobo Libra 2
In over my head!

I want to use the Logi R500s to turn pages on my Kobo Libra 2.

So far I've installed OCP-KOreader-v2024.07 and kfm_mac_install. After doing this I realized I needed nickel menu, so I installed KoboRoot.tgz copying it to the .Kobo folder. I then configured nickel menu pasting the downloaded config file to the nm folder. I got all of this from YouTube videos with titles that sounded like what I wanted to do. Next, I followed the 'How to Install' instructions found on bluetooth.koplugin/readme.md. Instruction number one was easy enough, I copied the folder into koreader/plugins. Number two was less straight forward; I tried pairing the Logi R500s by going into KOReader on my Libra 2. It found my network, but said nothing about pairing to the R500s. I also tried to pair the R500s and Libra 2 toggling it on Kobo's own reader software. That way I managed to pair the R500s, but it was toggled off the next time I checked. Instruction number three was a complete. I don't know what to make of the instruction to 'make sure that your device is mapped to /dev/input/event3'. Instruction number four is also over my head. And it's the same for number five. I did manage to make Enji's Libra 2 adaptions.

I don't even know enough to know what I need help with. It feels like I'm asking a lot, but I won't know if I don't ask. Thank you in advance for whatever time and effort you can offer me.
hilotime is offline   Reply With Quote
Old 08-29-2024, 11:21 AM   #22
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
@hilotime, Yeah this plugin is not the most non-programmer-friendliest to adopt and use in its current state. It works, but you need to do a lot of handholding and changing code to make it get to where you want it.

One thing that this plugin leaves completely out of scope is making sure your bluetooth device can be paired and ensuring the requisites for a page turner is met. Because of that, I'd recommend trying out tsowell's bluetooth page turner first, before moving on to KOReader-based page turner. Before you see the bluetooth working with kobo's nickel and nickelmenu, I'm afraid you're not at a point where you can ensure the bluetooth device is paired properly.

So first step for you would be to make your device work with that page turner. Using the standard kobo software will require minimal programming/ssh access to get the bluetooth device paired, actions figured out, and give you ability to test the page turning action. Once that's ensured, we can help you better with the rest of the installation process.

I hope this helps
lumping-sugar66 is offline   Reply With Quote
Old 08-29-2024, 08:58 PM   #23
hilotime
Junior Member
hilotime began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2024
Device: Kobo Libra 2
@lumping-sugar66,
Thanks for the prompt reply. I had a feeling I was in over my head. I'll do as you said and start with tsowell's bluetooth page turner. If all goes well, you'll be hearing from me again.
Thank you, again!
hilotime is offline   Reply With Quote
Old 09-01-2024, 07:49 PM   #24
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Attention Bluetooth enthusiasts.

I'm excited to share some improvements to this KOReader plugin for Kobo.
Key updates:
* the elimination of the need to restart KOReader after enabling Bluetooth.
* Introduced new commands like "Refresh Device Input" and "Connect to Device".
* Added custom Bluetooth actions that can be used in your device.lua for more customized functionality. Font size controls, rotation, chapter, page and a few others.
* All commands can now be triggers using Taps & Gestures.

See the description for more info.
lumping-sugar66 is offline   Reply With Quote
Old 09-07-2024, 04:34 PM   #25
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Just pushed a new tag v0.3.0

This version includes:
  1. User-friendly popup messages: no verbose outputs on happy-case events. Full logs are still produced for debugging support.
  2. Wifi is not managed: The plugin will not attempt to turn Wifi on anymore and instead will prompt the user to do so. This is introduced to allow using bluetooth when internet is not available; this way user can turn on wifi and disregard no connectivity notice and proceed to bluetooth connection.
  3. Bluetooth operations are allowed only when bluetooth on: To prevent accidental operations.
  4. More custom events: Below you'll find the full list.
  5. Bugfixes and various improvements: Mainly to disallow actions and be more communicative.



Events as of v0.2.0
BTGotoNextChapter: Navigate to the next chapter.
BTGotoPrevChapter: Navigate to the previous chapter.
BTDecreaseFontSize: Reduce the font size by 1.
BTIncreaseFontSize: Increase the font size by 1.
BTToggleBookmark: Toggle bookmarks on and off.
BTIterateRotation: Rotate the screen orientation 90 degrees.
BTBluetoothOff: Turn off Bluetooth.
BTRight: Go to the next page.
BTLeft: Go to the previous page.

New events in v0.3.0:
BTPrevBookmark: Navigate to the previous bookmark in the document.
BTNextBookmark: Navigate to the next bookmark in the document.
BTLastBookmark: Jump to the last bookmark by creation date.
BTToggleStatusBar: Toggle the display of the status bar.
BTIncreaseBrightness: Increase the frontlight brightness by 10 units.
BTDecreaseBrightness: Decrease the frontlight brightness by 10 units.
BTToggleNightMode: Toggle between dark mode (night mode) and light mode.
BTIncreaseWarmth: Increase the warmth of the frontlight by 2 units.
BTDecreaseWarmth: Decrease the warmth of the frontlight by 2 units.
lumping-sugar66 is offline   Reply With Quote
Old 09-08-2024, 09:14 PM   #26
trence
Connoisseur
trence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enough
 
Posts: 72
Karma: 548
Join Date: Nov 2018
Device: Likebook Mars
Hey There, looking forward to trying 3.0. Still rocking the original. Quick question, does it need to be connected to a SSID to enable bluetooth? I get that the Wifi Chip and Bluetooh are the same, so if one is on the other is. But when I have no SSIDs learned in Nickel, the Connection always fails. Just curious, as I typically don't have any SSIDs learned.
trence is offline   Reply With Quote
Old 09-09-2024, 01:09 PM   #27
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Quote:
Originally Posted by trence View Post
Hey There, looking forward to trying 3.0. Still rocking the original. Quick question, does it need to be connected to a SSID to enable bluetooth? I get that the Wifi Chip and Bluetooh are the same, so if one is on the other is. But when I have no SSIDs learned in Nickel, the Connection always fails. Just curious, as I typically don't have any SSIDs learned.
Hi trence. I was camping last week with no Wi-Fi around, and realized the same limitation. In the previous version (original one you have) it is an unnecessary limitation I introduced by mistake. The plugin won't get to the later steps of enabling bluetooth if there's no network to connect to, but it's was a mistake.

It's now fixed on v0.3.0, where the system will not try to manage your Wifi anymore. It will ask you to turn on Wi-Fi by yourself (if it's not on already), and doesn't care if there's no SSID to connect to. You can enable WiFi by KOReader, have it not connect to anything, and still enable bluetooth.

As you pointed out, we just need the chip powered on, and there's no need for any network.
lumping-sugar66 is offline   Reply With Quote
Old 09-10-2024, 02:03 AM   #28
trence
Connoisseur
trence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enough
 
Posts: 72
Karma: 548
Join Date: Nov 2018
Device: Likebook Mars
Decided to give it a try, I started from a fresh install. Made my change to the lua that referenced event3, made the changes for Libra 2 on the on.sh. When I go to enable the Bluetooth I get a popup that says "Error: No result from the Bluetooth script"

Any idea what I did wrong?
trence is offline   Reply With Quote
Old 09-10-2024, 09:10 AM   #29
lumping-sugar66
Connoisseur
lumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trollslumping-sugar66 doesn't feed trolls
 
lumping-sugar66's Avatar
 
Posts: 95
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
Not exactly sure. Is the path correct for your koreader installation? Is there any mistake on on.sh by any chance? Can you run on.sh manually when you’re SSH’ed in?
lumping-sugar66 is offline   Reply With Quote
Old 09-10-2024, 05:29 PM   #30
trence
Connoisseur
trence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enoughtrence will become famous soon enough
 
Posts: 72
Karma: 548
Join Date: Nov 2018
Device: Likebook Mars
When I attempt to run bluetoothctl from SSH, I get this:

[root@kobo ~]# bluetoothctl
Waiting to connect to bluetoothd...

And it does not change. My on.sh looks like so:

#!/bin/bash
cd "$(dirname "$0")"

insmod /drivers/mx6sll-ntx/wifi/sdio_bt_pwr.ko
insmod ./uhid/uhid.ko
/sbin/rtk_hciattach -s 115200 ttymxc1 rtk_h5
dbus-send --system --dest=org.bluez --print-reply / org.freedesktop.DBus.ObjectManager.GetManagedObjec ts
hciconfig hci0 up

My kobo install is in the typical .adds location

Edit: Unsure of why I show a space between the c and the t in Objects, as I don't have one in the file, or when I paste it

When I run each command in on.sh via SSH:

[root@kobo ~]# insmod /drivers/mx6sll-ntx/wifi/sdio_bt_pwr.ko
[root@kobo ~]# insmod ./uhid/uhid.ko
insmod: can't insert './uhid/uhid.ko': No such file or directory
[root@kobo ~]# /sbin/hciattach -p ttymxc1 any 1500000 flow -t 20
Device setup complete
1991
[root@kobo ~]# dbus-send --system --dest=org.bluez --print-reply / org.freedes
ktop.DBus.ObjectManager.GetManagedObjects
method return sender=:1.4 -> dest=:1.3 reply_serial=2
array [
dict entry(
object path "/org/bluez"
array [
dict entry(
string "org.freedesktop.DBus.Introspectable"
array [
]
)
dict entry(
string "org.bluez.AgentManager1"
array [
]
)
dict entry(
string "org.bluez.ProfileManager1"
array [
]
)
]
)
]
[root@kobo ~]# hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

Last edited by trence; 09-10-2024 at 05:38 PM.
trence is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bluetooth page turning for Kobo eReaders tsowell Kobo Reader 214 Yesterday 09:49 PM
A Wi-Fi remote control page turner for Kobo e-readers sublipri Kobo Reader 45 10-12-2024 09:37 PM
Accessories Bluetooth page turner on Oasis? iamagloworm Amazon Kindle 4 06-03-2024 04:28 PM
Libra 2 Is there a Bluetooth page turner for Libra2? windirt Kobo Reader 22 12-12-2021 11:25 PM
Bluetooth page turner for Android tablets? DaveGa Android Devices 1 11-28-2018 05:38 PM


All times are GMT -4. The time now is 09:41 PM.


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