Cross compiling drivers for USB modem - linux

I have a physical card with an IMX6 CPU that runs Linux (a kernel I compiled from source, from the manufacturer's website). I also have a USB Cellular modem dongle that I want to use with the card. However, when I plug the dongle in the card, I get this in dmesg:
[ 29.825491] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 29.983396] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 29.991796] scsi0 : usb-storage 1-1:1.0
[ 30.987573] scsi 0:0:0:0: Direct-Access ALCATEL Mass Storage 2.31 PQ: 0 ANSI: 2
[ 30.996027] scsi 0:0:0:1: CD-ROM ALCATEL Mass Storage 2.31 PQ: 0 ANSI: 2
[ 31.008487] sd 0:0:0:0: [sda] Attached SCSI removable disk
It looks like Linux is recognizing the device as a mass storage device (it doubles as a storage device), but not as a modem. When I insert the same dongle into a regular Ubuntu machine, I get this:
[264822.947101] usb 1-5: new high-speed USB device number 12 using ehci-pci
[264823.086874] usb 1-5: New USB device found, idVendor=1bbb, idProduct=0017
[264823.086880] usb 1-5: New USB device strings: Mfr=3, Product=2, SerialNumber=[REDACTED]
[264823.086883] usb 1-5: Product: HSPA Data Card
[264823.086886] usb 1-5: Manufacturer: USBModem
[264823.086888] usb 1-5: SerialNumber: [REDACTED]
[264823.089483] option 1-5:1.0: GSM modem (1-port) converter detected
[264823.089685] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB1
[264823.089816] option 1-5:1.1: GSM modem (1-port) converter detected
[264823.090019] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB2
[264823.090150] option 1-5:1.2: GSM modem (1-port) converter detected
[264823.090311] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB3
[264823.090433] option 1-5:1.3: GSM modem (1-port) converter detected
[264823.090574] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB4
[264823.090666] usb-storage 1-5:1.4: USB Mass Storage device detected
[264823.090916] scsi host16: usb-storage 1-5:1.4
[264823.091067] option 1-5:1.5: GSM modem (1-port) converter detected
[264823.091133] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB5
[264824.089843] scsi 16:0:0:0: Direct-Access ALCATEL Mass Storage 2.31 PQ: 0 ANSI: 2
[264824.090238] sd 16:0:0:0: Attached scsi generic sg2 type 0
[264824.093552] sd 16:0:0:0: [sdb] Attached SCSI removable disk
I know how to compile modules externally and into the kernel, by choosing them in menuconfig. However, I don't know which modules I should compile for this device, if they are even included in the kernel source. How can I find which modules / drivers to compile?

USB modems often start up as Mass storage devices to allow for driver installation.
You can use software such as USB_ModeSwitch to force it to change modes. (this is likely already installed and working on your Ubuntu system)
Failing that, many will switch modes when their storage is ejected (as by eject).

you can check the sysfs attributes in Ubuntu for the associated driver
in /sys/bus/usb/devices/ and enable that driver in your board kernel configuration.

Related

How to configure driver in Buildroot for Moxa UPort 1110 USB serial converter?

I have a board with an embedded system that is buildroot based. In "make linux-menuconfig" I would like to add the appropriate drivers for the USB-RS232 adapter "Moxa UPORT 1110". I marked in "make linux-menuconfig":
Device Drivers-> USB support -> USB Serial Converter support-> USB MoxaUPORT Serial Driver
after connecting the adapter with the device, linux will not recognize the device.
When I check "lsusb" I get:
lsusb
Bus 001 Device 006: ID 110a:1110
Bus 001 Device 001: ID 1d6b:0002
The board does not see the producer's name etc. On my Ubuntu computer I get after plugging in usb and typing "lsusb ::
Bus 001 Device 036: ID 110a:1110 Moxa Technologies Co., Ltd.
When I check dmesg after plugging in the USB and see:
[ 9752.822985] usb 1-1: USB disconnect, device number 5
[ 9754.605939] usb 1-1: new full-speed USB device number 6 using musb-hdrc
[ 9754.768212] usb 1-1: New USB device found, idVendor=110a, idProduct=1110
[ 9754.775263] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 9754.782783] usb 1-1: Product: UPort 1110
[ 9754.786903] usb 1-1: Manufacturer: Moxa Technologies Co., Ltd.
should I check any additional settings / drivers in "make linux-menuconfig" to see the USB-R232 adapter?
From looking at the Linux source code, I understand that you enabled the mxuport driver which does not cover the UPORT 1110. However, it looks like the ti_usb_3410_5052 driver does. You can enable it by setting CONFIG_USB_SERIAL_TI.
In the Buildroot sources I see that you must make sure that BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI is set in order to include the firmware file (moxa-1110.fw).
So, in make menuconfig enable USB TI 3410/5052 Serial Firmware under Target packages > Hardware handling > Firmware > linux-firmware > USB to Serial Firmware

