Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental Echelon support. #76

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add experimental Echelon support. #76

wants to merge 4 commits into from

Conversation

ptx2
Copy link
Owner

@ptx2 ptx2 commented Mar 22, 2021

No description provided.

@ptx2
Copy link
Owner Author

ptx2 commented Mar 22, 2021

To try this out:

sudo apt-get install git
cd
git clone https://github.com/ptx2/gymnasticon.git
cd gymnasticon
sudo service gymnasticon stop
sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))
git fetch origin pull/76/head:echelon-experimental
git checkout echelon-experimental
npm install
npm run build
npm link
gymnasticon --bike echelon

@ptx2 ptx2 mentioned this pull request Mar 22, 2021
@ghost
Copy link

ghost commented Mar 22, 2021

This is similar to what I had so far, although the parsing didn't work for me.

I just tested your branch, strangely enough it connects at first and then disconnects a few seconds later.

pi@gymnasticon:~/gymnasticon $ gymnasticon --bike echelon [2021-03-22T22:39:58.153Z] connecting to bike... [2021-03-22T22:40:28.490Z] bike disconnected e4:6e:d2:ee:d0:1a

I'm attaching the full debug log.
gymnasticon.log

@ptx2
Copy link
Owner Author

ptx2 commented Mar 23, 2021

Thanks for testing this @EfficientSetting!

I just made a small change if you have time to try it out.

I think this should now be the same as what @doudar has working in SmartSpin2k.

I also had a quick look over the qdomyos-zwift Echelon support and a btsnoop log provided by a user. It seems to be doing the same but more. e.g. it sends some kind of regular poll message, and also subscribes to another characteristic. Perhaps necessary for some Echelon bikes/firmwares and not others? Can you share which model bike and firmware version you're testing with?

@ghost
Copy link

ghost commented Mar 24, 2021

Hi!

Just tried it again, the disconnect is now "instant" after the connect beep.

I have a Echelon Connect Sport (Walmart), HW 7.00 FW 41.01.04

qdomyos-zwift is working on this bike with no issues, I haven't tried SmartSpin2k.

Let me know if you'd like to get the debug log again!

@ptx2
Copy link
Owner Author

ptx2 commented Mar 25, 2021

Hey, thanks for trying again!

Does it fail the same way each time?

A log would be great. A low-level log e.g. btmon -w echelon.log on Linux or PacketLogger app on macOS would be ideal but the DEBUG=* console output is also helpful, whatever you're able to grab.

@doudar
Copy link

doudar commented Mar 25, 2021

Hey, thanks for trying again!

Does it fail the same way each time?

A log would be great. A low-level log e.g. btmon -w echelon.log on Linux or PacketLogger app on macOS would be ideal but the DEBUG=* console output is also helpful, whatever you're able to grab.

This was a good source for me:
https://github.com/snowzach/echbt

@ptx2
Copy link
Owner Author

ptx2 commented Mar 25, 2021

Thanks @doudar! I A/B'd that one (and yours) with what I have here and can't seem to see a relevant difference. What I have here works against a mock Echelon device I threw together.

I'm wondering if noble/BlueZ is doing something different to NimBLE under-the-hood that the bike doesn't like. It wouldn't be the first time. Or perhaps I'm just overlooking something obvious :-)

@doudar
Copy link

doudar commented Mar 25, 2021

Yah, I've noticed you guys need to do some stuff in noble that we don't in NimBLE and vice versa.

My guess is that it connects, gets a request to update connection parameters (timing) to something it doesn't like (or it updates to something noble doesn't like) and so disconnects.

Does noble have a method for getConnParameters() so maybe you could see what the device is requesting?

@cagnulein
Copy link

