title: cannot automatically connect USB modem using udev under debian linux
body: <p>On my linux box (uname -a Linux gate 3.2.0-0.bpo.2-amd64 #1 SMP Fri Jun 29 20:42:29 UTC 2012 x86_64 GNU/Linux) I've got USB modem WeTelecom WM-D300 that has "zeroCD" option. ZeroCD USB id for it is 22de:6803, and modem device has 22de:6801 usb id. I've created usb_modeswitch rule for it and tested that this rule is working well:</p>
  
  <pre><code>Aug 11 23:03:14 gate kernel: [  609.832373] usb 1-1: usbfs: process 6081 (usb_modeswitch) did not claim interface 0 before use                  
  Aug 11 23:03:14 gate kernel: [  609.949352] usb 1-1: USB disconnect, device number 2                                                            
  Aug 11 23:03:15 gate kernel: [  610.596344] usb 1-1: new high-speed USB device number 5 using ehci_hcd                                          
  Aug 11 23:03:15 gate kernel: [  610.759964] usb 1-1: New USB device found, idVendor=22de, idProduct=6801                                        
  Aug 11 23:03:15 gate kernel: [  610.759978] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0                                   
  Aug 11 23:03:15 gate kernel: [  610.759987] usb 1-1: Product: Wetelecom Mobile Products                                                         
  Aug 11 23:03:15 gate kernel: [  610.759994] usb 1-1: Manufacturer: WeTelecom Incorporated                                                       
  Aug 11 23:03:16 gate kernel: [  611.820404] option 1-1:1.0: GSM modem (1-port) converter detected                                               
  Aug 11 23:03:16 gate kernel: [  611.820760] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3                                       
  Aug 11 23:03:16 gate kernel: [  611.820876] option 1-1:1.1: GSM modem (1-port) converter detected                                               
  Aug 11 23:03:16 gate kernel: [  611.821095] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB4                                       
  Aug 11 23:03:16 gate kernel: [  611.821204] option 1-1:1.2: GSM modem (1-port) converter detected                                               
  Aug 11 23:03:16 gate kernel: [  611.821418] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB5
  </code></pre>
  
  <p>So, I made a small udev config to allow automatic hotplugging for this device:</p>
  
  <pre><code>ACTION!="add|change", GOTO="modem_rules_end"                                                                                                    
  SUBSYSTEM!="usb", GOTO="modem_rules_end"
  
  LABEL="modem_rules_begin"                                                                                                                 
  
  # WeTelecom WM-D300                                                                                                                             
  ATTRS{idVendor}=="22de", ATTRS{idProduct}=="6803", RUN+="usb_modeswitch '%b/%k'"                                                                
  LABEL="modem_rules_end"
  </code></pre>
  
  <p>And it's not working.
  After I reconnect the modem, it becomes completely unavailable. usb-devices shows that it has usbfs driver and usb_modeswitch cannot switch it even from command line. udev failed to switch as well but after reboot it works just fine - till the next physical reconnect. 
  Here's the udev log when I plug the modem in:</p>
  
  <pre><code>Aug 11 22:42:11 gate logger: usb_modeswitch: using overriding config file /etc/usb_modeswitch.d/22de:6803; make sure this is intended           
  Aug 11 22:42:11 gate logger: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files                   
  Aug 11 22:42:11 gate logger: usb_modeswitch: using overriding config file /etc/usb_modeswitch.d/22de:6803; make sure this is intended           
  Aug 11 22:42:11 gate logger: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files                   
  Aug 11 22:42:11 gate usb_modeswitch: switching device 22de:6803 on 001/006                                                                      
  Aug 11 22:42:11 gate usb_modeswitch: switching device 22de:6803 on 001/006                                                                      
  Aug 11 22:42:11 gate kernel: [ 1495.864235] usb 1-1: usbfs: process 8485 (usb_modeswitch) did not claim interface 0 before use                  
  Aug 11 22:42:11 gate kernel: [ 1495.864309] usb 1-1: usbfs: process 8485 (usb_modeswitch) did not claim interface 0 before use                  
  Aug 11 22:42:16 gate logger: usb_modeswitch: switched to 22de:6803 on 001/006            
  Aug 11 22:42:19 gate logger: usb_modeswitch: switched to 22de:6803 on 001/006  
  </code></pre>
  
  <p>So, my question is: why and how? Why it's working from command line and how to make it working by udev?
  Please help. Thanx in advance!</p>