Voy a repaquetizar por si a alguien le sirve. Hay mucha info por ahi, pero esta troceada. Voy a tratar de recompliar todo lo que se.
Router con openwrt 15.05 (puede haber diferencias en otras versiones, ¿cuales? no se)
Pincho Huawei K3520 (que tiene famila con el E169)
Bandas del K3520
Bandas
850 MHz
900 Mhz
1800 MHz
1900 MHz
2100 MHz
1º probar que el pincho usb k3520 funciona. Pinchalo en el pc.
Empieza a parpadear en verde.
Te pedirá el PIN.
Parpadea en azul.
Cuando se conecta estará entre verde-azul fijo.
En (
http://manuales.vodafone.es/web/huawei-k3520/specifications/) se explica mejor:
Secuencia intermitente
GPRS (GSM/GPRS/EDGE) registrado Luz verde intermitente
GPRS conectado Luz verde constante
3G (WCDMA/HSDPA) registrado Luz azul intermitente
WCDMA conectado Luz azul constante
HSDPA conectado Luz turquesa (ciano) constante
Sin cobertura Luz VERDE parpadea dos veces
2º pincharlo en el router.opkg update
opkg install kmod-usb2 kmod-usb-ohci kmod-usb-uhci chat comgt usb-modeswitch kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan luci-proto-3g usbutilsAqui puede pasar algo. Si el router esta sin conexion a internet, habrá que darsela. Ya sea por cable o por wifi.
En mi caso, como no tengo adsl, lo que hice fue darle internet al router con el movil.
Configuré el router para ser "cliente". Hay un tuto en esta web. Busca "repetidor/cliente/wds".
3º comprobar que el router lo reconocelsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
vale, lo ha reconocido. Quedate con los numeros...
12d1:1001dmesg | grep usb[ 4.616000] usbcore: registered new interface driver usbfs
[ 4.624000] usbcore: registered new interface driver hub
[ 4.628000] usbcore: registered new device driver usb
[ 5.372000] usb 2-1: new full-speed USB device number 2 using ohci-platform
[ 15.540000] usbcore: registered new interface driver usbserial
[ 15.544000] usbcore: registered new interface driver usbserial_generic
[ 15.552000] usbserial: USB Serial support registered for generic
[ 16.024000] usbcore: registered new interface driver option
[ 16.032000] usbserial: USB Serial support registered for GSM modem (1-port)
[ 16.048000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 16.060000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 16.076000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
Uno de los grandes problemas con estas cosas es que, crea tres intarfaces usb y no sabes cual es.
Si pruebas una, no funcian, y cambias sin hacer reboot en el router, no funcionará aunque pongas la correcta.
Este comando ayuda.
Si os fijais, hay tres trozos. Tres interfaces.
lsusb -v -d 12d1:1001Bus 002 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x12d1 Huawei Technologies Co., Ltd.
idProduct 0x1001 E169/E620/E800 HSDPA Modem
bcdDevice 0.00
iManufacturer 1 ???????????????????
iProduct 2 HUAWEI Mobile
iSerial 1 ???????????????????
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 85
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
-------------------------------------------------
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 3 Data Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 128
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
-------------------------------------------------
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 3 Data Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
-------------------------------------------------
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 3 Data Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0002
(Bus Powered)
Remote Wakeup Enabled
Hay bInterfaceNumber 0, 1 y 2
La interface 0 tiene NumEndpoints 3 (IN, IN, OUT), mientras que las otras tienen 2 (IN, OUT) [EndPointAddress]
Por eso se sabe que la interface para hacer la conexion es la 0 y en consecuencia ttyUSB0
(insisto, no cambies la configuracion sin reiniciar)
4º Configuracion de redvi /etc/config/networkconfig interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd2e:fe2e:fd36::/48'
config interface 'lan'
option ifname 'eth0.1'
option force_link '1'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.2.1'
option gateway '192.168.2.1'
config switch
option name 'eth0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'eth0'
option vlan '1'
option ports '0 1 2 3 8t'
config interface '3g'
option proto '3g'
option service 'umts'
option apn 'internet'
option pincode '1234'
option dialnumber '*99#'
option device '/dev/ttyUSB0'
Por supuesto, hay que ajustar el pin, y el dialnumber (que puede ser *99***1#)
El APN de Yoigo es 'internet' y no tiene usuario ni contraseña.
Las demas de las cosas dejarlas por defecto.
5º Ajuste de firewallvi /etc/config/firewall
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option network 'lan'
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 wwan 3g'
... la lista sigue, pero es la que tiene por defecto
6º editar el script de lo comandos AT del modemMuchas veces no se conectaba y me decia NO CARRIER. Con esta modificacion funcionó bien.
vi /etc/chatscript/3g.chatABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" "AT&F"
OK "ATE1"
OK 'AT+CGDCONT=1,"IP","$USE_APN"'
SAY "Calling UMTS/GPRS"
TIMEOUT 22
OK 'AT+COPS=1,2,"21404",2'
OK "ATD$DIALNUMBER"
CONNECT ' '
Tuve que añadir la linea
OK 'AT+COPS=1,2,"21404",2' porque mi tarjeta es de yoigo.
Explico unas cosas de los comandos AT
La primera columna es lo que espera, lo que escuchará. Si lo escucha, hace el comando de la segunda columna.
ej
OK AT
Si escucha OK, realiza un AT
Si pone "", es que le da igual lo que escuche.
Hay comandos interesantes. Por ejemplo:
AT+COPS? pregunta que redes disponibles hay (si no se ha conectado a ninguna)
(2,"Yoigo","YOIGO","21404",2),
(1,"Orange","Orange","21403",0),
(1,"Orange","Orange","21403",2),
(1,"movistar","movistar","21407",0),
(1,"movistar","movistar","21407",2),
(3,"vodafone ES","voda ES","21401",0),
(3,"vodafone ES","voda ES","21401",2),
,(0,1,2,3,4),(0,1,2)^M
AT+COPS=? se desconecta de donde esté conectado
AT+COPS=
1,0,"Yoigo",2 (=1,0) Implica que la red a la que nos conectamos se escribe con alfanumericos ("Yoigo")
AT+COPS=
1,1,"YOIGO",2 (=1,1) Implica que la red a la que nos conectamos se escribe con alfanumericos largos ("YOIGO")
AT+COPS=
1,2,"21404",2' (=1,2) Implica que la red a la que nos conectamos se escribe con el numero de red ("21404")
Si se tiene otro operador de red de SIM, pues adaptarlo a lo que sea.
El ,2 del final realmente no se que es...
Aqui lo detallan un poco mas (
https://m2msupport.net/m2msupport/atcops-plmn-selection/)
7º comprobar que la conexion se realizalogread -fifconfig muestra si las interfaces estan ok
8º a DisfrutarReboot y en teoria debira de funcionar
PD: puede ser util hacer un
ifdown 3g
ifup 3g
gcom info -d /dev/ttyUSB0PD2: consejos para usar "vi"
i introduce texto, permite editar
d borra linea entera
wq escribe y sale
q! escribe sin salvar nada
PD3: consejos pc
putty desde el pc sirve para conectarse al router
desde consola, con el modem 3g en el pc, puedes escribir
screen /dev/ttyUSB0 115200 y probar los comandos AT
Si tienes un conversor TTL, el router ASL-26555 funciona a 57600
PD4:
Aqui hay info que sirve de guia
https://wiki.openwrt.org/doc/recipes/3gdonglehttps://foro.seguridadwireless.net/openwrt/(tutorial)-openwrt-y-usb-3g/140/Pero, a veces, es liosa...
Aqui, info sobre otros chatscripts (
https://github.com/zikusooka/ppp-ug/blob/master/chat-script.sh)
Aqui dan info sobre otro chatscript (
https://foro.seguridadwireless.net/openwrt/(tutorial)-openwrt-y-usb-3g/80/)
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" ATQ0
OK-AT-OK ATZ
OK-AT-OK ATI
OK ATZ
OK-AT-OK ATX0
TIMEOUT 60
"" "AT&F"
OK "ATE1"
OK 'AT+CGDCONT=1,"IP","$USE_APN"'
SAY "Calling UMTS/GPRS"
TIMEOUT 30
OK "ATD*99***1#"
CONNECT ' '
ATI da info
AT+CPIN=1234 para meter el pin de la SIM manualmente
PD5: Añado el 20 de agosto este comando
AT&V (pregunta todos los comandos AT disponible del modem)
AT&V
&C: 1;
&D: 2;
&E: 0;
&F: 0;
&S: 0;
&W: 0;
E: 1;
L: 0;
M: 0;
Q: 0;
V: 1;
X: 4;
Z: 0;
\Q: 3;
\S: 0;
\V: 0;
S0: 0;
S2: 43;
S3: 13;
S4: 10;
S5: 8;
S6: 2;
S7: 50;
S8: 2;
S9: 6;
S10: 14;
S11: 95;
S30: 0;
S103: 1;
S104: 1;
+FCLASS: 0;
+ICF: 3,3;
+IFC: 2,2;
+IPR: 115200;
+DR: 0;
+DS: 0,0,2048,6;
+WS46: 12;
+CBST: 0,0,1;
+CRLP: (61,61,48,6,0),(61,61,48,6,1),(240,240,52,6,2);
+CV120: 1,1,1,0,0,0;
+CHSN: 0,0,0,0;
+CSSN: 0,0;
+CREG: 0;
+CGREG: 0;
+CFUN:;
+CSCS: "IRA";
+CSTA: 129;
+CR: 0;
+CRC: 0;
+CMEE: 1;
+CGDCONT: (1,"IP","internet","0.0.0.0",0,0),(2,"IPV6","internet","0.0.0.0",0,0);
+CGDSCONT: ;
+CGTFT: ;
+CGEQREQ: (1,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(2,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(3,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(4,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(5,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(6,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(7,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(8,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(9,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(10,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(11,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(12,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(13,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(14,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(15,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(16,2,0,0,0,0,2,0,"0E0","0E0",3,0,0);
+CGEQMIN: ;
+CGQREQ: ;
+CGQMIN: ; ;
+CGEREP: 0,0;
+CGCLASS: "B";
+CGSMS: 1;
+CSMS: 0;
+CMGF: 0;
+CSAS: 0;
+CRES: 0;
+CSCA: "+34622996111",145;
+CSMP: ,,0,0;
+CSDH: 0;
+CSCB: 0,"","";
+FDD: 0;
+FAR: 0;
+FCL: 0;
+FIT: 0,0;
+ES: ,,;
+ESA: 0,,,,0,0,255,;
+CMOD: 0;
+CVHU: 1; ;
+CPIN: ��������,��������;
+CMEC: 0,0,0;
+CKPD: 1,1;
+CGATT: 0;
+CGACT: 0;
+CPBS: "SM";
+CPMS: "SM","SM","SR";
+CNMI: 0,0,0,0,0;
+CMMS: 2;
+FTS: 0;
+FRS: 0;
+FTH: 3;
+FRH: 3;
+FTM: 96;
+FRM: 96;
+CCUG: 0,0,0;
+COPS: 1,0,"";
+CUSD: 0;
+CAOC: 1;
+CCWA: 0;
+CCLK: "";
+CLVL: 2;
+CMUT: 0;
+CPOL: 0,2,"",0,0,0;
+CPLS: 0;
+CTZR: 0;
+CTZU: 0;
+CLIP: 0;
+COLP: 0;
+CDIP: 0;
+CLIR: 0;
^PORTSEL: 0;
^CPIN: ��������,��������;
^ATRECORD: 0;
^FREQLOCK: 12862556,12864140;
^CVOICE: 0;
^DDSETEX: 0
Curiosamente, no devuelve el CSQ (signal quality) aunque si que exite, tampoco el AT^U2DIAG ni AT^SYSCFG...

Gracias a todos por el apoyo. Espero que esta guia ayude a otros
S2