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

Linux implementation should ignore portable devices #18

Closed
svartalf opened this issue Mar 6, 2019 · 1 comment
Closed

Linux implementation should ignore portable devices #18

svartalf opened this issue Mar 6, 2019 · 1 comment
Assignees
Labels
A-battery Area: battery crate C-bug Something isn't working O-linux Operating system: Linux P-medium Medium priority

Comments

@svartalf
Copy link
Owner

svartalf commented Mar 6, 2019

Devices with scope != System should be ignored, since it is impossible to expect from drivers to provide the same amount of information as in case of system batteries.

scope attribute was introduced in this patch: http://lkml.iu.edu/hypermail/linux/kernel/1112.0/03454.html

Example of the battery report from the connected mice, reported by @o10g:

/sys/class/power_supply/hidpp_battery_0/capacity_level:Normal
/sys/class/power_supply/hidpp_battery_0/manufacturer:Logitech
/sys/class/power_supply/hidpp_battery_0/model_name:Marathon Mouse/Performance Plus M705
/sys/class/power_supply/hidpp_battery_0/online:1
/sys/class/power_supply/hidpp_battery_0/scope:Device
/sys/class/power_supply/hidpp_battery_0/serial_number:406d-25-5b-d8-be
/sys/class/power_supply/hidpp_battery_0/status:Discharging
/sys/class/power_supply/hidpp_battery_0/type:Battery
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_NAME=hidpp_battery_0
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_SCOPE=Device
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_MODEL_NAME=Marathon Mouse/Performance Plus M705
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_MANUFACTURER=Logitech
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_SERIAL_NUMBER=406d-25-5b-d8-be
/sys/class/power_supply/hidpp_battery_0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
@svartalf svartalf added C-bug Something isn't working O-linux Operating system: Linux A-battery Area: battery crate P-medium Medium priority labels Mar 6, 2019
@svartalf svartalf self-assigned this Mar 6, 2019
svartalf added a commit that referenced this issue Mar 6, 2019
- Public methods and internal calculations are now using uom types only.
- Rename `Battery::percentage` method into `Battery::state_of_charge`
- Rename `Battery::capacity` method into `Battery::state_of_health`
- Mark `battery::State` and `battery::Technology` enums as a non-exhaustive
- Ignore devices with `scope` attributes different from `System` for Linux [#18](#18)
@svartalf
Copy link
Owner Author

svartalf commented Mar 6, 2019

Fixed at e77b758, issue close is postponed until next release.

svartalf added a commit that referenced this issue Mar 10, 2019
Both battery and battery-ffi are now propagating possible errors to callers.

Supporting multiple devices for FreeBSD and DragonFlyBSD systems (closes #17)
Ignoring Linux devices with scope other than System (closes #18).
svartalf added a commit that referenced this issue Mar 10, 2019
Both battery and battery-ffi are now propagating possible errors to callers.

Supporting multiple devices for FreeBSD and DragonFlyBSD systems (closes #17)
Ignoring Linux devices with scope other than System (closes #18).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-battery Area: battery crate C-bug Something isn't working O-linux Operating system: Linux P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

1 participant