OpenWrt Forum Archive

Topic: Problem with broadband modem

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

Hello!

First I want to say hello to everybody on this forum, first topic for me here!

I have a modem (D-50) that connects to the nordic mobile telephone network (www.nmt.net), there is files included for Linux.
My friend compiled this for OpenWrt Kamikaze 7.09, but it's not working! The file runs well but result is "Fail SwitchMode"

A guess that this light linux version missing something...?
Anybody that tested NMT-450 D50 modem on other linux that can help to get it running in openwrt?

I have a Asus 500gP with Kamikaze 7.09 Kernel 2.6

Sourcecode of RDEVCHG:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <scsi/sg.h>

typedef struct scsi_ioctl_command {
    unsigned int inlen;
    unsigned int outlen;
    unsigned char data[10];
} Scsi_Ioctl_Command;

#define SCSI_IOCTL_SEND_COMMAND 1
#define SCSI_IOCTL_TEST_UNIT_READY 2
#define SCSI_IOCTL_BENCHMARK_COMMAND 3
#define SCSI_IOCTL_SYNC 4            /* Request synchronous parameters */
#define SCSI_IOCTL_START_UNIT 5
#define SCSI_IOCTL_STOP_UNIT 6

#define TEST_UNIT_READY       0x00
#define REZERO_UNIT           0x01
#define REQUEST_SENSE         0x03
#define FORMAT_UNIT           0x04
#define READ_BLOCK_LIMITS     0x05
#define REASSIGN_BLOCKS       0x07
#define READ_6                0x08
#define WRITE_6               0x0a
#define SEEK_6                0x0b
#define READ_REVERSE          0x0f
#define WRITE_FILEMARKS       0x10
#define SPACE                 0x11
#define INQUIRY               0x12
#define RECOVER_BUFFERED_DATA 0x14
#define MODE_SELECT           0x15
#define RESERVE               0x16
#define RELEASE               0x17
#define COPY                  0x18
#define ERASE                 0x19
#define MODE_SENSE            0x1a
#define START_STOP            0x1b
#define RECEIVE_DIAGNOSTIC    0x1c
#define SEND_DIAGNOSTIC       0x1d
#define ALLOW_MEDIUM_REMOVAL  0x1e

#define SET_WINDOW            0x24
#define READ_CAPACITY         0x25
#define READ_10               0x28
#define WRITE_10              0x2a
#define SEEK_10               0x2b
#define WRITE_VERIFY          0x2e
#define VERIFY                0x2f
#define SEARCH_HIGH           0x30
#define SEARCH_EQUAL          0x31
#define SEARCH_LOW            0x32
#define SET_LIMITS            0x33
#define PRE_FETCH             0x34
#define READ_POSITION         0x34
#define SYNCHRONIZE_CACHE     0x35
#define LOCK_UNLOCK_CACHE     0x36
#define READ_DEFECT_DATA      0x37
#define MEDIUM_SCAN           0x38
#define COMPARE               0x39
#define COPY_VERIFY           0x3a
#define WRITE_BUFFER          0x3b
#define READ_BUFFER           0x3c
#define UPDATE_BLOCK          0x3d
#define READ_LONG             0x3e
#define WRITE_LONG            0x3f
#define CHANGE_DEFINITION     0x40
#define WRITE_SAME            0x41
#define READ_TOC              0x43
#define LOG_SELECT            0x4c
#define LOG_SENSE             0x4d
#define MODE_SELECT_10        0x55
#define RESERVE_10            0x56
#define RELEASE_10            0x57
#define MODE_SENSE_10         0x5a
#define PERSISTENT_RESERVE_IN 0x5e
#define PERSISTENT_RESERVE_OUT 0x5f
#define MOVE_MEDIUM           0xa5
#define READ_12               0xa8
#define WRITE_12              0xaa
#define WRITE_VERIFY_12       0xae
#define SEARCH_HIGH_12        0xb0
#define SEARCH_EQUAL_12       0xb1
#define SEARCH_LOW_12         0xb2
#define READ_ELEMENT_STATUS   0xb8
#define SEND_VOLUME_TAG       0xb6
#define WRITE_LONG_2          0xea


