NiyaShy / XB1ControllerBatteryIndicator

A tray application that shows a battery indicator for an Xbox-ish controller and gives a notification when the battery level drops to (almost) empty.
GNU General Public License v2.0
715 stars 51 forks source link

Controller won't turn on after charging via USB cable to PC #95

Closed Elinor10 closed 1 month ago

Elinor10 commented 1 month ago
NiyaShy commented 1 month ago

Hey, can't say with 100% certainty, but this rather sounds like a pairing issue to me. When you connect the controller to your PC for charging, it is registered as a "wired" controller, and that could confuse the part of windows that remembers how controllers are paired. Could you try if this also happens when you use a USB power brick for charging the controller? And when the issue occurs, have you tried holding the sync button on the controller to turn it into pairing mode? Does re-pairing it with your dongle work?

Oh, and I really doubt that xb1cbi has any influence on it since it only asks windows about the controllers state, nothing else.

Elinor10 commented 1 month ago

Hi, It is not a pairing issue. When there's a pairing problem the controller stays on and the led light blinks (trying to connect). In this case the controller immediately turned off.

Windows is not confused. It identifies the same controller as wired (after it switches from wireless to wired), the "Xbox Accessories" app also identifies well. It's only this program that identifies it as a different controller (a second one).

I've tried that (connecting to an external source for charging). The problem happens only when I connect to the pc (for charging or for playing with a wired controller). Any external charging is fine and doesn't cause any problem.

I've tried the sync button, tried removing and reconnecting the dongle. Nothing worked. The controller shut down too quickly.

I also thought the same (that it's not connected to this program). After everything else failed I removed the program and everything works perfectly since. I didn't change anything other than that. I guess it caused some conflict. I have no other explanation for this.

I understand if you'll choose not to fix this bug but I thought you'd like the feedback (even though I chose to remove the program and stop using it).

NiyaShy commented 1 month ago

Just tried it myself (Win10, 1914 controller on firmware 5.17.something, official battery pack). Turned it on, it connected wirelessly. Plugged in a USB-C cable, the status LED on the controller flashed a few times and windows reported that it's setting up a new controller (cause I never use mine wired). xb1cbi "found" a second controller and reported that it has a full battery (cause the level isn't reported while charging). Unplugged the cable, controller flashes a few times, turns solid and then shuts off after a few seconds. Turning it back on via a short press most likely showed the same symptoms you had, it blinks a few times and then turns off again. What "revived" mine was holding the button for maybe 3-4 seconds, It turned on and connected again, staying on and getting recognized normally. Tried a few more times, the controller turns off when I unplug the USB cable, but turning it back on worked without any issues and it connected right away.

Just in case I updated the firmware to 5.21. Tried again, it turns off when I unplug the cable but turns back on (and connects) as always afterwards.

All of this while xb1cbi ran in the background. So it shouldn't have anything to do with it. Sounds more like some kind of "glitch" in the controller firmware.

Elinor10 commented 1 month ago

My controller shut down immediately. No steady light, no blinking. I barely saw the light for a fraction of a second and it was already off (and could not be "revived").

I tried to hold the button for longer. Didn't help. I even tried a different Xbox controller that I have and got the same result.

I am not a stranger to computers and hardware. This is my field of study and work. I'm also a gamer for many years. Before writing here I tried a lot of different solutions, simple and more complicated/advanced.

I'm sorry that you were unable to reproduce the issue on your specific system (with a different operating system and hardware).

It cannot be a glitch in the controller firmware (the same issue also happened with a different controller, different firmware. both are working well at the moment, after removing xb1cbi).

NiyaShy commented 1 month ago

It's still weird. Like I said, xb1cbi only reads information about the controller and can't send any commands, so I can't understand how it should be able to influence your controller into shutting down... One last thing: are you using the "main" release 1.3 or the preview release I've uploaded to the discussion thread?

Elinor10 commented 1 month ago

I agree that it's weird. It also started happening relatively recently (not from the beginning) so maybe a recent Windows or driver update broke something. Maybe if others will experience the same bug and write feedback it will shed some light on what's causing it.

I used the main release (version 1.3.1.2).

NiyaShy commented 1 month ago

Maybe it's worth it then that you try it with the 1.4 "beta". That's the version I'm using all the time, so it's the main difference (aside from Win10 vs. Win11 and hardware) between our systems.

Elinor10 commented 1 month ago

