Make Bluetooth devices for which we can't guess the "kind" or form
factor be "generic Bluetooth" devices, rather than "unknown" devices.
That should make it clearer in UIs that the devices are Bluetooth rather
than connected to the computer somehow.
Closes: #137
This will be useful to show information about Bluetooth devices which
don't fit in with the existing types, and for which we don't want to
show an unknown kind.
capacity is supposed to be the running battery percentage, not a
representation of its current state of the factory capacity (which
isn't something that's ever shown in Linux or macOS).
Use the new "ignore-system-percentage" property to work-around that
problem.
Closes: #141, #103
On some hardware, the "capacity" sysfs contains the capacity of the
battery when full compared to when it was new, instead of the percentage
of battery available.
Make it possible to ignore the "capacity" with this new property.
This adds a variety of missing device kinds specific to the Bluetooth
classes supported in gnome-bluetooth [1].
In up_device_to_text these types have only been added to the
`percentage` class, which is currently the only property exposed by
org.bluez.Battery1, where these devices are coming from.
[1]: cf4a0ba59d/lib/bluetooth-utils.c (L165)
Almost every device kind except line power and invalid (>= last) carry a
valid percentage property. By inverting this conditional not every new
device needs to be added explicitly to this already long and lacking
chain (PDA and MONITOR were already missing).
Those devices date back from the mid-2000s. If they still work, and
somebody is still interested in having them export their battery status,
we would recommend moving this information to the appropriate kernel
drivers.
It's really confusing seeing "not a switch [...]" when we actually
managed to find a switch, so throw 2 errors in the debug when both
checks fail, rather than as things are being tested.
src/up-input.c:294:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
294 | close (input->eventfp);
| ^~~~~
| pclose
Despite what the comments say, the device is indeed a valid input
device, it's just not one we want to add to the power devices,
as done in up-daemon.c's up_daemon_device_added_cb().
Rather than using the type of the first sibling device we find, which is
usually the pointing device portion, make sure that keyboard/pointing
device combo devices are identified as keyboards.