linux virtual comport driver for ARM cortex A8

I have been working on this problem for quite a while now and cannot seem to find the correct driver for Linux to interface with an STM32F407. The Linux runs on an AR drone 2.0. The STM already acts as a virtual Com-port as itself when I connect it to my computer and then I can interact with it. On the AR drone 2.0 it is not listed as a COM-port but it does detect it as a USB device when I attach it. When I telnet it, it gives me this information:
Bus 001 device 002: ID 0483:5740 SGS Thomson Microelectronics
Bus 001 device 001: ID 1d6b:0002
The first one is obviously the one I need to look at and I looked at the vendor ID on this website. http://www.linux-usb.org/usb.ids
this vendor ID gave me indeed the STM32F407, but I cannot find the Linux driver for this device. I was able to put the STM into a Linux computer and then looked at what driver it used.
It was the CDC_AMC driver. I looked it up but now I have the next problem.
it needs the virtual COM-Port driver to interact with the STM32.
The Drone runs on a busybox Linux version v1.14.0 and I have not enough experience with Linux to know what driver I have to use and where I can find it.
Does it also have something to do with what processor it uses? In that case, the drone has a: ARM Cortex A8 1 GHz 32-bit processor
The following is seen in the output of dmesg:
usb 1-1: new full speed USB device using musb_hdrc and address 2 ecc correction in bits 939,
usb 1-1: skipped 4 descriptors after interface
usb 1-1: default language 0x0409
usb 1-1: udev 2, busnum 1, minor = 1
usb 1-1: New USB device found, idVendor=0483, idProduct=5740
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: Pozyx Virtual ComPort in FS Mode
usb 1-1: Manufacturer: Pozyx Labs
usb 1-1: SerialNumber: 396D323F3336
usb 1-1: uevent

How to disable USB device on Linux Mint?

I have consecutive log messages:
usb-storage 2-1.5:1.0: USB Mass Storage device detected
usb-storage 2-1.5:1.0: Quirks match for vid 05e3 pid 0723: 8000
scsi host25: usb-storage 2-1.5:1.0
usb 2-1.5: USB disconnect, device number 49
usb 2-1.5: new high-speed USB device number 50 using ehci-pci
usb 2-1.5: new high-speed USB device number 53 using ehci-pci
usb 2-1.5: new high-speed USB device number 54 using ehci-pci
usb 2-1.5: new high-speed USB device number 57 using ehci-pci
usb 2-1.5: New USB device found, idVendor=05e3, idProduct=0723
usb 2-1.5: New USB device strings: Mfr=3, Product=4, SerialNumber=2
usb 2-1.5: Product: USB Storage
usb 2-1.5: Manufacturer: Generic
usb 2-1.5: SerialNumber: 000000009451
usb-storage 2-1.5:1.0: USB Mass Storage device detected
usb-storage 2-1.5:1.0: Quirks match for vid 05e3 pid 0723: 8000
scsi host26: usb-storage 2-1.5:1.0
scsi 26:0:0:0: Direct-Access Generic STORAGE DEVICE 9451 PQ: 0 ANSI: 0
sd 26:0:0:0: Attached scsi generic sg2 type 0
sd 26:0:0:0: [sdc] Attached SCSI removable disk
usb 2-1.5: USB disconnect, device number 57
usb 2-1.5: new high-speed USB device number 58 using ehci-pci
usb 2-1.5: New USB device found, idVendor=05e3, idProduct=0723
usb 2-1.5: New USB device strings: Mfr=3, Product=4, SerialNumber=2
usb 2-1.5: Product: USB Storage
usb 2-1.5: Manufacturer: Generic
usb 2-1.5: SerialNumber: 000000009451
usb-storage 2-1.5:1.0: USB Mass Storage device detected
usb-storage 2-1.5:1.0: Quirks match for vid 05e3 pid 0723: 8000
scsi host27: usb-storage 2-1.5:1.0
scsi 27:0:0:0: Direct-Access Generic STORAGE DEVICE 9451 PQ: 0 ANSI: 0
sd 27:0:0:0: Attached scsi generic sg2 type 0
sd 27:0:0:0: [sdc] Attached SCSI removable disk
This disturb me because of sound of plugged/unplugged device, even when sound is muted (I setup 0% volume, and the sound icon in taskbar is grayed)
How to prevent this?
This command seems helps me:
echo "2-1.5:1.0" > /sys/bus/usb/drivers/usb-storage/2-1.5:1.0/driver/unbind

USB host and device functionality on SBC 6845 board using kernel modules

