~ubuntu-branches/ubuntu/utopic/usb-modeswitch/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/05_fixed_configuration_switching_races.patch

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-03-16 14:00:50 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316140050-vmtn4d78c0iavqia
Tags: 1.1.7-1
* New 1.1.7 upstream version.

* Patches:
  + Add 01_extract_to_var_lib_not_tmp.patch to extract
    temporary files to /var/lib/usb_modeswitch instead of /tmp.
  + Add 02_allow_override_from_etc.patch to permit overriding
    packed configurations with files within /etc/usb_modeswitch.d/.
  - Remove 02_mp_correct_hyphens.patch: merged upstream.
  - Remove 04__use_var_lib_not_etc.patch: merged upstream.
  - Remove 05_fixed_configuration_switching_races.patch: was an upstream
    backport.
  - Remove 06_umdp_archive_in_usr.patch: Obsoleted by upstream.
* Replace usb-modeswitch-data-packed dependency by a versioned dependency on
  usb-modeswitch-data (copes with -packed package removal).
* Add a postinst maintainer script to move past runtime files to their new
  (and correct) location under /var/lib/.
* Also bump debhelper compat (was forgotten).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From bd450d14bde9473a4d413a37092b4fda8184eeca Mon Sep 17 00:00:00 2001
2
 
From: Amit Mendapara <mendapara.amit@gmail.com>
3
 
Date: Wed, 10 Nov 2010 16:38:03 +0530
4
 
Subject: [PATCH] Fixed configuration switching races.
5
 
 
6
 
---
7
 
 usb_modeswitch.c |    7 ++++++-
8
 
 1 files changed, 6 insertions(+), 1 deletions(-)
9
 
 
10
 
--- a/usb_modeswitch.c
11
 
+++ b/usb_modeswitch.c
12
 
@@ -812,13 +812,18 @@
13
 
        return 2;
14
 
 }
15
 
 
16
 
+#define SWITCH_CONFIG_MAXTRIES   5
17
 
 
18
 
 int switchConfiguration ()
19
 
 {
20
 
+       int count = SWITCH_CONFIG_MAXTRIES; 
21
 
        int ret;
22
 
 
23
 
        SHOW_PROGRESS("Changing configuration to %i ...\n", Configuration);
24
 
-       ret = usb_set_configuration(devh, Configuration);
25
 
+       while (((ret = usb_set_configuration(devh, Configuration)) < 0) && --count) { 
26
 
+               SHOW_PROGRESS(" Device is busy, trying to detach kernel driver\n"); 
27
 
+               detachDriver(); 
28
 
+       } 
29
 
        if (ret == 0 ) {
30
 
                SHOW_PROGRESS(" OK, configuration set\n");
31
 
                return 1;