Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

se dobbiamo aggiungere una pennetta usb, dobbiamo capire un po' cosa vogliamo fare :

le pennette usb umts , finora ne ho trovate di tre tipi,

le piu' nuove ( ho una 19d2:1405 ZTE WCDMA Technologies MSM tim umts 42.2 mb ZTE MF730M NMU 769389) , non hanno di bisogno di molto, switchano in automatico da sole dopo 5 secondi e vengono viste come un' interfaccia di rete dal nome usb0

basta installare

opkg install kmod-usb-net-cdc-ether

e subito dopo col comando ifconfig usb0 la vediamo


usb0      Link encap:Ethernet  HWaddr 02:0C:E7:0B:01:02  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

a questo punto, modifichiamo il file /etc/config/network nella sezione wan dicendogli l' interfaccia ifname da usare

config interface 'wan'
        option proto 'dhcp'
        option ifname 'usb0'

riavviamo la rete

/etc/init.d/network restart

ed ecco che ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 02:0C:E7:0B:01:02  
          inet addr:192.168.0.136  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::c:e7ff:fe0b:102/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2182 (2.1 KiB)  TX bytes:1976 (1.9 KiB)

ci restituisce un' indirizzo ip , la chiavetta sara 192.168.0.1

chiavetta tim cdc ethernet

in questo caso non c'e' la sim inserita .....

 

le piu' vecchie (provate fino a 21.1 mb), quando inserite vengono viste come un cdrom o altro dispositivo non utile alla connessione e bisogna farle switchare (commutare) nello stato giusto

provate :

HUAWEI E1820 14.4 mb NMU 468009 

OLIVETTI 21.1 mb NMU 767567 

 

possiamo vedere in che stato sono leggendo il loro usb id con il comando lsusb

per farle switchare, avremo di bisogno di un software aggiuntivo, usbmodeswitch

opkg install usb-modeswitch

 

inoltre dopo essersi commutate nella modalita' seriale, bisogna far spuntare i dispositivi seriali ( di solito 3)


nello stato attuale mancano i device /dev/ttyU*

https://wiki.openwrt.org/doc/recipes/3gdongle

 

opkg install kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan

 

ls -l /dev/ttyU*  (OLIVETTI)
crw-r--r--    1 root     root      188,   0 Feb 25 09:17 /dev/ttyUSB0
crw-r--r--    1 root     root      188,   1 Feb 25 09:17 /dev/ttyUSB1
crw-r--r--    1 root     root      188,   2 Feb 25 09:17 /dev/ttyUSB2
crw-r--r--    1 root     root      188,   3 Feb 25 09:17 /dev/ttyUSB3

logread -f

