logoalt Hacker News

Reverse engineering my e-scooter and rewriting the firmware in Rust

400 pointsby vinhnxlast Thursday at 3:32 AM93 commentsview on HN

Comments

aboundyesterday at 3:08 PM

This is an unbelievably impressive project and a killer write up, very satisfying. I wonder if the author looked into using Slint [1] for the UI, given the codegen bloat issues they had with buoyant (which also looks very cool). I haven't used either, but I've done a few projects with Embassy and am always looking for an excuse to try embedded GUI tools

[1] https://slint.rs/

show 1 reply
trevithickyesterday at 5:21 PM

Reverse engineering like this is black magic to me. The writeup is good. It's detailed and I could follow along with what the author was doing even though I'm too stupid to ever attempt something like this. Nice job author.

I liked bullet 2 in the Introduction.

show 2 replies
zoobabyesterday at 3:34 PM

We need to free up Bosch systems. They use lots of open source libs, but they close the whole chain (like spare batteries) so that you cannot plug external batteries from other suppliers.

show 4 replies
asimovDevyesterday at 1:39 PM

Thank you for posting! I got a e-scooter this spring and wrote my own app for it after reverse engineering the official app + BLE logs. I am not brave enough to do anything with the firmware on it though. Maybe not yet at least

quietrasteryesterday at 3:22 PM

rewriting scooter firmware in rust is the kind of unnecessary excellence i come here for. how did you debug without bricking it, swd probe or pure faith

show 1 reply
yonatan8070yesterday at 4:37 PM

> To my surprise, two of the USB-C pins were being used as a CAN bus (which smells horribly noncompliant).

Oh god that's awful. Why would anyone in their right mind do this?

show 2 replies
arbirkyesterday at 2:41 PM

I am also rusting my hw. Last week my mouse, this week my EUC (wish me luck). I would rather risk a crash than memory corruption

show 1 reply
plasticeagleyesterday at 8:55 PM

Very nice article, but I have a question about the rust bloat issues you encounter. Why do the size of the type names grow the size of the binary? Does rust look them up at runtime, and if not, why can they not be stripped like you would in C++?

I like how they used the USB C connector for whatever the hell they felt like. USB C is cheap and reliable, so it makes alot of sense.

show 2 replies
jimmy76615yesterday at 1:19 PM

I wanna have a friend like this guy

ifh-hnyesterday at 12:18 PM

Wish I was brainy enough to do this sort of thing!

show 1 reply
1saadcodesyesterday at 10:24 PM

This is genuinely very cool. Amazing work and article

hommelixyesterday at 2:10 PM

> The updater device then sends 64 byte chunks spread over 9 CAN 0x384 frames

Classic CAN uses 8 bytes long frame, so 64 bits. Is it a typo in the post, vor is it using CAN-FD?

show 3 replies
antonvstoday at 2:57 AM

This is taking the "rewrite it in Rust" meme a little too far. I love it!

kooilast Thursday at 4:33 AM

Very nice. Be safe out there when tweaking these things.

show 1 reply
cantalopesyesterday at 10:55 PM

Rewriting things in rust is like running doom on things

rfgplkyesterday at 3:59 PM

My general piece of advice to anyone looking to do this is not to even bother. Just strip the hardware package and replace it with an arduino/bb or an equivalent sbc figure out what the motors are and wire it up yourself. Way faster and less tedious

show 1 reply
Founderarcstoneyesterday at 4:32 PM

what a great project nice work!

BrandoElFollitoyesterday at 4:10 PM

First of all, this is impressive.

I do not know how what the legal context is in your country, but you may need to have a device that uses public roads licensed to do so. In case of any legal issues (accidents, mostly) not only you would not be covered by your insurance, but your situation may worsen for having operated it. Something to keep in mind.

show 2 replies
ivo_repairsyesterday at 3:21 PM

[flagged]

barbarkaragulyesterday at 2:29 PM

[dead]