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

create a power_supply for battery information (upower support) #2160

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

babbaj
Copy link

@babbaj babbaj commented Nov 10, 2023

Only implemented for mice because I only have a viper v2. Still need to only register a power_supply for mice that have a battery and generate a unique name for each power_supply.
It also looks like for some reason when the mouse is plugged in upower says the battery is at 0% and the state is unknown.

image

@babbaj babbaj mentioned this pull request Nov 10, 2023
@z3ntu
Copy link
Member

z3ntu commented Nov 10, 2023

Looks somewhat reasonable from a very quick first look. Could you please look into the CI failure and fix it?

@babbaj
Copy link
Author

babbaj commented Nov 10, 2023

the ci is complaining about the formatting even after i ran the autoformatter and only on the alpine ci

@z3ntu
Copy link
Member

z3ntu commented Nov 10, 2023

Are you running astyle 3.4.10 on your machine also?

Also the Ubuntu CI is just build-testing, all the other checks are only in the Alpine CI

@babbaj
Copy link
Author

babbaj commented Nov 10, 2023

astyle 3.1 from nixos unstable

@babbaj
Copy link
Author

babbaj commented Nov 10, 2023

formatting shouldn't be a problem anymore and it looks like the ci breaking isn't my fault this time

@z3ntu
Copy link
Member

z3ntu commented Nov 10, 2023

Yeah it's okay now. That failure I'll look to fix, your change broke some silent expectations from this shell script

@babbaj
Copy link
Author

babbaj commented Nov 10, 2023

I tried to create a unique name for every device with an id allocator but it ended up creating 5 devices for the same mouse and creating 3 duplicate batteries in upower so I just used the usb id instead. Is there a better way to fix this?

@lah7 lah7 linked an issue Nov 10, 2023 that may be closed by this pull request
@babbaj
Copy link
Author

babbaj commented Nov 11, 2023

I'm mostly confident in this now but when I plug in my mouse it shows a battery for the wired device and one for the wireless. I don't think that's incorrect but it seems unnecessary so should the wired version of wireless mice be ignored?

@babbaj
Copy link
Author

babbaj commented Nov 11, 2023

Ignoring wireless mouse is maybe not ideal because they can be used as wired mice without the dongle but in that case the battery level is useless anyways.
It also seems to cause upower to detect them as duplicate devices and sometimes no battery appears but that's fixable by giving them unique serial numbers.
I think ignoring the wired device would be good but sometimes the dongle will report 0% charge while the wired device reports the actual charge. (is this a known problem?)

@babbaj babbaj marked this pull request as ready for review November 11, 2023 22:15
@babbaj
Copy link
Author

babbaj commented Nov 16, 2023

ci fixed now but I think it would be a lot simpler for the script and the C code if every case statement just called a simple macro

@babbaj
Copy link
Author

babbaj commented Nov 19, 2023

@z3ntu got time to review this?

@z3ntu
Copy link
Member

z3ntu commented Nov 29, 2023

Give me some time, I hope to find some time soon :)

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

Successfully merging this pull request may close these issues.

upower support
3 participants