Git Product home page Git Product logo

Comments (3)

timschneeb avatar timschneeb commented on June 17, 2024

This is the only data I can request from the earbuds. I don't have any further control over it.
Someone else asked about a way to get raw accelerator data; however, the only available method to download the data is very slow: https://github.com/ThePBone/BudsPro-AcceleratorPolling. It probably isn't suited for your use case.

Also, I didn't bother reverse-engineering the whole code for all the calculations from Samsung's official app. They have additional logic and also handle particular Bluetooth messages with calibration data. My code doesn't do any of this; it just decodes and outputs the raw quaternion without special post-processing. I'm pretty sure that Samsung has some way to auto-adjust the data when it switches from right or left.

I recommend decompiling the official app with JADX to check how Samsung has implemented this. Some parts of the code are built into a native shared JNI library though. You can also enable a debug mode for the 360° feature in the official app by creating these (empty) files in /sdcard: debug.txt and gyrocal.txt. It might be helpful when comparing values with the script.

I'll check Samsung's implementation, but no guarantees if I can manage to reimplement it properly. I've wanted to port the 360° effect to Linux for some time, so I'll give it a shot.

from budspro-headtracking.

tcboy88 avatar tcboy88 commented on June 17, 2024

I tried with TWO buds pro, both using the RIGHT earbud and I can get both data simultaneously.
However, due to a weird bug, sometimes it will switch from using the RIGHT earbud to using the LEFT earbud automatically while I was streaming the IMU data to PC.
I think the IMU data always comes from the main/active earbud, but the main/active earbud will change automatically, depends how Samsung decides which one is the main/active one.
But I always kept the left earbud in the case, so I am not sure why it switches automatically from Right earbud to Left earbud.

from budspro-headtracking.

timschneeb avatar timschneeb commented on June 17, 2024

While you can't prevent the earbuds from changing the primary earbud (as far as I know), you could send a special Bluetooth message that can select the primary earbud: MAIN_CHANGE (message id 112); it takes a 1-byte value as an argument, either 0 for right or 1 for left. https://github.com/ThePBone/GalaxyBudsClient/blob/3ceb9ec21cced888444e1544e1c6a27656819cd8/GalaxyBudsClient/Message/MessageComposer.cs#L41

To detect if the primary earbud changed, you can listen to status update messages, which contain information about the primary earbud. Then you could send a MAIN_CHANGE message to revert to the previous earbud.
Status message decoder example:
https://github.com/ThePBone/GalaxyBudsClient/blob/3ceb9ec21cced888444e1544e1c6a27656819cd8/GalaxyBudsClient/Message/Decoder/StatusUpdateParser.cs#L17

from budspro-headtracking.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.