int fd;

int main(void)
{
  Scsi_Ioctl_Command sic = {0};
  char devname[32];
  int loop = 0;
  int nRdevchg = 0;
  int nCount = 0;
  int nSwitchMode = 0;
 
     
printf("RDEVCHG Linux Version : 1.0\n");
printf("Please, Wait!\n");
usleep(2000);
  for(loop = 0; loop < 10 ; loop++ )
  {
         
          sprintf(devname,"/dev/sg%d" , (loop) );
      fd = open(devname, O_RDWR);
          printf("." );

      if (fd > 0 )
      {
                  //fprintf(stderr,"/dev/sg%d - IN\n" , (loop) );
          sic.inlen = 9;
          sic.outlen = 0;
          sic.data[0] = 0xFF;
          memcpy(sic.data + 1, "RDEVCHG1", 8);

          nRdevchg = ioctl(fd, SCSI_IOCTL_SEND_COMMAND, &sic);
          close(fd);
                  if( nRdevchg == 0 )
                  {
                        usleep(2000);
                        nRdevchg = 0;
                        while( nRdevchg < 100)
                        {   
                                nRdevchg++;
                                usleep(1000);
                                if( system("lsusb | grep -i \"16D8:\"") == 0 )
                                {   
                                    printf("\nSuccess SwitchMode.\n");
                                   
                                    return 1;
                                }
                        }
                  }
      }
  }
         
  printf("\nFail SwitchMode.\n");

  return 1;
}

(Last edited by Daniel.T on 7 Mar 2008, 20:51)

Want to add some info of tests I made.

Tried both Kamikaze 2.4 and 2.6 but the file RDEVCHG compiled for openwrt stops really quick, "Fail SwitchMode".
Tested to run files included (original) on USB-Modem in Ubuntu Live-CD, RDEVCHG runs for a while and finds modem and the device is added to /dev/.

Anybody that can look on the sourcecode in my earlier post, should that work on a OpenWrt??? Or must it be changed?

Many thanks for help!

/Daniel

Hello Daniel,


I had a quick look to code what you had sent.
It looks like program is just sending SCSI command to all scsi generic device files to perform some kind of switch to modem mode. And then it verifies whether there appeared the requested new USB devices... via lsusb command.
Please try to type: lsusb at your command prompt to see whether it is available ( so maybe it successfully performs switch but it just didn't found the lsusb command)
Please post here lsusb & dmesg output.
After it performs switch you need to load usbserial kernel module (maybe it will be done autoamticaly). And then you can start PPP to do the internet connection.
If the OpenWrt doen't have automatic support for these devices (I'm really not sure about). You will need to follow few steps.
Please check gentoo wiki regarding maybe similiar modem:
http://gentoo-wiki.com/HARDWARE_HUAWEI_ … _USB_MODEM

Cheers,
Vladimir.

Thanks for help, vlx!

Now I have done the tests and here is the result. How do I load usbserial?
And how to make PPP? Original with the modem it was a file to execute after modem switch but it use wvdial? And that command is not working on openwrt?
I put the included code in the bottom of this post!!!

root@OpenWrt:~# lsusb
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 004: ID 16d8:6803
Bus 001 Device 001: ID 0000:0000


------------------


