summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-11-11 13:38:49 +0000
committerRichard Hughes <richard@hughsie.com>2008-11-11 13:38:49 +0000
commit7a29b5118c69d2f5f6d78df1dac3bd9f238e79b1 (patch)
tree250d1ab69b2aee0522560c0a9cbff71ddb02c765 /src
parent61fad487bace7114a9308db7106085ac128bbda1 (diff)
bugfix: match the WUP device on the tty device, not the USB device
Diffstat (limited to 'src')
-rw-r--r--src/95-devkit-power-wup.rules2
-rw-r--r--src/dkp-daemon.c29
-rw-r--r--src/dkp-wup.c3
3 files changed, 17 insertions, 17 deletions
diff --git a/src/95-devkit-power-wup.rules b/src/95-devkit-power-wup.rules
index c0afa52..26cd141 100644
--- a/src/95-devkit-power-wup.rules
+++ b/src/95-devkit-power-wup.rules
@@ -1,5 +1,5 @@
##############################################################################################################
# Watts Up? Pro Devices
#
-ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", ATTR{serial}=="A80?????", ENV{ID_VENDOR}="Watts Up, Inc.", ENV{ID_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
+SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A80?????", ENV{ID_VENDOR}="Watts Up, Inc.", ENV{ID_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
diff --git a/src/dkp-daemon.c b/src/dkp-daemon.c
index c3a2b83..9e540fa 100644
--- a/src/dkp-daemon.c
+++ b/src/dkp-daemon.c
@@ -55,7 +55,7 @@ enum
LAST_SIGNAL,
};
-static const gchar *subsystems[] = {"power_supply", "usb", NULL};
+static const gchar *subsystems[] = {"power_supply", "usb", "tty", NULL};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -222,19 +222,14 @@ dkp_daemon_finalize (GObject *object)
if (daemon->priv->pk_context != NULL)
polkit_context_unref (daemon->priv->pk_context);
-
if (daemon->priv->pk_tracker != NULL)
polkit_tracker_unref (daemon->priv->pk_tracker);
-
if (daemon->priv->system_bus_proxy != NULL)
g_object_unref (daemon->priv->system_bus_proxy);
-
if (daemon->priv->system_bus_connection != NULL)
dbus_g_connection_unref (daemon->priv->system_bus_connection);
-
if (daemon->priv->devkit_client != NULL)
g_object_unref (daemon->priv->devkit_client);
-
if (daemon->priv->list != NULL)
g_object_unref (daemon->priv->list);
@@ -437,24 +432,29 @@ gpk_daemon_device_get (DkpDaemon *daemon, DevkitDevice *d)
/* no valid power supply object */
device = NULL;
- } else if (egg_strequal (subsys, "usb")) {
+ } else if (egg_strequal (subsys, "tty")) {
- /* see if this is a CSR mouse or keyboard */
- device = DKP_DEVICE (dkp_csr_new ());
+ /* try to detect a Watts Up? Pro monitor */
+ device = DKP_DEVICE (dkp_wup_new ());
ret = dkp_device_coldplug (device, daemon, d);
if (ret)
goto out;
g_object_unref (device);
- /* try to detect a HID UPS */
- device = DKP_DEVICE (dkp_hid_new ());
+ /* no valid TTY object ;-( */
+ device = NULL;
+
+ } else if (egg_strequal (subsys, "usb")) {
+
+ /* see if this is a CSR mouse or keyboard */
+ device = DKP_DEVICE (dkp_csr_new ());
ret = dkp_device_coldplug (device, daemon, d);
if (ret)
goto out;
g_object_unref (device);
- /* try to detect a Watts Up? Pro monitor */
- device = DKP_DEVICE (dkp_wup_new ());
+ /* try to detect a HID UPS */
+ device = DKP_DEVICE (dkp_hid_new ());
ret = dkp_device_coldplug (device, daemon, d);
if (ret)
goto out;
@@ -561,6 +561,7 @@ gpk_daemon_register_power_daemon (DkpDaemon *daemon)
DBusConnection *connection;
DBusError dbus_error;
GError *error = NULL;
+ guint i;
daemon->priv->pk_context = polkit_context_new ();
polkit_context_set_io_watch_functions (daemon->priv->pk_context, pk_io_add_watch, pk_io_remove_watch);
@@ -634,6 +635,8 @@ gpk_daemon_register_power_daemon (DkpDaemon *daemon)
}
/* connect to the DeviceKit daemon */
+ for (i=0; subsystems[i] != NULL; i++)
+ egg_debug ("registering subsystem : %s", subsystems[i]);
daemon->priv->devkit_client = devkit_client_new (subsystems);
if (!devkit_client_connect (daemon->priv->devkit_client, &error)) {
egg_warning ("Couldn't open connection to DeviceKit daemon: %s", error->message);
diff --git a/src/dkp-wup.c b/src/dkp-wup.c
index 498c6b7..a67df81 100644
--- a/src/dkp-wup.c
+++ b/src/dkp-wup.c
@@ -375,9 +375,6 @@ dkp_wup_coldplug (DkpDevice *device)
egg_debug ("could not get device file for WUP device");
goto out;
}
- egg_debug ("wanted %s", device_file);
- device_file = g_strdup ("/dev/ttyUSB0");
- egg_debug ("opened %s", device_file);
/* connect to the device */
wup->priv->fd = open (device_file, O_RDWR | O_NONBLOCK);