MTK on Kobo FW 6.0: bd71827_bat renamed to battery, so cable sensing never sees a plug-in

Open Beginner friendly
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, linux

Research direction

Start in the MTK branch where MTK_BATT_STATUS_SYSFS, MTK_CHARGER_TYPE_SYSFS, and MTK_BATT_CAP_SYSFS are used for cable and battery detection. Check how those paths are defined and how missing nodes are handled, then compare with the existing /sys/class/power_supply/battery/{status,capacity,charger_type} nodes described here. Done when USBMS detects the cable on FW 6.0 and the existing MTK behavior still works.

Written by the indexing model from the issue text.

Description

Device: Kobo Clara Colour (spaKoboColour, N367), FW 6.0.279225, KOReader kobov5 v2026.07.1 (bundled usbms).

On 6.0 the bd71827 power supply is exposed as battery instead of bd71827_bat; the driver is the same:

/sys/class/power_supply/ac      -> .../1-004b/bd71827-power.4.auto/power_supply/ac
/sys/class/power_supply/battery -> .../1-004b/bd71827-power.4.auto/power_supply/battery
/sys/class/power_supply/battery/charger_type: NONE   (unplugged)

On MTK, usbms reads MTK_BATT_STATUS_SYSFS (/sys/class/power_supply/bd71827_bat/status) for cable sensing. The file doesn't exist, so sysfs_is_usb_plugged() always returns false: usbms stays on "Waiting to be plugged in…" even with the cable in, and KOReader then logs "KoboUSBMS failed to setup an USBMS session". MTK_CHARGER_TYPE_SYSFS and MTK_BATT_CAP_SYSFS point to the same missing node.

PLATFORM is correct (mt8113t-ntx) and the gadget is named kobo, so neither the platform check nor the custom-gadget check is involved.

Confirmed locally: wrapping usbms so that, for the session only, a directory with the existing nodes plus bd71827_bat -> battery is bind-mounted over /sys/class/power_supply makes USBMS work normally (the drive shows up on the PC).

Suggested fix: in the is_mtk branch, fall back to /sys/class/power_supply/battery/{status,capacity,charger_type} when bd71827_bat is missing. KOReader has the same fallback for its own battery reading in koreader/koreader#16423.

Dominant language
C
Stars
25
Forks
7
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from koreader/KoboUSBMS

All issues in koreader/KoboUSBMS

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.