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

Logitech Gaming Headset G733 battery level is very differnt from official software #169

Open
clara2g opened this issue Aug 9, 2021 · 11 comments
Labels

Comments

@clara2g
Copy link

clara2g commented Aug 9, 2021

Logitech G Hub on Windows reports reaming battery is 18% but HeadsetControl reports 66%
Thank you in advance.

@Sapd Sapd added the battery label Nov 13, 2021
@Greifent
Copy link

Confirm that this issue is present, windows shows 15%, this shows 47, and reading go ups and down: ex: from 69 to 70 then 65, if any additional information is needed let me know!

@Greifent
Copy link

Update, the headphones start reproducing the sound of low battery when the program shows 50%, it goes then down very fast to around 10% and then i noticed the red LED blinking on the headphones, the issue of the value not being constant (going from 10 to 16% without it being in charge) still remanins

@Sapd
Copy link
Owner

Sapd commented Dec 20, 2021

reading go ups and down:

That readings go up and down is normal. The implementation simply reads the voltage, and tries to guess the battery level using this information. This is probably more worse when the battery is low.

I guess Logitech simply averages the readings to not confuse the user. Or they may go even further and calibrate the battery.

If your readings are far off, then it could be that the G733 may use a different type of battery then the other ones, then this function: static float estimate_battery_level(uint16_t voltage) would have to be adjusted.

This is how the function looks like:
https://www.wolframalpha.com/input/?i=f%28x%29%3D3.7268473047*10%5E%28-9%29x%5E%284%29-0.00005605626214573775*x%5E%283%29%2B0.3156051902814949*x%5E%282%29-788.0937250298629*x%2B736315.3077118985
(e.g. 3675 (3,68V) is 50%)

@Greifent
Copy link

Yeah, I was looking at the source code the other day and I guessed that it was based on voltage, but unfortunately my c knowledge stops there, I'll try to see if I can make my readings more precise.
If I put a print in that function, can I see the value of the voltage printed in the terminal when I run it? Sorry if it doesn't make sense but I'm not familiar with c

@Sapd
Copy link
Owner

Sapd commented Dec 21, 2021

Yes you can simply insert
printf("%u\n", voltage);

Or before calling the function

you can print the voltage and the result of the function as comparison:

printf("%u \t- %f\n", voltage, estimate_battery_level(voltage));

To calibrate it, you can simply record which voltage is which percentage. But note that this may only useful for you, as every battery (even the same model) is different, and even while the battery ages, the curve could change. The exception would be when the battery of this model uses a different kind, which has completely other voltage ranges, then we possibly need to adapt it for everyone.

@Greifent
Copy link

Thank you, I will try to do that later, I'll let you know what I find out

@hselasky
Copy link

I have installed headsetcontrol-2.6, and the battery request is timing out. But switching the LED off works!

Here is a USB trace from the control endpoint:

