Commit 72b85b8c authored by Bastien Nocera's avatar Bastien Nocera

lib: Add "Pen" device type

So we can track the battery information for powered tablet pens, rather
than labelling them as tablets.
parent a1a437d7
Pipeline #73049 passed with stage
in 9 minutes and 39 seconds
......@@ -313,7 +313,8 @@ up_device_to_text (UpDevice *device)
kind == UP_DEVICE_KIND_BATTERY ||
kind == UP_DEVICE_KIND_MOUSE ||
kind == UP_DEVICE_KIND_KEYBOARD ||
kind == UP_DEVICE_KIND_GAMING_INPUT) &&
kind == UP_DEVICE_KIND_GAMING_INPUT ||
kind == UP_DEVICE_KIND_PEN) &&
!is_display)
g_string_append_printf (string, " rechargeable: %s\n", up_device_bool_to_string (up_exported_device_get_is_rechargeable (priv->proxy_device)));
if (kind == UP_DEVICE_KIND_BATTERY ||
......@@ -367,7 +368,8 @@ up_device_to_text (UpDevice *device)
kind == UP_DEVICE_KIND_COMPUTER ||
kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
kind == UP_DEVICE_KIND_UPS ||
kind == UP_DEVICE_KIND_GAMING_INPUT) {
kind == UP_DEVICE_KIND_GAMING_INPUT ||
kind == UP_DEVICE_KIND_PEN) {
if (battery_level == UP_DEVICE_LEVEL_NONE)
g_string_append_printf (string, " percentage: %g%%\n", up_exported_device_get_percentage (priv->proxy_device));
else
......
......@@ -71,6 +71,8 @@ up_device_kind_to_string (UpDeviceKind type_enum)
return "computer";
case UP_DEVICE_KIND_GAMING_INPUT:
return "gaming-input";
case UP_DEVICE_KIND_PEN:
return "pen";
default:
return "unknown";
}
......@@ -113,6 +115,8 @@ up_device_kind_from_string (const gchar *type)
return UP_DEVICE_KIND_TABLET;
if (g_str_equal (type, "gaming-input"))
return UP_DEVICE_KIND_GAMING_INPUT;
if (g_str_equal (type, "pen"))
return UP_DEVICE_KIND_PEN;
return UP_DEVICE_KIND_UNKNOWN;
}
......
......@@ -49,6 +49,7 @@ typedef enum {
UP_DEVICE_KIND_TABLET,
UP_DEVICE_KIND_COMPUTER,
UP_DEVICE_KIND_GAMING_INPUT,
UP_DEVICE_KIND_PEN,
UP_DEVICE_KIND_LAST
} UpDeviceKind;
......
......@@ -86,7 +86,8 @@ BATTERY_IFACE = 'org.bluez.Battery1'
UP_DEVICE_KIND_MEDIA_PLAYER,
UP_DEVICE_KIND_TABLET,
UP_DEVICE_KIND_COMPUTER,
UP_DEVICE_KIND_GAMING_INPUT) = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
UP_DEVICE_KIND_GAMING_INPUT,
UP_DEVICE_KIND_PEN) = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
class Tests(dbusmock.DBusTestCase):
@classmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment