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

Android Q L2CAP is back :) Time to resurrect fitscales? #8

Open
OuterObsessionSoftware opened this issue Feb 2, 2020 · 8 comments
Open

Comments

@OuterObsessionSoftware
Copy link

@paulburton Have you been following the L2CAP development? It's been finally added back to the new BT stack in Android 10.

I've been trying to communicate with the Wii Balance Board for a couple of days now, but I keep getting timeout errors. My guess is they (Android devs) got lazy when working on the BT stack and there's some weirdness in it that stops it from connecting properly.

I'm not sure how active paul is these days but if anyone sees this and is able to figure out how to get the connection to work properly I'd be more than happy to help update fitscales to bring it back to its former glory.

I've also opened a stackoverflow question that dives into some more detail for those interested.

Let's resurrect this project!
Cheers,
Jameson

@paulburton
Copy link
Owner

Hi Jameson,

That's interesting info - I hadn't spotted that L2CAP support had been (re)introduced :) Unfortunately I no longer have access to a Wii balance board to try it out with, and the fact that I now own some smart scales takes away much of the motivation I had for originally writing FitScales.

I wish you good luck in getting it working though!

Thanks,
Paul

@OuterObsessionSoftware
Copy link
Author

Hi Paul thanks for the response.

For anyone interested the reason I'm trying to resurrect such an old piece of novel consumer hardware is because the Wii Balance Board is actually way more accurate then people think and can be used for research / in medical clinics.

TL:DR Because of jank in the bluetooth stack I'm going to have to give up on this for now

We had an old app developed on iOS that allowed us to use the Balance Board for posturography/Vestibular stuff and outperformed $$$ medical-grade force plates. We've played around with different bluetooth fitness boards before but not every board actually indicates balance and it's hard to match the accuracy of the Wii Balance Board.

With the return of L2Cap I've been trying to port our program to Android as the iPhones require being jailbroken to work with a custom bluetooth stack and finding the right iPhone gets messy.

So far everytime I use .connect I just get timeout errors. I use PSM 0x11 for the control pipe and PSM 0x13 for the data pipe. It's funny because the only thing I can actually get to work is .createBond to pair to the device and the whole Wii Balance Board acts as a joystick which of course is of no use. I did update the core of your code and surprisingly it's aged really well. I did notice you commented out the pairing portion, I'm guessing this is because back then people didn't know the procedure to pair via the red sync button.

It's kind of hard for me to get anywhere when there's basically one command of importance .connect and using it get me nowhere. From all of my experience with bluetooth stacks there's probably just something broken or incompatible with the bluetooth stack that is out of my control. The only other weird thing that I've seen in the past is using reflection to access hidden methods to fix weird bluetooth quirks but that's like shooting in the dark.

So with all that said as disappointing as this is I just have to shelf this project until something changes with the bluetooth stack. If anyone has any additional details / leads feel free to contact me.

Thanks,
Jameson

@Nesh108
Copy link

Nesh108 commented Jan 14, 2021

It would be amazing if we could do something with FitScales to get it back to the present. It's such as shame that the project kind of died because of that (now reintroduced) change.

@mexiscool
Copy link

Not gonna be possible (unless you recompile android or something with some changes) because (see comment on answer) https://stackoverflow.com/questions/59996168/android-10-l2cap-connection-ioexception-timeout-wii-balance-board, i tried for a while to get a wii mote to connect but ran into the same issue

@Nesh108
Copy link

Nesh108 commented Jan 14, 2021

My biggest problem was to try to pair the balance to Android but the device has no pairing code, while Android requires one.

@emcniece
Copy link

emcniece commented Jan 23, 2021

The pairing code for the balance board is its MAC address, as hex bytes, reversed. Because this pin is fixed and the MAC address is discoverable, some apps prompt while others automate its entry. The pin is not easily entered with keyboards as the MAC address bytes often do not fall within ASCII ranges.

For example:

  • MAC address: 8C:56:C5:C3:63:5F
  • MAC as bytes: {0x8C, 0x56, 0xC5, 0xC3, 0x63, 0x5F}
  • Bytes reversed: {0x5F, 0x63, 0xC3, 0xC5, 0x56, 0x8C}
  • ASCII conversion (actual pin code): _c��V�

Good luck typing that on a keyboard 😆

Docs: http://wiibrew.org/wiki/Wiimote#Bluetooth_Pairing

@chauhoang99
Copy link

Hi everyone, freshman here, glad to know that L2CAP is back on Android. I'm not an app developer, backend - data developer actually. But currently I have 2 Wii consoles and 2 balance boards at home, will definitely try it out :)

@tyalie
Copy link

tyalie commented Jan 11, 2022

The new Android L2CAP is so far as I know Bluetooth Low Energy (L2CAP CoC) only. I think that might be the problem here.

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

No branches or pull requests

7 participants