I tried to download the file (1.4 beta) but Windows Security blocked and deleted it because it says it contains a trojan (I'm adding a screenshot). Screenshot 2024-07-17 204311

NiyaShy commented 1 month ago

And so it happened again... Hasn't been the first time WinDefender or some other AV program produced a false positive on it. Though I've just run it through a virustotal scan, and only 2 engines that I've never heard of reported a hit. https://www.virustotal.com/gui/file/168e830931de1d42943a8ee24c9f23759db755c61be353fec4e29e218df04af0 So maybe you just had a "bad" WinDefender pattern on your system that already got updated.

Elinor10 commented 1 month ago

I tried again to download and got the same result: image (I update Windows and Windows Defender regularly and don't use any pirated software).

Thank you anyway (for trying to help and for this great app).

NiyaShy commented 1 month ago

That's really weird... I've been running that version for weeks now and never got a warning from WinDefender. And just in case I just downloaded the ZIP file myself and ran a custom scan with WinDefender over it, but no complaints. Could you check what pattern version you are running on? It's displayed on the update page of WinDefender. I currently have pattern 1.415.150.0 that was apparently created yesterday.

Elinor10 commented 1 month ago

image

image

I ran an update just in case, using a newer definitions update version and still. Maybe Win11 uses a different Windows Defender app.

NiyaShy commented 1 month ago

This is really getting weirder. AFAIK the defender patterns are independent from your windows version (win10, 11 and all still supported server editions all share the same pattern files), so it has to be something else. The part that's confusing me is that the found "trojan" seems to have something to do with HTML/scripting, but the only part of xb1cbi that remotely has anything to do with the internet is the update checker that does nothing more than loading a tiny XML file with info about the current release.

Could you try with a different browser, or, as stupid as it might sound, downloading the ZIP with your phone and transferring it via USB? I just want to rule out that something on your PC (or in your browser profile) messes with the archive during download.

neilser commented 1 month ago

I just got the same result - for the ZIP file (didn't unpack and test the EXE). My AV definitions are slightly newer - see pic. Virustotal says 1/68 flagged the ZIP file: https://www.virustotal.com/gui/file/5f2487368b800b2ebc23c70204a94a947f395b5ba8132962946e6ffce782f16b?nocache=1

image

Elinor10 commented 1 month ago

I tried with a different browser (Edge instead of Chrome), still the same result (virus detected): image

I prefer not to download this file to my phone (as I'm not sure it's actually clean) but I have a laptop running Windows 10 so I updated it and tried to download the file. It found a virus there too: Capture Capture2

Maybe you've added the file to your exclusions list?

NiyaShy commented 1 month ago

I've submitted the archive as a false positive to Microsoft. Final verdict is still pending, will keep you updated.

Maybe you've added the file to your exclusions list?

Nope, I have no exclusions defined in WinDefender. And that's the main reason why I find this so weird, because if Defender really would flag this a a threat, that should have already happened when I compiled the EXE from code, and not just after uploading it to github...

NiyaShy commented 1 month ago

Got a reply. To quote it:

We cannot reproduce any detection on the file. If the detection is still observed, follow the steps below to capture support log files from the system reporting detection.

From an elevated command prompt [note: run as administrator], change to directory "%programfiles%\windows defender" and execute mpcmdrun.exe with option GetFiles: cd "%programfiles%\windows defender" mpcmdrun.exe -GetFiles

All created log files will be compressed into MPSupportFiles.cab.

Since I don't get any hits/detections, would be great if you could collect the support logs on your system and provide them here so I can forward them to MS.

Elinor10 commented 1 month ago

It seems like MS changed something because now it lets me download the file with no problem (I tried again before creating the log files): Download-history

I also checked in my laptop (with Windows 10) and it did the same (let me download after previously detecting a virus).

Now that it finally let me download the file I'll try using the beta version and update if it causes the issue too (not being able to turn on the controller after charging).

Elinor10 commented 1 month ago

I've been using the beta version for 2 weeks without any problem whatsoever (I also tested after charging and the controller always turns on). Not sure what's the difference between the stable version and the beta but I'm glad it works and that I can use it again.

NiyaShy commented 1 month ago

Thanks for the feedback, and great to hear that it works (again). The parts of the code that actually interact with the controller (or rather the API that delivers info about it) haven't changed between the "stable" and "beta" version, it's mostly stuff that affects the status display and alerting functions. So I still have no idea what may have caused it. 😅