if you want (i'm the developer of qdomyos) i can help in the troubleshooting

@ptx2
Copy link
Owner Author

ptx2 commented Mar 29, 2021

@cagnulein @doudar Thank you both for the support!

I was thinking along similar lines @doudar. It actually looks like an issue we ran into on the IC4 bike, specific to noble's Linux (HCI) bindings. Noble sends a Read By Type request to find the CCCD handle so it can later write to it to enable notifications. The IC4 bike didn't respond to the Read By Type request. From the noble debug log attached above, the Echelon bike is not responding to that request either (and is also disconnecting).

@cagnulein I noticed you do some extra stuff in qdomyos-zwift like sendPoll() and also some extra initData which https://github.com/snowzach/echbt doesn't seem to do. Are there are different features or versions of the bike/firmware that require the polling?

@EfficientSetting I pushed up two alternate versions if you want to try:

# Note these only work on Linux (which it looks like you're using from that noble log)
# Also, if these do work then there's a good chance the original implementation `echelon` works on macOS

gymnasticon --bike echelon2   # uses Find Info instead of Read By Type (will only work on Linux)
gymnasticon --bike echelon3   # same as above, but also sends extra initialization packets

@cagnulein
Copy link

cagnulein commented Mar 29, 2021 via email

@ghost
Copy link

ghost commented Apr 5, 2021

@cagnulein @doudar Thank you both for the support!

I was thinking along similar lines @doudar. It actually looks like an issue we ran into on the IC4 bike, specific to noble's Linux (HCI) bindings. Noble sends a Read By Type request to find the CCCD handle so it can later write to it to enable notifications. The IC4 bike didn't respond to the Read By Type request. From the noble debug log attached above, the Echelon bike is not responding to that request either (and is also disconnecting).

@cagnulein I noticed you do some extra stuff in qdomyos-zwift like sendPoll() and also some extra initData which https://github.com/snowzach/echbt doesn't seem to do. Are there are different features or versions of the bike/firmware that require the polling?

@EfficientSetting I pushed up two alternate versions if you want to try:

# Note these only work on Linux (which it looks like you're using from that noble log)
# Also, if these do work then there's a good chance the original implementation `echelon` works on macOS

gymnasticon --bike echelon2   # uses Find Info instead of Read By Type (will only work on Linux)
gymnasticon --bike echelon3   # same as above, but also sends extra initialization packets

Will test tonight! Thanks

@ghost
Copy link

ghost commented Apr 8, 2021

@cagnulein @doudar Thank you both for the support!

I was thinking along similar lines @doudar. It actually looks like an issue we ran into on the IC4 bike, specific to noble's Linux (HCI) bindings. Noble sends a Read By Type request to find the CCCD handle so it can later write to it to enable notifications. The IC4 bike didn't respond to the Read By Type request. From the noble debug log attached above, the Echelon bike is not responding to that request either (and is also disconnecting).

@cagnulein I noticed you do some extra stuff in qdomyos-zwift like sendPoll() and also some extra initData which https://github.com/snowzach/echbt doesn't seem to do. Are there are different features or versions of the bike/firmware that require the polling?

@EfficientSetting I pushed up two alternate versions if you want to try:

# Note these only work on Linux (which it looks like you're using from that noble log)
# Also, if these do work then there's a good chance the original implementation `echelon` works on macOS

gymnasticon --bike echelon2   # uses Find Info instead of Read By Type (will only work on Linux)
gymnasticon --bike echelon3   # same as above, but also sends extra initialization packets

Both immediately disconnect unfortunately. Here's the output:

pi@gymnasticon:~/gymnasticon $ gymnasticon --bike echelon2
[2021-04-08T21:55:04.409Z] connecting to bike...
[2021-04-08T21:55:05.988Z] TypeError: Cannot read property 'writeValueAsync' of undefined
    at EchelonBikeClient2.connect (/home/pi/gymnasticon/lib/bikes/echelon2.js:96:16)
    at async App.run (/home/pi/gymnasticon/lib/app/app.js:145:7)
    at async /home/pi/gymnasticon/lib/app/cli.js:27:3
pi@gymnasticon:~/gymnasticon $ gymnasticon --bike echelon3
[2021-04-08T21:55:15.154Z] connecting to bike...
[2021-04-08T21:55:15.647Z] bike disconnected e4:6e:d2:ee:d0:1a
pi@gymnasticon:~/gymnasticon $ gymnasticon --bike echelon3
[2021-04-08T21:55:23.019Z] connecting to bike...
[2021-04-08T21:55:23.498Z] bike disconnected e4:6e:d2:ee:d0:1a

Let me know what kind of logging information you need, and I'm happy to provide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants