View Single Post
Old 08-09-2024, 12:54 AM   #1
lumping-sugar66
Groupie
lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.
 
lumping-sugar66's Avatar
 
Posts: 152
Karma: 87635
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E, Kobo Libra 2
Lightbulb Bluetooth Plugin for Kobo KOReader

Bluetooth Plugin for KOReader - v1.0.1

Use a Bluetooth controller (like 8BitDo Micro) to turn pages and control other reader settings of KOReader on your Kobo.


What's New in v1.0.1
• Guided Simple Setup - configure buttons without editing files
• Dynamic device detection - works on more Kobo models
• Built-in diagnostics and troubleshooting


What's New in v1.0.0

Complete overhaul focused on eliminating manual configuration:
  • No more editing device.lua
  • No more editing shell scripts
  • No more hardcoded MAC addresses
  • No more figuring out event3 vs event4
  • Everything is auto-detected or configurable via UI

Supported Devices

Fully Tested:
  • Kobo Clara 2E
  • Kobo Libra 2

May Work (auto-detection):
  • Other Kobo devices with similar hardware

Not Yet Supported:
  • Clara BW, Clara Colour, Libra Colour (MediaTek Bluetooth hardware - different drivers needed)

Installation







Step 1: Copy the Plugin
  1. Download from GitHub
  2. Rename folder to
    Code:
    bluetooth.koplugin
  3. Copy to
    Code:
    koreader/plugins/
    on your Kobo
  4. Restart KOReader

Step 2: Run Diagnostics & Auto-Fix

Go to Menu > Network > Bluetooth > Diagnostics

Click any item marked with X and choose "Correct Automatically":
  • hasKeys flag - Required for button input
  • Event map - Default button mappings for 8BitDo

Step 3: Turn On Bluetooth & Pair Your Controller
  1. Go to Bluetooth > Bluetooth On
  2. Put your controller in pairing mode
  3. Go to Bluetooth > Device Management
  4. Click "Start scanning (30s)"
  5. Click "Select from scanned devices" and choose your controller
  6. Done - your controller is saved

Step 4: Connect

Whenever you want to use your controller:
  1. Bluetooth > Bluetooth On
  2. Device Management > Connect to saved device

That's it.

Features

Auto-Configuration
Everything is automatic:
  • Installation path detection
  • Device-specific Bluetooth commands (Clara 2E vs Libra 2)
  • Input device path (event3/event4)
  • Button mappings
  • hasKeys override

Device Management
Scan, select, and save Bluetooth devices directly from the UI. No more editing scripts.

Event Map Editor
Bluetooth > Event Map Editor
  • View all current mappings (key code to event)
  • Add new button mappings
  • Change or delete existing mappings
  • Changes take effect immediately

Diagnostics
Bluetooth > Diagnostics
  • Live Bluetooth status (ON/OFF)
  • Pass/fail indicators for each configuration item
  • Click for details and auto-fix options
  • Debug tools: button press history, raw input monitor

Bank System
Map the same physical buttons to different actions by switching banks. Perfect for controllers with limited buttons.

Edit
Code:
bank_config.txt
to customize:
Code:
Bank1
BTAction1:BTLeft, A button
BTAction2:BTRight, B button
BTAction3:BTToggleBookmark, Y button

Bank2
BTAction1:BTIncreaseBrightness, A button
BTAction2:BTDecreaseBrightness, B button
BTAction3:BTToggleNightMode, Y button
Switch banks using BTRemoteNextBank / BTRemotePrevBank.

Customizing Button Mappings

The plugin comes pre-configured for 8BitDo Micro in keyboard mode. For other controllers:

Option A: Event Map Editor (recommended)
  1. Go to Diagnostics > Monitor raw input (5 sec)
  2. Press buttons on your controller
  3. Note the key codes shown
  4. Go to Event Map Editor > Add new mapping
  5. Enter the code and select an event

Option B: Edit bank_config.txt
For power users who want bank switching and full control.

Available Events

Page Navigation
  • BTLeft / BTRight - Previous/next page (orientation-aware)
  • BTGotoPrevChapter / BTGotoNextChapter

Bookmarks
  • BTToggleBookmark, BTPrevBookmark, BTNextBookmark, BTLastBookmark

Display
  • BTIncreaseBrightness / BTDecreaseBrightness
  • BTIncreaseWarmth / BTDecreaseWarmth
  • BTToggleNightMode, BTToggleStatusBar, BTIterateRotation, BTRefreshScreen

Font
  • BTIncreaseFontSize / BTDecreaseFontSize
  • BTIncreaseFontWeight / BTDecreaseFontWeight
  • BTIncreaseLineSpacing / BTDecreaseLineSpacing

System
  • BTBluetoothOff, BTBluetoothOffAndSleep, BTSleep

Bank Actions
  • BTAction1 through BTAction20 - Configurable via bank_config.txt
  • BTRemoteNextBank / BTRemotePrevBank - Switch banks

Troubleshooting

Buttons not working?
  1. Check Diagnostics - all items should show pass
  2. Use raw input monitor to see if button presses are detected
  3. Add missing key codes via Event Map Editor

Controller not connecting?
  1. Make sure Bluetooth is ON
  2. Use Device Management to scan and select your device

Battery Note

Properly shutting down Bluetooth is crucial. On a Clara 2E, improper shutdown causes ~3% battery drain per hour during sleep. This plugin ensures Bluetooth is turned off correctly - 0% drain when sleeping.

Credits
  • Tested on Clara 2E and Libra 2
  • Libra 2 support thanks to MobileRead user enji
  • 8BitDo Micro controller recommended

Download

https://github.com/onatbas/bluetooth.koplugin

Feedback and contributions welcome.
Attached Thumbnails
Click image for larger version

Name:	1292b34e1b984530bc291cf799801912.jpg
Views:	719
Size:	488.1 KB
ID:	210133   Click image for larger version

Name:	c3c4322516164f9e90b6c59ac111868c.jpg
Views:	598
Size:	424.5 KB
ID:	210134  

Last edited by lumping-sugar66; 12-28-2025 at 03:09 PM.
lumping-sugar66 is offline   Reply With Quote