Skip to content

Commit

Permalink
* Use online property for N900 and other devices where present does n…
Browse files Browse the repository at this point in the history
…ot work

* Correct udev conf read debug messages
Signed-off-by: Philippe De Swert <phdeswer@lumi.maa>
  • Loading branch information
Philippe De Swert committed Apr 7, 2011
1 parent 57e9dc2 commit 72d1af6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/usb_moded-config.c
Expand Up @@ -139,7 +139,7 @@ const char * find_udev_path(void)
test = g_key_file_load_from_file(settingsfile, FS_MOUNT_CONFIG_FILE, G_KEY_FILE_NONE, NULL);
if(!test)
{
log_debug("No cdrom path.\n");
log_debug("No udev path.\n");
g_key_file_free(settingsfile);
return(ret);
}
Expand All @@ -151,7 +151,7 @@ const char * find_udev_path(void)
tmp_char = g_key_file_get_string(settingsfile, UDEV_PATH_ENTRY, *keys, NULL);
if(tmp_char)
{
log_debug("cdrom key value = %s\n", tmp_char);
log_debug("udev path value = %s\n", tmp_char);
ret = g_strdup(tmp_char);
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/usb_moded-udev.c
Expand Up @@ -25,7 +25,7 @@ gpointer monitor_udev(gpointer data) __attribute__ ((noreturn));
gboolean hwal_init(void)
{
GThread * thread;
const gchar *udev_path;
const gchar *udev_path = NULL;

/* Create the udev object */
udev = udev_new();
Expand All @@ -42,7 +42,7 @@ gboolean hwal_init(void)
dev = udev_device_new_from_syspath(udev, "/sys/class/power_supply/usb");
if (!dev)
{
log_err("Unable to find /sys/class/power_supply/usb device.");
log_err("Unable to find $power_supply device.");
return 0;
}
mon = udev_monitor_new_from_netlink (udev, "udev");
Expand Down Expand Up @@ -74,7 +74,8 @@ gpointer monitor_udev(gpointer data)
{
if(!strcmp(udev_device_get_action(dev), "change"))
{
if(!strcmp(udev_device_get_property_value(dev, "POWER_SUPPLY_PRESENT"), "1"))
if(!strcmp(udev_device_get_property_value(dev, "POWER_SUPPLY_PRESENT"), "1") ||
!strcmp(udev_device_get_property_value(dev, "POWER_SUPPLY_ONLINE"), "1"))
{
log_debug("UDEV:power supply present\n");
/* POWER_SUPPLY_TYPE is USB if usb cable is connected, or USB_DCP for charger */
Expand Down

0 comments on commit 72d1af6

Please sign in to comment.