pali / hsphfpd-prototype

Prototype of Bluetooth HSP/HFP daemon
135 stars 16 forks source link

Change CSR and Apple battery level formulas #3

Closed LHLaurini closed 4 years ago

LHLaurini commented 4 years ago

When connected to my computer, with hsphfpd installed, the reported battery level for my bluetooth headset is 77%. When I connect it to my phone (Moto G5 Plus with Pixel Experience) it reports as 80%.

Since reporting 0% battery level wouldn't be very useful, I think the correct formula would be (x+1)*10 instead, for both CSR and Apple. Even if that weren't the case, round numbers look much nicer anyway.

pali commented 4 years ago

Hello @LHLaurini! Are you able to check that headset with some other phone/laptop device what it would report?

pali commented 4 years ago

Also please note that battery level formula for CSR and Apple is also in functions hsphfpd_our_battery_level (command AT+IPHONEACCEV=1,1,) and hsphfpd_csr_send_battery_level (command AT+CSRBATT=). This needs to be updated too.

LHLaurini commented 4 years ago

Hello @LHLaurini! Are you able to check that headset with some other phone/laptop device what it would report?

I've tried another Android phone, but it seems to not be recent enough to show that data (might try another one if I can). However, Windows does agree with my phone (shows as 60% now, battery drained a little in 3 days).

Also please note that battery level formula for CSR and Apple is also in functions hsphfpd_our_battery_level (command AT+IPHONEACCEV=1,1,) and hsphfpd_csr_send_battery_level (command AT+CSRBATT=). This needs to be updated too.

Fixed. I haven't tested these, since I'm not sure what they're for (sending battery info about the computer to the device maybe?).

pali commented 4 years ago

I'm not sure what they're for (sending battery info about the computer to the device maybe?).

It is used when computer is in HF/HS mode and remote device in AG mode. Computer acts as headset for another computer.

LHLaurini commented 4 years ago

Hello @LHLaurini! Are you able to check that headset with some other phone/laptop device what it would report?

Just checked with another phone (Moto G6 Play with stock rom). Same thing. Both phones I tested make relatively light modifications to Android, so that's to be expected.

Would be great if others could test with a Samsung (since they heavily customize Android, they may have their own thing for battery) or an iPhone.

pali commented 4 years ago

Thanks, I merged it. I think this is a nice improvement.