Thu Feb 25 09:20:41 2016 kern.info kernel: [ 1396.368000] usb 2-1: new full-speed USB device number 9 using ohci-platform
Thu Feb 25 09:20:41 2016 kern.info kernel: [ 1396.572000] usb 2-1: not running at top speed; connect to a high speed hub
Thu Feb 25 09:20:42 2016 kern.info kernel: [ 1397.348000] usb 2-1: USB disconnect, device number 9
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.360000] usb 2-1: new full-speed USB device number 10 using ohci-platform
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.564000] usb 2-1: not running at top speed; connect to a high speed hub
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.596000] option 2-1:1.2: GSM modem (1-port) converter detected
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.600000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.616000] option 2-1:1.3: GSM modem (1-port) converter detected
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.620000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.632000] option 2-1:1.4: GSM modem (1-port) converter detected
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.640000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.652000] option 2-1:1.5: GSM modem (1-port) converter detected
Thu Feb 25 09:20:43 2016 kern.info kernel: [ 1398.660000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB3

 

ls -l /dev/ttyU* (HUAWEI)
crw-r--r--    1 root     root      188,   0 Feb 25 09:19 /dev/ttyUSB0
crw-r--r--    1 root     root      188,   1 Feb 25 09:19 /dev/ttyUSB1
crw-r--r--    1 root     root      188,   2 Feb 25 09:19 /dev/ttyUSB2

logread -f

hu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.128000] usb 2-1: new full-speed USB device number 8 using ohci-platform
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.332000] usb 2-1: not running at top speed; connect to a high speed hub
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.360000] option 2-1:1.0: GSM modem (1-port) converter detected
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.364000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.376000] option 2-1:1.3: GSM modem (1-port) converter detected
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.384000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.392000] option 2-1:1.4: GSM modem (1-port) converter detected
Thu Feb 25 09:19:27 2016 kern.info kernel: [ 1322.400000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2

 

a questo punto possiamo installare il protocollo 3G , che si portera' dietro anche il comando comgt per dialogare con la chiavetta e la sim, e chat per i comandi AT delle chiavette

opkg install luci-proto-3g

 

su internet ho trovato che dipende dalla pennetta potrebbe esser necessario al posto di

kmod-usb-serial-wwan installare  kmod-usb-acm non e' questo il nostro caso, non va' usato


passiamo quindi a creare l' interfaccia ibox - umts , e assegnarla al firewall wan

 

nano /etc/config/network e aggiungiamo la sezione

config interface 'ibox'
option proto '3g'
option device '/dev/ttyUSB0'
option service 'umts'
option apn 'ibox.tim.it'
option ipv6 'auto'

 

leviamo dalla sezione wan il dhcp e riavviamo

con logread -f possiamo vedere tutto il dialogo

Thu Feb 25 09:34:07 2016 local2.info chat[4456]: timeout set to 10 seconds
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: send (AT&F^M)
Thu Feb 25 09:34:07 2016 daemon.notice netifd: Interface 'wan' is now up
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: expect (OK)
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: AT&F^M^M
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: OK
Thu Feb 25 09:34:07 2016 local2.info chat[4456]:  -- got it
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: send (ATE1^M)
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: expect (OK)
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: ^M
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: ATE1^M^M
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: OK
Thu Feb 25 09:34:07 2016 local2.info chat[4456]:  -- got it
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: send (AT+CGDCONT=1,"IP","ibox.tim.it"^M)
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: timeout set to 30 seconds
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: expect (OK)
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: ^M
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: AT+CGDCONT=1,"IP","ibox.tim.it"^M^M
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: OK
Thu Feb 25 09:34:07 2016 local2.info chat[4456]:  -- got it
Thu Feb 25 09:34:07 2016 local2.info chat[4456]: send (ATD*99***1#^M)
Thu Feb 25 09:34:08 2016 local2.info chat[4456]: expect (CONNECT)
Thu Feb 25 09:34:08 2016 local2.info chat[4456]: ^M
Thu Feb 25 09:34:08 2016 local2.info chat[4456]: ATD*99***1#^M^M
Thu Feb 25 09:34:08 2016 local2.info chat[4456]: CONNECT
Thu Feb 25 09:34:08 2016 local2.info chat[4456]:  -- got it
Thu Feb 25 09:34:08 2016 local2.info chat[4456]: send ( ^M)
Thu Feb 25 09:34:08 2016 daemon.info pppd[4420]: Serial connection established.
Thu Feb 25 09:34:08 2016 kern.info kernel: [ 2203.188000] 3g-ibox: renamed from ppp0
Thu Feb 25 09:34:08 2016 daemon.info pppd[4420]: Using interface 3g-ibox
Thu Feb 25 09:34:08 2016 daemon.notice pppd[4420]: Connect: 3g-ibox <--> /dev/ttyUSB0
Thu Feb 25 09:34:09 2016 user.notice firewall: Reloading firewall due to ifup of wan (wlan0)
Thu Feb 25 09:34:13 2016 daemon.warn pppd[4420]: Could not determine remote IP address: defaulting to 10.64.64.64
Thu Feb 25 09:34:13 2016 daemon.notice pppd[4420]: local  IP address 10.61.104.52
Thu Feb 25 09:34:13 2016 daemon.notice pppd[4420]: remote IP address 10.64.64.64
Thu Feb 25 09:34:13 2016 daemon.notice pppd[4420]: primary   DNS address 10.204.57.104
Thu Feb 25 09:34:13 2016 daemon.notice pppd[4420]: secondary DNS address 10.205.41.16
Thu Feb 25 09:34:13 2016 daemon.notice netifd: Network device '3g-ibox' link is up
Thu Feb 25 09:34:13 2016 daemon.notice netifd: Interface 'ibox' is now up
Thu Feb 25 09:34:13 2016 daemon.info dnsmasq[4453]: reading /tmp/resolv.conf.auto
Thu Feb 25 09:34:13 2016 daemon.info dnsmasq[4453]: using local addresses only for domain lan
Thu Feb 25 09:34:13 2016 daemon.info dnsmasq[4453]: using nameserver 10.204.57.104#53
Thu Feb 25 09:34:13 2016 daemon.info dnsmasq[4453]: using nameserver 10.205.41.16#53

 

essendo che abbiamo chiamato questa nuova interfaccia "ibox" il firewall non ha idea che sia un' interfaccia wan, quindi dobbiamo dirglielo, editiamo il file firewall e aggiungiabo ibox tra le interfacce wan nella sezione zone

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        option network 'wan wan6 ibox'

 

 

a questo punto, siamo riusciti a navigare

 

davide@debian:~$ traceroute -n -q 1 -w 1 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  10.9.8.1  133.958 ms
 2  192.168.30.254  153.766 ms
 3  80.19.217.37  183.796 ms
 4  172.17.152.49  193.768 ms
 5  172.19.243.141  253.746 ms
 6  93.186.128.241  263.728 ms
 7  72.14.196.141  323.898 ms
 8  209.85.254.107  323.880 ms
 9  8.8.8.8  323.977 ms

 fin qui' abbiamo giocato facile, la stessa cosa non e' per la chiavetta OLIVETTI, purtroppo non sono riuscito a farla funzionare in maniera stabile

appena inserita la chiavetta non riesce a connetersi, se guardiamo logread otteniamo una sfilza continua di errori

Thu Feb 25 10:02:46 2016 daemon.notice netifd: Interface 'ibox' is setting up now
Thu Feb 25 10:02:48 2016 daemon.notice pppd[10522]: pppd 2.4.7 started by root, uid 0
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: abort on (BUSY)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: abort on (NO CARRIER)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: abort on (ERROR)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: report (CONNECT)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: timeout set to 10 seconds
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: send (AT&F^M)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: expect (OK)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: AT&F^M^M
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: OK
Thu Feb 25 10:02:49 2016 local2.info chat[10524]:  -- got it
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: send (ATE1^M)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: expect (OK)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: ^M
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: ATE1^M^M
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: OK
Thu Feb 25 10:02:49 2016 local2.info chat[10524]:  -- got it
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: send (AT+CGDCONT=1,"IP","ibox.tim.it"^M)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: timeout set to 30 seconds
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: expect (OK)
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: ^M
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: AT+CGDCONT=1,"IP","ibox.tim.it"^M^M
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: ERROR
Thu Feb 25 10:02:49 2016 local2.info chat[10524]:  -- failed
Thu Feb 25 10:02:49 2016 local2.info chat[10524]: Failed (ERROR)
Thu Feb 25 10:02:49 2016 daemon.err pppd[10522]: Connect script failed
Thu Feb 25 10:02:50 2016 daemon.info pppd[10522]: Exit.
Thu Feb 25 10:02:50 2016 daemon.notice netifd: Interface 'ibox' is now down

 

se proviamo ad interrogare la chiavetta otteniamo

comgt -d /dev/ttyUSB0
 ***SIM ERROR***
Check device port configuration.
Check SIM is inserted
Test SIM in a mobile phone?

 o se volete

comgt -d /dev/ttyUSB1
SIM ready
Waiting for Registration..(120 sec max).
Registered on Home network: 24, 0
Signal Quality: 8, 99

una seconda volta sulla 0 vi fara' capire che qualcosa e' successo

comgt -d /dev/ttyUSB0
comgt 10:05:36 -> -- Error Report --
comgt 10:05:36 -> ---->                       ^
comgt 10:05:36 -> Error @74, line 4, Could not write to COM device. (1)

ma mentre noi stavamo impazzendo , la connessione si e' instaurata

Thu Feb 25 10:08:04 2016 daemon.notice netifd: Interface 'ibox' is setting up now
Thu Feb 25 10:08:06 2016 daemon.notice pppd[11847]: pppd 2.4.7 started by root, uid 0
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: abort on (BUSY)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: abort on (NO CARRIER)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: abort on (ERROR)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: report (CONNECT)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: timeout set to 10 seconds
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: send (AT&F^M)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: expect (OK)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: ^M^M
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: OK
Thu Feb 25 10:08:07 2016 local2.info chat[11849]:  -- got it
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: send (ATE1^M)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: expect (OK)
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: ^M^M
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: OK
Thu Feb 25 10:08:07 2016 local2.info chat[11849]:  -- got it
Thu Feb 25 10:08:07 2016 local2.info chat[11849]: send (AT+CGDCONT=1,"IP","ibox.tim.it"^M)
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: timeout set to 30 seconds
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: expect (OK)
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: ^M
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: OK
Thu Feb 25 10:08:08 2016 local2.info chat[11849]:  -- got it
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: send (ATD*99***1#^M)
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: expect (CONNECT)
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: ^M^M
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: CONNECT
Thu Feb 25 10:08:08 2016 local2.info chat[11849]:  -- got it
Thu Feb 25 10:08:08 2016 local2.info chat[11849]: send ( ^M)
Thu Feb 25 10:08:09 2016 daemon.info pppd[11847]: Serial connection established.
Thu Feb 25 10:08:09 2016 kern.info kernel: [ 4244.324000] 3g-ibox: renamed from ppp0
Thu Feb 25 10:08:09 2016 daemon.info pppd[11847]: Using interface 3g-ibox
Thu Feb 25 10:08:09 2016 daemon.notice pppd[11847]: Connect: 3g-ibox <--> /dev/ttyUSB0
Thu Feb 25 10:08:16 2016 daemon.warn pppd[11847]: Could not determine remote IP address: defaulting to 10.64.64.64
Thu Feb 25 10:08:16 2016 daemon.notice pppd[11847]: local  IP address 10.62.253.79
Thu Feb 25 10:08:16 2016 daemon.notice pppd[11847]: remote IP address 10.64.64.64
Thu Feb 25 10:08:16 2016 daemon.notice pppd[11847]: primary   DNS address 10.204.57.104
Thu Feb 25 10:08:16 2016 daemon.notice pppd[11847]: secondary DNS address 10.205.41.16
Thu Feb 25 10:08:16 2016 daemon.notice netifd: Network device '3g-ibox' link is up
Thu Feb 25 10:08:16 2016 daemon.notice netifd: Interface 'ibox' is now up
Thu Feb 25 10:08:16 2016 daemon.info dnsmasq[4453]: reading /tmp/resolv.conf.auto
Thu Feb 25 10:08:16 2016 daemon.info dnsmasq[4453]: using local addresses only for domain lan
Thu Feb 25 10:08:16 2016 daemon.info dnsmasq[4453]: using nameserver 10.204.57.104#53
Thu Feb 25 10:08:16 2016 daemon.info dnsmasq[4453]: using nameserver 10.205.41.16#53
Thu Feb 25 10:08:16 2016 user.notice firewall: Reloading firewall due to ifup of ibox (3g-ibox)

cosa e' successo nel frattempo ???

 

 che il comando comgt ha fatto il miracolo, e quale e' il miracolo?

ha inviato alla chiavetta il comando AT+CFUN=1 , che la pone in uno stato di pieno funzionamento

AT+CFUN=0: minimal functionality [default]. AT+CFUN=1: full functionality. AT+CFUN=2: disable transmit RF circuits (not supported usually)

quindi basta variare lo script di avvio della connessione

 nano /etc/chatscripts/3g.chat inserendo sotto la riga

"" "AT&F"

OK "AT+CFUN=1"
OK "ATE1"

ora ad ogni inserimento della chiavetta la connessione partira' a primo colpo, anche se appena iniziano a transitare dati cadra ...

ho provato ad usare tutte e 4 le seriali della chiavetta

/dev/ttyUSB0  - cade

/dev/ttyUSB1 - Failed (NO CARRIER)

/dev/ttyUSB2 - expect (OK) -> alarm -> Failed

/dev/ttyUSB3 - expect (OK) -> alarm -> Failed

purtroppo con questa chiavetta quindi non potremo fare niente, e altre chiavette non ho avuto modo di testarle