OpenWrt Forum Archive

Topic: mounting a USB CDROM, simulated by a Novatel MC950D HSUPA G3 modem

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

am struggling to get following issue resolved on a Asus WL500gp v1 with recent Kamikaze, home compiled on 2.4 basis (bleeding edge, r11377):
the USB G3.5 modem Novatel MC950D presents itself the first few minutes as a CDROM (usb 1410:5010) from the flash also built into that USB stick. It can be forced to become modem by an eject command and then becomes the modem with usb 1410:4400.
The problem:
the CDROM shows as a scsi device in /proc/scsi/scsi but does not show up in /dev as a cdrom device like /dev/scd0 or the like.
The eject command expects a device so how can I make the CDROM visble as a device that then can be ejected ?

If somebody knows the answer to the above question then comes the next: where to put the eject command so that whenever the CDROM pops up it gets ejected so I can get on with the modem functions ?

Any help appreciated !

--- /proc/scsi/scsi-----
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: Novatel  Model: Mass Storage     Rev: 1.00
  Type:   CD-ROM                           ANSI SCSI revision: 02
--------------------------
----- dmesg ----------------
uhci.c: USB Universal Host Controller Interface driver v1.1
PCI: Enabling device 01:03.0 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x100, IRQ 2
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
PCI: Enabling device 01:03.1 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x120, IRQ 2
usb.c: new USB bus registered, assigned bus number 2
hub.c: USB hub found
hub.c: 2 ports detected
usb-uhci.c: $Revision: 1.275 $ time 16:14:39 Jun  6 2008
usb-uhci.c: High bandwidth mode enabled
usb-uhci.c: v1.275:USB Universal Host Controller Interface driver
PCI: Enabling device 01:03.2 (0000 -> 0002)
ehci_hcd 01:03.2: PCI device 1106:3104
ehci_hcd 01:03.2: irq 2, pci mem c022c000
usb.c: new USB bus registered, assigned bus number 3
EHCI: Enabling VIA 6212 workarounds
ehci_hcd 01:03.2: USB 2.0 enabled, EHCI 1.00, driver 2003-Dec-29/2.4
hub.c: USB hub found
hub.c: 4 ports detected
usb.c: registered new driver serial
usbserial.c: USB Serial support registered for Generic
usbserial.c: USB Serial Driver core v1.4
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 01:03.0-1, assigned address 2
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor: Novatel   Model: Mass Storage      Rev: 1.00
  Type:   CD-ROM                             ANSI SCSI revision: 02
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
-------------------------------------------------------------
----cd //dev ; ls --------------
console   full      kmem      mem       mtdblock  nvram     ppp       pts       random    scsi      tts       urandom   zero
cua       gpio      log       mtd       null      port      ptmx      pty       root      shm       tty       usb
---------------------------------
---- lsmod --------------------
Module                  Size  Used by    Tainted: P
sg                     29252   0 (unused)
usb-storage            69632   0
usbserial              23516   0 (unused)
wlcompat                9504   0 (unused)
ehci-hcd               20556   0 (unused)
uhci                   29060   0 (unused)
sd_mod                 12500   0 (unused)
ip_conntrack_tftp       1712   0 (unused)
ip_nat_irc              2336   0 (unused)
ip_conntrack_irc        3128   1
ip_nat_ftp              2960   0 (unused)
ip_conntrack_ftp        4272   1
ipt_REDIRECT             640   0 (unused)
ipt_NETMAP               624   0 (unused)
ipt_MIRROR              1296   0 (unused)
ipt_TOS                  976   0 (unused)
ipt_TTL                  944   0 (unused)
ipt_MARK                 592   0 (unused)
ipt_ECN                 1616   0 (unused)
ipt_DSCP                 960   0 (unused)
ipt_CLASSIFY             704   0 (unused)
ipt_unclean             6832   0 (unused)
ipt_ttl                  496   0 (unused)
ipt_tos                  304   0 (unused)
ipt_time                1544   0 (unused)
ipt_tcpmss               656   0 (unused)
ipt_mark                 304   0 (unused)
ipt_mac                  544   0 (unused)
ipt_length               336   0 (unused)
ipt_ecn                  656   0 (unused)
ipt_dscp                 304   0 (unused)
ipt_string              3240   0 (unused)
ipt_layer7             10704   0 (unused)
ipt_ipp2p               7320   0 (unused)
ipt_LOG                 3792   0 (unused)
ipt_pkttype              288   0 (unused)
ipt_owner               1280   0 (unused)
ipt_condition           1360   0 (unused)
ipt_CONNMARK             816   0 (unused)
ipt_recent              8208   0 (unused)
ipt_helper               560   0 (unused)
ipt_conntrack           1104   0 (unused)
ipt_connmark             352   0 (unused)
ipt_connbytes           1168   0 (unused)
ppp_async               8044   0 (unused)
ppp_generic            22380   0 [ppp_async]
slhc                    6064   0 [ppp_generic]
vfat                   11340   0 (unused)
fat                    34448   0 [vfat]
isofs                  19872   0 (unused)
wl                    666224   0 (unused)
nls_iso8859-1           2672   0 (unused)
usbcore                71296   1 [usb-storage usbserial ehci-hcd uhci]
scsi_mod               66048   3 [sg usb-storage sd_mod]
switch-robo             5052   0 (unused)
switch-core             4928   0 [switch-robo]
diag                   28736   0 (unused)
-----------------------------------------------------------------------
--- cat /proc/scsi/usb-storage-0/0 -------------
   Host scsi0: usb-storage
       Vendor: Novatel Wireless
      Product: Novatel Wireless HSUPA Modem