I am working on SBC 6845(Atmel processor) in linux embedded development. My kernel version is 2.6.30.
This board comes with 2 USB ports(Both with Type A), one can be configured as host and other as USB device.
I have configured these USB modules in kernel. I have burned kernel and file system with necessary modules including USB modules. I have loaded these USB modules through /init.d/rcS file.
When board turns on and I type lsmod on console it shows me these modules loaded.
When I connect board to computer, USB is not detected (device functionality).
When I connect pendrive to board, it is not detected (host functionality).
/init.d/rcS Script
#install USB Gadgate mass_storage
modprobe g_file_storage file=/home/mass_storage/backed_storage_file stall=n
losetup -o 4096 /dev/loop0 /home/mass_storage/backed_storage_file
#install USB ehci-hcd
modprobe ehci-hcd
rcS running log
g_file_storage gadget: File-backed Storage Gadget, version: 20 November 2008
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /home/mass_storage/backed_storage_file
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
atmel-ehci atmel-ehci: Atmel EHCI UHP HS
atmel-ehci atmel-ehci: new USB bus registered, assigned bus number 1
atmel-ehci atmel-ehci: irq 22, io mem 0x00800000
atmel-ehci atmel-ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Atmel EHCI UHP HS
usb usb1: Manufacturer: Linux 2.6.30 ehci_hcd
usb usb1: SerialNumber: atmel-ehci
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
lsmod output
Module Size Used by Not tainted
ehci_hcd 30132 0
g_file_storage 24260 0
Any help is welcome!
Your drivers seem well installed. I don't have a straight answer but I work with software-hardware integration very often. Here is what I would do to get more clues. That kind of processor often have pins that are multipurposes. Sometimes, on an evaluation board, they are not configured the way we want by default. You can look at the documentation but also, you can use an Oscilloscope and probe the D+ and D- of the USB. Are they OK when in IDLE? What happen when you connect a device on your host port? The first few things will be done by the USB controller and involves little even no interaction with the software after the controller is configured. If you see the beginning of a negociation (a bunch of 0s and 1s) then, you know your hardware is configured properly and your basic driver is installed and work properly. The result of this will narrow the scope of the problem.
You are missing upper layer drivers. EHCI is only an interface driver, you need device drivers on top of it. Board<-->PC communication is usually done via serial over USB, so for this you need USB Serial driver. In Kernel config go to Device Drivers -> USB Support -> USB Serial Converter support and select driver according to the chip on your board/cable.
Here's an example dmesg dump seen when board is connected to the Ubuntu laptop:
[ 3469.923779] usb 2-1.2: new full-speed USB device number 5 using
ehci_hcd
[ 3470.019145] cp210x 2-1.2:1.0: cp210x converter detected
[ 3470.091614] usb 2-1.2: reset full-speed USB device number 5 using
ehci_hcd
[ 3470.184995] usb 2-1.2: cp210x converter now attached to ttyUSB0
I believe similar situation is with pendrive too - upper layer driver is missing.

Sony Ericsson registers two devices when connected to USB port

I am very curios that why does every Sony Ericsson phone (w200i,2660 etc) register two ttyACM devices when connected to PC via USB? This also introduces complications in interfacing with the mobile. Can any one explain this please?
Me and my Colleague are writing an SMS gateway using Python-Gammu, and we are having a hard time making an automated system which will listen on Udev and provide Plug and Play/Hotplug functionality.
Below is a snapshot of "dmesg" after plugging in the mobile:
[ 3335.853330] sd 6:0:0:0: [sdc] Synchronizing SCSI cache
[ 3335.853388] sd 6:0:0:0: [sdc] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[ 3373.115701] usb 1-1.4: new full speed USB device number 5 using ehci_hcd
[ 3373.245499] cdc_acm 1-1.4:1.1: ttyACM0: USB ACM device
[ 3373.246619] cdc_acm 1-1.4:1.3: ttyACM1: USB ACM device
[ 3373.247459] usbcore: registered new interface driver cdc_acm
[ 3373.247464] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 3373.247519] cdc_wdm 1-1.4:1.7: cdc-wdm0: USB WDM device
[ 3373.247565] usbcore: registered new interface driver cdc_wdm
You have two devices because your phone exposes two USB interfaces. As you can see in your log there are two kernel modules loaded for your phone.
[ 3373.247464] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN
[ 3373.247519] cdc_wdm 1-1.4:1.7: cdc-wdm0: USB WDM device
From the Kconfig of the cdc-wdm module:
This driver supports the WMC Device Management functionality
of cell phones compliant to the CDC WMC specification. You can use
AT commands over this device.
So you end up with two "modem" devices(acm, wdm) since both can use the AT-Command Set to communicate.
I don't know anything about the WDM specifications, but i hope i could help you anyway.

Resources