root@OpenWrt:~# dmesg
Linux version 2.6.22 (travis@localhost.localdomain) (gcc version 4.1.2) #18 Wed Mar 5 20:06:13 CST 2008
CPU revision is: 00029006
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x03, vendor 0x4243)
ssb: Core 1 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 2 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 3 found: USB 1.1 Hostdev (cc 0x808, rev 0x03, vendor 0x4243)
ssb: Core 4 found: PCI (cc 0x804, rev 0x08, vendor 0x4243)
ssb: Core 5 found: MIPS 3302 (cc 0x816, rev 0x03, vendor 0x4243)
ssb: Core 6 found: V90 (cc 0x807, rev 0x02, vendor 0x4243)
ssb: Core 7 found: IPSEC (cc 0x80B, rev 0x00, vendor 0x4243)
ssb: Core 8 found: MEMC SDRAM (cc 0x80F, rev 0x02, vendor 0x4243)
ssb: Initializing MIPS core...
ssb: set_irq: core 0x0806, irq 2 => 2
ssb: set_irq: core 0x0806, irq 3 => 3
ssb: set_irq: core 0x0804, irq 0 => 4
ssb: Sonics Silicon Backplane found at address 0x18000000
Determined physical RAM map:
memory: 02000000 @ 00000000 (usable)
Initrd not found or empty - disabling initrd
On node 0 totalpages: 8192
  Normal zone: 64 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 8128 pages, LIFO batch:0