Serial Number: 356846010747010
     Protocol: Transparent SCSI
    Transport: Bulk
         GUID: 141050100356846010747010
     Attached: Yes
-----------------------------------------------------

(Last edited by doddel on 6 Jun 2008, 21:26)

i'm struggling with EXACTLY THE SAME PROBLEM.


anyone?

in the mean time have also made a 2.6 compile, just for the experiment as it won't work with the broadcom radio as an AP, and adapted the airprime.c module to recognize the HSUPA modem device 1410:4400. Latter works fine once the module has switched its identity from cdrom to modem after the wait and then /dev/ttyUSB0 etc. show up.
But the initial cdrom issue is not resolved. The 1410:5010 device gives following effect:
------------ dmesg ------------------
usb 1-1: new full speed USB device using uhci_hcd and address 6
usb 1-1: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 6
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: CD-ROM            Novatel  Mass Storage     1.00 PQ: 0 ANSI: 2
scsi 2:0:0:0: Attached scsi generic sg0 type 5
usb-storage: device scan complete
-----------------------------------------
the /dev/sg0 shows but cannot be mounted (mount: mounting /dev/sg0 on /mnt/cdrom failed: Block device required) or ejected
(eject: //dev/sg0: Operation not permitted).
Perhaps cdrom drivers are required but where are they in OpenWrt ? I did compile and load the isofs file system module.
Anybody with ideas how to tackle this further in OpenWrt 2.4 or 2.6 so an eject command can be given to this usb device that mimicks a cdrom for an annoyingly long time before becoming a modem.

Have given the Novatel stick a try on a laptop with Debian and there the CDROM is mounted (but the modem later not recognised).
In Debian Etch it is not /dev/sg0 that gets made but /dev/sr0 and there are modules present 'cdrom' and 'sr_mod'. As file system UDF-fs gets used.
So the solution is probably either to compile those into OpenWrt, or to figure out a way to give out a command per scsi/sg0 that amounts to 'eject'. After all we don't want access to the storage but want to switch the stick to its modem function.

(Last edited by doddel on 8 Jun 2008, 14:29)

in 2.6 compile found this solution to the problem:

in 'make menuconfig' include the utility 'sdparm'. (utilities/disc/sdparm)

Upon connection of the usb stick issue from 'sdparm' the command eject. And gone is the CDROM and there comes the modem ....

root@OpenWrt:/# sdparm --command=eject //dev/sg0
    //dev/sg0: Novatel  Mass Storage  1.00  [cd/dvd]

This utility just issues commands on the scsi bus and that's enough for our purpose.

In 2.4 following command works along the same lines but we need to point at the precise scsi node:
root@OpenWrt:/# sdparm --command=eject /dev/scsi/host0/bus0/target0/lun0/generic

and after that dmesg shows:
usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB1 (or usb/tts/1 for devfs)

Latest update:
Of course the problem has been encountered before.
Just found this link that provides 2.6 code for a series of G3 adapters.
http://www.draisberghof.de/usb_modeswitch/

Assuming Kamikaze linux 2.4 on the Asus WL400gp v1 (broadcom mini-pci radio) and the presence of sdparm, the following hotplug script will switch the MC950D device to being modem when booting or connecting it:

---------- //etc/hotplug.d/usb/20-novatel_switch ----------
#!/bin/sh

case "$ACTION" in
    add)
        ( //usr/sbin/lsusb | grep -q '1410:5010' ) && {
            /usr/bin/sdparm --command=eject /dev/scsi/host0/bus0/target0/lun0/generic
        }
        ;;
esac
------------------------------------------------------------------

(Last edited by doddel on 8 Jun 2008, 21:13)

The discussion might have continued from here.