Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add more bugfixes for USB cert insanity
Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
  • Loading branch information
philippedeswert committed Jul 21, 2011
1 parent 022260b commit d0f4616
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Expand Up @@ -3,6 +3,7 @@ usb-moded (0.45) unstable; urgency=low
* Only signal MODE_UNDEFINED when we have actually done all the modesetting handling
after disconnect. Fixes: NB#273204
* Actually use cdrom timeout
* Clean-up if we change mode before the clean-up timeout expired. Fixes: NB#273493

-- Philippe De Swert <philippe.de-swert@nokia.com> Wed, 13 Jul 2011 14:45:42 +0300

Expand Down
2 changes: 2 additions & 0 deletions src/usb_moded-modules.c
Expand Up @@ -267,6 +267,8 @@ void check_module_state(const char *module_name)
#ifdef NOKIA
gboolean usb_cleanup_timeout(gpointer data)
{
/* signal usb disconnected */
usb_moded_send_signal(USB_DISCONNECTED);
usb_moded_mode_cleanup(get_usb_module());
usb_moded_module_cleanup(get_usb_module());
set_usb_mode(MODE_UNDEFINED);
Expand Down
2 changes: 1 addition & 1 deletion src/usb_moded-udev.c
Expand Up @@ -175,8 +175,8 @@ static void udev_parse(struct udev_device *dev)
/* power supply type might not exist also :( Send connected event but this will not be able
to discriminate between charger/cable */
log_warning("Fallback since cable detection cannot be accurate. Will connect on any voltage on usb.\n");
set_usb_connected(TRUE);
cable = 1;
set_usb_connected(TRUE);
return;
}
if(!strcmp(tmp, "USB")||!strcmp(tmp, "USB_CDP"))
Expand Down
11 changes: 9 additions & 2 deletions src/usb_moded.c
Expand Up @@ -130,12 +130,12 @@ static gboolean set_disconnected(gpointer data)
if(!get_usb_connection_state())
{
log_debug("usb disconnected\n");
/* signal usb disconnected */
usb_moded_send_signal(USB_DISCONNECTED);
#ifdef NOKIA
/* delayed clean-up of state */
timeout_source = g_timeout_add_seconds(3, usb_cleanup_timeout, NULL);
#else
/* signal usb disconnected */
usb_moded_send_signal(USB_DISCONNECTED);
/* unload modules and general cleanup */
usb_moded_mode_cleanup(get_usb_module());
usb_moded_module_cleanup(get_usb_module());
Expand Down Expand Up @@ -171,6 +171,13 @@ void set_usb_connected_state(void)
if(mode_to_set)
#endif /* NOKIA */
{
#ifdef NOKIA
/* If we switch to another mode than the one that is still set before the
clean-up timeout expired we need to clean up */
if(strcmp(mode_to_set, get_usb_mode()))
usb_moded_mode_cleanup(get_usb_module());
#endif /* NOKIA */

if(!strcmp(MODE_ASK, mode_to_set))
{
/* send signal, mode will be set when the dialog service calls
Expand Down

0 comments on commit d0f4616

Please sign in to comment.