Built 1 zonelists.  Total pages: 8128
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (31 instructions).
Synthesized TLB modify handler fastpath (30 instructions).
PID hash table entries: 128 (order: 7, 512 bytes)
Using 132.000 MHz high precision timer.
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 29872k/32768k available (2030k kernel code, 2896k reserved, 297k data, 120k init, 0k highmem)
Calibrating delay loop... 263.16 BogoMIPS (lpj=526336)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
ssb: PCIcore in host mode found
registering PCI controller with io_map_base unset
PCI: fixing up bridge
PCI: Setting latency timer of device 0000:00:00.0 to 64
PCI: Fixing up device 0000:00:00.0
Time: MIPS clocksource has been installed.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing enabled
serial8250: ttyS0 at MMIO 0x0 (irq = 3) is a 16550A
serial8250: ttyS1 at MMIO 0x0 (irq = 3) is a 16550A
b44.c:v1.01 (Jun 16, 2006)
eth0: Broadcom 10/100BaseT Ethernet 00:1d:60:15:64:8e
eth1: Broadcom 10/100BaseT Ethernet 40:10:18:00:00:2d
flash init: 0x1c000000 0x02000000
Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank
Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0
Amd/Fujitsu Extended Query Table at 0x0040
Physically mapped flash: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Flash device: 0x800000 at 0x1fc00000
bootloader size: 262144
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x007f0000 : "linux"
0x000f8000-0x007f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x00230000-0x007f0000 : "rootfs_data"
0x007f0000-0x00800000 : "nvram"
nf_conntrack version 0.5.0 (256 buckets, 2048 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 120k freed
Warning: unable to open an initial console.
Algorithmics/MIPS FPU Emulator v1.5
diag: Detected 'ASUS WL-500g Premium'
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
Probing device eth0: found!
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
BFL_ENETADM not set in boardflags. Use force=1 to ignore.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
device eth0.0 entered promiscuous mode
usbcore: registered new device driver usb
NET: Registered protocol family 8
NET: Registered protocol family 20
eth0.0: dev_set_promiscuity(master, 1)
device eth0 entered promiscuous mode
eth0.0: add 01:00:5e:00:00:01 mcast address to master interface
br-lan: port 1(eth0.0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0.0) entering forwarding state
isofs: Unknown symbol load_nls_default
isofs: Unknown symbol load_nls
isofs: Unknown symbol utf8_wctomb
isofs: Unknown symbol unload_nls
PPP generic driver version 2.4.2
wlan: 0.8.4.2 (svn r2568)
eth0.1: add 01:00:5e:00:00:01 mcast address to master interface
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.9.30.13 (AR5210, AR5211, AR5212, AR5416, RF5111, RF5112, RF2413, RF5413, RF2133, REGOPS_FUNC)
ath_rate_minstrel: Minstrel automatic rate control algorithm 1.2 (svn r2568)
ath_rate_minstrel: look around rate set to 10%
ath_rate_minstrel: EWMA rolloff level set to 75%
ath_rate_minstrel: max segment size in the mrr set to 6000 us
wlan: mac acl policy registered
ath_pci: 0.9.4.5 (svn r2568)
ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
USB Universal Host Controller Interface driver v3.0
PCI: Enabling device 0000:00:03.0 (0000 -> 0001)
PCI: Fixing up device 0000:00:03.0
uhci_hcd 0000:00:03.0: UHCI Host Controller
uhci_hcd 0000:00:03.0: new USB bus registered, assigned bus number 1
uhci_hcd 0000:00:03.0: irq 6, io base 0x00000100
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
PCI: Enabling device 0000:00:03.1 (0000 -> 0001)
PCI: Fixing up device 0000:00:03.1
uhci_hcd 0000:00:03.1: UHCI Host Controller
uhci_hcd 0000:00:03.1: new USB bus registered, assigned bus number 2
uhci_hcd 0000:00:03.1: irq 6, io base 0x00000120
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
PCI: Enabling device 0000:00:03.2 (0000 -> 0002)
PCI: Fixing up device 0000:00:03.2
ehci_hcd 0000:00:03.2: EHCI Host Controller
ehci_hcd 0000:00:03.2: new USB bus registered, assigned bus number 3
ehci_hcd 0000:00:03.2: irq 6, io mem 0x40000000
ehci_hcd 0000:00:03.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 4 ports detected
usbcore: registered new interface driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
SCSI subsystem initialized
Initializing USB Mass Storage driver...
usb 1-1: new full speed USB device using uhci_hcd and address 3
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Linux video capture interface: v2.00
drivers/usb/serial/usb-serial.c: USB Serial support registered for airprime
usbcore: registered new interface driver airprime
drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1
usbcore: registered new interface driver quickcam
usb 1-1: USB disconnect, address 3
usb 1-1: new full speed USB device using uhci_hcd and address 4
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
scsi 0:0:0:0: CD-ROM            CMOTECH  Mass Storage     2.31 PQ: 0 ANSI: 0 CCS
scsi 1:0:0:0: Direct-Access     CMOTECH  Mass Storage     2.31 PQ: 0 ANSI: 6
usb-storage: device scan complete
sd 1:0:0:0: [sda] 102401 512-byte hardware sectors (52 MB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 0b 00 00 08
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] 102401 512-byte hardware sectors (52 MB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 0b 00 00 08
sd 1:0:0:0: [sda] Assuming drive cache: write through
sda: unknown partition table
sd 1:0:0:0: [sda] Attached SCSI removable disk
usb-storage: device scan complete
root@OpenWrt:~#




--------

execute.sh:

echo "--> D-50 Linux Connection\n"
rm -rf D-50config wvdialconf_log
wvdialconf D-50config > wvdialconf_log
echo "Carrier Check= no\nStupid Mode= yes" >> D-50config
echo "Phone = #777\nUsername = UserID\nPassword = password" >> D-50config
rm -rf wvdialconf_log
echo "--> Dialing...\n"
wvdial --config D-50config

Need more help!

How do I load usbserial to be used with the found modem?
And how to make PPP under OpenWrt?

Original with the modem it was a file to execute after modem switch but it use wvdial? And that command is not working on openwrt?
I put the included code in the bottom of this post!!!

root@OpenWrt:~# lsusb
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 004: ID 16d8:6803   <---- Modem
Bus 001 Device 001: ID 0000:0000



execute.sh:

echo "--> D-50 Linux Connection\n"
rm -rf D-50config wvdialconf_log
wvdialconf D-50config > wvdialconf_log
echo "Carrier Check= no\nStupid Mode= yes" >> D-50config
echo "Phone = #777\nUsername = UserID\nPassword = password" >> D-50config
rm -rf wvdialconf_log
echo "--> Dialing...\n"
wvdial --config D-50config

The discussion might have continued from here.