mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-25 08:05:56 +03:00
[GH-ISSUE #358] Hearing aid script settings don't seem to stick #173
Labels
No labels
android
bug
documentation
enhancement
good first issue
help wanted
linux
pull-request
reverse-engineering
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librepods#173
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RBastianini on GitHub (Dec 7, 2025).
Original GitHub issue: https://github.com/kavishdevar/librepods/issues/358
I've attempted to use the
linux/hearing-aid-adjustments.py(incorrectly referenced in thelinux/README.mdashearing_aid.py) to configure hearing aid on a pair of Airpods Pro 2 using Ubuntu 22.04.5 LTS.In order to make the script run I first applied the patch from PR 355, then I added the recommended deviceID configuration
DeviceID = bluetooth:004C:0000:0000to/etc/bluetooth/main.conf, downloadedPyQt5using pip and installedlibbluetooth-dev(without which, the script would fail to run).With this setup in place, the dialog pops up and I can see communication happening in the console when I interact with the controls, but I can't hear any difference in the headphones. Also, if I close and relaunch the script, everything resets to default, and the logs seem to confirm that the settings were not saved (because the response when reading the hearing aid after relaunching the script is the same as the previous execution).
As a last resort I also attempted using the windows script from PR 333, but after setting it up, the result is the same: I can't hear any difference and the settings seem to reset every time I relaunch the script.
Am I doing something wrong?
Here are the logs when running the linux script.
and the log from immediately reopening the tool
@ressiwage commented on GitHub (Dec 7, 2025):
@kavishdevar seems like this is the one thing we discussed with manual packets sending
@ressiwage commented on GitHub (Dec 7, 2025):
! it is important to notice that i don't have any idea what does this script do, it was made by kavish devar
first of all, install pybluez from source and try execute this script with your mac address and execute those commands, then send results. if my hypothesis is right after that you'll be able to set frequencies and they'll preserve but you will hear no difference
0a2a00122a000202640038831e41da2591413ddf5541fb54a1418f076c414c85e44036df8440057dda409a99593f52b81ebf0000803f7b142e3ffccb8141a786a141d41f5c41d63f02417497e6403a24c440962a914025b25a409a99593f52b81ebf0000803f7b142e3f0000003f0a2a00l2c script
```py import bluetooth import threading from prompt_toolkit import PromptSession from prompt_toolkit.patch_stdout import patch_stdoutsock = bluetooth.BluetoothSocket(bluetooth.L2CAP)
bt_addr = "X:X:X:X:X:X" # sys.argv[1]
#psm = 0x1001 # AAP Server
psm=31
print(f"Trying to connect to {bt_addr} on PSM 0x{psm:04X}...")
sock.connect((bt_addr, psm))
def listen():
while True:
try:
res = sock.recv(1024)
if not res:
break
print(f"Response: {res.hex()}")
except OSError:
break
threading.Thread(target=listen, daemon=True).start()
print("Connected. Type hex bytes (Ctrl-L to clear, 'quit' to exit)...")
session = PromptSession() # handles history + key bindings
with patch_stdout():
while True:
try:
data = session.prompt("> ").strip()
except (EOFError, KeyboardInterrupt):
break
sock.close()
print("Connection closed.")
@ressiwage commented on GitHub (Dec 7, 2025):
after doing the following use AAP = 0x1001 instead of psm=31 and run those commands slowly. it is important to figure out which one of these commands will help you (if it will)
@kavishdevar commented on GitHub (Dec 7, 2025):
yup, what @ressiwage said. I'll add all of this to #241 once I have some time.
@RBastianini could you also please share the logs from the windows script? because I do send the required packets in that script.
@RBastianini commented on GitHub (Dec 7, 2025):
Before I attempt the various steps, I'd like to make sure my understanding is correct, because you both know all the details, but I might miss some obvious step.
This is what I understood:
After installing pybluez from source, I should use the script pasted above to send
then close the script, change
psmto0x1001and sendslowly one row at a time. Should I listen for some changes in the airpods after sending each string or should I expect some specific output on the terminal to understand that it worked / which one worked?
I'll add the
windows/hearing-aid.pywindows logs in a moment. I didn't do it initially, because they didn't contain the raw output and I assumed they'd be less useful.@ressiwage commented on GitHub (Dec 7, 2025):
no, first you should execute with psm=31
and check if frequencies are preserving. after that you should set psm to 0x1001 and execute 7 instructions
terminal ouput won't let you know if it worked, so listen. you will definitely notice difference
@RBastianini commented on GitHub (Dec 7, 2025):
Thanks for clarifying the steps.
I tried capturing a log from windows, but despite several attempts, I was not able to connect the earpods to the system after switching the drivers to the WinUSB using Zadig tool. I was able to do it this morning, but for some reason it doesn't work now, and trying to launch the
windows/hearing_aid.pyscript would always fail. I now followed the steps above on linux, so I suppose a windows log would no longer help, but I could try again if you still need it.I ran the script the first time and input the first set of commands. I couldn't hear differences during this phase.
I took a few tries to reconnect the airpods at this point, but when I launched the
hearing-aid-adjustments.pyscript again, I found a bunch of settings already there (not all zeroes like they were before and not the settings I was trying to save before... I don't know where they came from). I was able to make changes and see that they were reflected in the responses from the logs.After relaunching the script, I could see the values I had set before. As @ressiwage predicted, I could not hear any difference though.
Then I switched the other script to
psm = 0x1001and began sending the second set of commands. I captured the logs, but since they are a bit more verbose and I don't understand what data they contain, I don't know if it's safe to publicly share them.I sent the first three commands one by one
At this point I heard a chime and I think the airpods switched to a different mode (like transparency perhaps?).
The remaining commands did not produce any response at all (neither in the terminal nor in the headphones) except the last one.
After the last command, I heard a different chime, and I think hearing aid mode finally turned on, because I could more clearly hear the background noise coming from the headphones. I can control the amount of noise I hear by using the "amplification" slider in the
hearing-aid-adjustments.pyscript.Do you know if connecting the airpods to an iphone would disable the hearing aid again? Should I try for science? Do you still need the logs for the second execution of the script? Should I share them here or privately? Thanks for the help!
@ressiwage commented on GitHub (Dec 7, 2025):
Congrats, glad we could help. @kavishdevar maybe include this instruction in linux readme? Seems like it is universal.
As regards values that appeared in the app, that happened because of the second command, it sets random hearing aid values.
I think that publishing logs here is safe because your airpods can not connect to network and some packets' purpose isnt even discovered yet. That may reveal mac address but actually it is not really sensitive data. Maybe apple can ping you and explode your iphone to revenge but they can do it without logs too
Pairing it to iphone is safe (95% probability), if something goes wrong you can set freqs again, now you are able to do it without tambourine dances, also enabling/disabling HA should work from the librepods linux app.
@kavishdevar commented on GitHub (Dec 8, 2025):
thank you, @ressiwage! I have reset my AirPods and tried reproducing the same problem, but it seems it works with the windows script running on Linux. I have no idea why the settings don't stick initially, and why they do after sending seemingly unrelated commands.
@RBastianini btw, the Hearing Aid is only active in transparency mode, the last command you sent was to switch to that.
Nope it won't be disabled. And, you can control the amplification too.
Also, the script in #333 is supposed to send the exact same data as manually sent. Could someone please test it out on linux? I've modified it to run on Linux too (either via bumble or bluez)
I don't think need the logs now that it is working. Thanks!