1

I try to setup a USB modem (Chip is a SimTech SIM5215) using QMI. Everything works fine and it connects to my mobile provider. One problem remains: most of the time the kernel loads the module option (USB Driver for GSM modems) before the module qmi_wwan, or at least the former is faster to grab all USB-devices. As a result I don't get the /dev/cdc-wdm0 device and thus no wwan0 network device. The part of /var/log/messages when I connect the USB modem

kernel: [   43.207188] usb 1-1.3: new full-speed USB device number 6 using dwc_otg
kernel: [   43.359442] usb 1-1.3: New USB device found, idVendor=05c6, idProduct=9000
kernel: [   43.359454] usb 1-1.3: New USB device strings: Mfr=3, Product=2, SerialNumber=0
kernel: [   43.359462] usb 1-1.3: Product: SimTech SIM5215
kernel: [   43.359470] usb 1-1.3: Manufacturer: SimTech, Incorporated
kernel: [   43.410284] usbcore: registered new interface driver cdc_wdm
kernel: [   43.410544] usbcore: registered new interface driver option
kernel: [   43.410700] usbserial: USB Serial support registered for GSM modem (1-port)
kernel: [   43.411708] option 1-1.3:1.0: GSM modem (1-port) converter detected
kernel: [   43.412346] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
kernel: [   43.412712] option 1-1.3:1.1: GSM modem (1-port) converter detected
kernel: [   43.413328] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
kernel: [   43.413640] option 1-1.3:1.2: GSM modem (1-port) converter detected
kernel: [   43.414347] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
kernel: [   43.414698] option 1-1.3:1.3: GSM modem (1-port) converter detected
kernel: [   43.417016] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
kernel: [   43.417454] option 1-1.3:1.4: GSM modem (1-port) converter detected
kernel: [   43.418004] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB5
kernel: [   43.426736] usbcore: registered new interface driver qmi_wwan

A workaround is, to unload both manually (sudo modprobe -r option; sudo modprobe -r qmi_wwan) and then reload them with qmi_wwan being first.

kernel: [  173.846230] usbserial: USB Serial deregistering driver GSM modem (1-port)
kernel: [  173.846575] option1 ttyUSB5: GSM modem (1-port) converter now disconnected from ttyUSB5
kernel: [  173.846790] option1 ttyUSB4: GSM modem (1-port) converter now disconnected from ttyUSB4
kernel: [  173.846991] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
kernel: [  173.847194] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
kernel: [  173.847399] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
kernel: [  173.847461] usbcore: deregistering interface driver option
kernel: [  173.847640] option 1-1.5:1.4: device disconnected
kernel: [  173.847787] option 1-1.5:1.3: device disconnected
kernel: [  173.847954] option 1-1.5:1.2: device disconnected
kernel: [  173.848127] option 1-1.5:1.1: device disconnected
kernel: [  173.848344] option 1-1.5:1.0: device disconnected
kernel: [  235.370507] usbcore: deregistering interface driver qmi_wwan
kernel: [  235.408871] usbcore: deregistering interface driver cdc_wdm

Reloading qmi_wwan (sudo modprobe qmi_wwan)

kernel: [  315.831863] usbcore: registered new interface driver cdc_wdm
kernel: [  315.838272] qmi_wwan 1-1.5:1.4: cdc-wdm0: USB WDM device
kernel: [  315.839629] qmi_wwan 1-1.5:1.4 wwan0: register 'qmi_wwan' at usb-3f980000.usb-1.5, WWAN/QMI device,  
kernel: [  315.839942] usbcore: registered new interface driver qmi_wwan

Reloading option (sudo modprobe option)

kernel: [  366.834029] usbcore: registered new interface driver option
kernel: [  366.834135] usbserial: USB Serial support registered for GSM modem (1-port)
kernel: [  366.834860] option 1-1.5:1.0: GSM modem (1-port) converter detected
kernel: [  366.837013] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1
kernel: [  366.837385] option 1-1.5:1.1: GSM modem (1-port) converter detected
kernel: [  366.837975] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2
kernel: [  366.838238] option 1-1.5:1.2: GSM modem (1-port) converter detected
kernel: [  366.839990] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB3
kernel: [  366.840287] option 1-1.5:1.3: GSM modem (1-port) converter detected
kernel: [  366.840901] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB4

As can be seen, the former ttyUSB5 is gone because qmi_wwan grabbed it.

Question is, how do I either prevent option from grabbing the device, or disable it completely? Sometimes (racing condition?) the qmi_wwan is fast enough to get the device before option and I don't need to reload the modules.

1

I used this script, you can add a simple test if cdc-wdm0 exist at boot. I recommend using udev rules to rename your tty based on port numbers see link.

https://www.raspberrypi.org/forums/viewtopic.php?t=145370

while true; do modprobe -r option 2>/dev/null  && break; done &
echo -ne "at+reboot\r" > /dev/simcomAT; && sleep 10;

The first line keeps trying to unload option module. Second one sends a reboot to the modem. Resetting the modem removes the USB devices currently using the kernel module, allowing the module to unload. if modprobe returns succes the breaks is run ending the loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.