12:32:56.138922 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.140525 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.140567 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.141645 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.141686 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 03 03 09 04 00 02  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 512 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.144146 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=20,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 18 bytes
 0000  12 03 4C 00 6F 00 67 00  69 00 74 00 65 00 63 00  |..L.o.g.i.t.e.c.|
 0010  68 00 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |h.              |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.144200 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.145520 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.145550 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.146520 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.146557 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 04 03 09 04 00 02  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 512 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.149537 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=40,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 40 bytes
 0000  28 03 47 00 37 00 33 00  33 00 20 00 47 00 61 00  |(.G.7.3.3. .G.a.|
 0010  6D 00 69 00 6E 00 67 00  20 00 48 00 65 00 61 00  |m.i.n.g. .H.e.a.|
 0020  64 00 73 00 65 00 74 00  -- -- -- -- -- -- -- --  |d.s.e.t.        |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.156025 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.157853 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.157914 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.158944 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.158984 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 03 03 09 04 00 02  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 512 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.160648 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=20,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 18 bytes
 0000  12 03 4C 00 6F 00 67 00  69 00 74 00 65 00 63 00  |..L.o.g.i.t.e.c.|
 0010  68 00 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |h.              |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.160713 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.162646 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.162681 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.163717 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xeb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.163745 usbus0.6 SUBM-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 04 03 09 04 00 02  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 512 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.165919 usbus0.6 DONE-CTRL-EP=00000080,SPD=FULL,NFR=2,SLEN=40,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 40 bytes
 0000  28 03 47 00 37 00 33 00  33 00 20 00 47 00 61 00  |(.G.7.3.3. .G.a.|
 0010  6D 00 69 00 6E 00 67 00  20 00 48 00 65 00 61 00  |m.i.n.g. .H.e.a.|
 0020  64 00 73 00 65 00 74 00  -- -- -- -- -- -- -- --  |d.s.e.t.        |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xcb9a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|SHORT_FRAMES_OK|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.167989 usbus0.6 SUBM-CTRL-EP=00000000,SPD=FULL,NFR=2,SLEN=28,IVAL=0
 frame[0] WRITE 8 bytes
 0000  21 09 11 02 03 00 14 00  -- -- -- -- -- -- -- --  |!.......        |
 frame[1] WRITE 20 bytes
 0000  11 FF 08 0A 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 0010  00 00 00 00 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
12:32:56.168657 usbus0.6 DONE-CTRL-EP=00000000,SPD=FULL,NFR=2,SLEN=0,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] WRITE 20 bytes
 flags 0x2 <SHORT_XFER_OK|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>

@hselasky
Copy link

hselasky commented Feb 28, 2022

Found the solution (this is on FreeBSD)

sysctl hw.usb.uaudio.handle_hid=0

Looks like there is a conflict receiving HID packets on the interrupt endpoint, so the status packet gets lost.

headsetcontrol -b
Found Logitech G633/G635/G933/G935!
Battery: 91%
Success!

@github-actions
Copy link

github-actions bot commented May 2, 2023

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label May 2, 2023
@lezcano17
Copy link

Im facing this issue

@github-actions github-actions bot removed the Stale label Jun 23, 2023
@TobiasS-jpg
Copy link

TobiasS-jpg commented Mar 24, 2024

I have tinkered around in the past and, as Sapd already said, adjusting the
static float estimate_battery_level(uint16_t voltage)
function is the solution.

This code works for me:

static float estimate_battery_level(uint16_t voltage)
{
    // Charging
    if (voltage == 65535)
        return (float) (BATTERY_CHARGING);

    // Disconnected
    if (voltage <= 3000)
        return (float) (BATTERY_UNAVAILABLE);

    // Empty
    if (voltage <= 3647)
        return (float) 0.0;

    // Polynom 1
    if (voltage <= 3726)
        return (float) (0.0000671638202 * pow(voltage, 3) - 0.746307678145 * pow(voltage, 2) + 2764.3173240131123 * voltage - 3413055.137837838);

    // Polynom 2
    if (voltage <= 3885)
        return (float) (-0.0000112590873 * pow(voltage, 3) + 0.1272931815966 * pow(voltage, 2) - 479.336522317864 * voltage + 601218.8751422882);

    // Polynom 3
    if (voltage <= 3984)
        return (float) (-0.000002711158 * pow(voltage, 3) + 0.032582506827 * pow(voltage, 2) - 130.3351489423122 * voltage + 173611.6066702439);

    // Polynom 4
    if (voltage <= 4120)
        return (float) (0.000010859959 * pow(voltage, 3) - 0.131425350889 * pow(voltage, 2) + 530.2926489312302 * voltage - 713325.3412124208);

    return (float) 100.0;
}

I came up with these values by simply periodically checking the voltage with HeadsetControl and then rebooting into Windows to check the according percentage in G HUB.
Afterwards I approximated a mathematical function from these values.

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

No branches or pull requests

6 participants