google / google/bumble

Feature request: allow bumble-rtk-util to work with serial transport

Open
#753 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
555
Forks
138
Avg merge
3d 15h
Merged PRs (30d)
9

Description

I have a Realtek [dev board](https://www.alibaba.com/product-detail/realtek-RTL8761BTV-dongle-Blue-tooth-development_1600150205224.html) which exposes the chip via serial rather than USB. I confirmed on Windows that `bumble-rtk-util info usb:2550:8761` and `bumble-rtk-util load usb:2550:8761` work on a different normal USB dongle, to confirm it's not having the same issue as #746. And then I want to issue `bumble-rtk-util info serial:COM6,115200` and `bumble-rtk-util load serial:COM6,115200` on the dev board, to take advantage of the fact that Bumble supports HCI over serial (so I don't have to implement firmware download myself).

However, when I do `bumble-rtk-util info serial:COM6,115200` I get an error ["USB device not supported by this RTK driver"](https://github.com/google/bumble/blob/main/tools/rtk_util.py#L109) (caused by the `check()` function failing because there is of course no USB metadata when I'm giving a serial transport.)

Interestingly, if I add `--force` it gets around this and works for `info` and `load`, despite the fact that the code is written in such a way as to [assume USB transport](https://github.com/google/bumble/blob/main/tools/rtk_util.py#L99).

However ultimately the `--force` with `load` (which is what I really care about) is unsuccessful. It seems to me based on serial logging like it's padding out the end of the last 0xFC20 VSC download command and including a lot of extra 0 bytes despite the fact that the default `rtl8761bu_config.bin` file has a size set to 0. Then the chip just doesn't reply, either with success or failure, and gets stuck in a failed mode and refuses to respond to anything else. So perhaps that issue would be fixed by giving the code the once-over necessary to support HCI over serial.

Edit: re `load` over serial not working, the issue is perhaps due to using a fixed size [`RTK_FRAGMENT_LENGTH`](https://github.com/google/bumble/blob/main/bumble/drivers/rtk.py#L62), which I suspect it doesn't like over serial. I couldn't immediately figure out how to fix your OO code, but somehow you need to not be using the fixed-size length [here](https://github.com/google/bumble/blob/870217acb3dd5ca2ae964b0282460ce6197bc99b/bumble/drivers/rtk.py#L194), or else the last packet is almost guaranteed to be padded out to a size other than the size mentioned in the data format itself, which it either doesn't like, or doesn't handle gracefully.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.