Outils pour utilisateurs

Outils du site


configuration_d_une_cle_4g_lte

Ceci est une ancienne révision du document !


Installation et configuration d'une clé 4G LTE

Modèle choisi

D-Link, Model:DWM-221. La datasheet et le manuel d'utilisateur sont accessibles sur dlink.com.

Installation

pi@raspberrypi(rw):~$ lsusb
Bus 001 Device 010: ID 2001:a401 D-Link Corp.
pi@raspberrypi(rw):~$ sudo lsusb -v -s 001:010
 
Bus 001 Device 010: ID 2001:a401 D-Link Corp. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x2001 D-Link Corp.
  idProduct          0xa401 
  bcdDevice            2.32
  iManufacturer           1 Mobile Connect
  iProduct                2 Mobile Connect
  iSerial                 3 0123456789ABCDEF
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              4 Mass Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

On ajoute ces quatre lignes dans le fichier :

Je ne sais pas s'il faut utiliser le fichier usb_modeswitch.conf finalement…

$ sudo nano /etc/usb_modeswitch.conf
$ sudo cat /etc/usb_modeswitch.conf
(...)
DefaultVendor=0x2001
DefaultProduct=0xa401
MessageEndpoint="0x01"
MessageContent="55534243123456780000000000000011062000000101000100000000000000"

On utilise la commande usb_modeswitch avec ces arguments (trouvé sur ce forum (draisberghof.de)). Je n'ai pas très bien compris où on peut trouver les trois “messages” qu'on envoie (55534…), je me suis contenté de copier/coller.

pi@raspberrypi(rw):~$ sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
Take all parameters from the command line
 
 
 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.0 (C) Josua Dietze 2014
 * Based on libusb1/libusbx
 
 ! PLEASE REPORT NEW CONFIGURATIONS !
 
DefaultVendor=  0x2001
DefaultProduct= 0xa401
MessageContent="555342435b000000000000000001061e000000000000000000000000000000"
MessageContent2="555342435c000000000000000001061b000000010000000000000000000000"
MessageContent3="555342435d000000000000000001061b000000020000000000000000000000"
NeedResponse=1
 
Look for default devices ...
  found USB ID 2001:a401
   vendor ID matched
   product ID matched
  found USB ID 0a5c:bd1e
  found USB ID 0483:2016
  found USB ID 04b3:3021
  found USB ID 04b3:3022
  found USB ID 0424:ec00
  found USB ID 0424:9514
  found USB ID 1d6b:0002
 Found devices in default mode (1)
Access device 012 on bus 001
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)
 
USB description data (for identification)
-------------------------
Manufacturer: Mobile Connect
     Product: Mobile Connect
  Serial No.: 0123456789ABCDEF
-------------------------
Looking for active driver ...
 No active driver found. Detached before or never attached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response successfully read (13 bytes).
Trying to send message 2 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 2 (CSW) ...
 Response successfully read (13 bytes).
Trying to send message 3 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 3 (CSW) ...
 Response successfully read (13 bytes).
Reset response endpoint 0x81
Reset message endpoint 0x01
-> Run lsusb to note any changes. Bye!
 
pi@raspberrypi(rw):~$ lsusb 
Bus 001 Device 013: ID 2001:7e19 D-Link Corp. 
Bus 001 Device 005: ID 0a5c:bd1e Broadcom Corp. 
Bus 001 Device 011: ID 0483:2016 STMicroelectronics Fingerprint Reader
Bus 001 Device 010: ID 04b3:3021 IBM Corp. 
Bus 001 Device 009: ID 04b3:3022 IBM Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi(rw):~$ dmesg | grep ttyUSB
[  806.074853] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0
[  806.075897] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1
[  806.076943] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2
[  806.077874] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB3

J'ai un problème quand j'essaye de me connecter parce que je n'ai pas pu mettre le code pin. J'ai donc suivi ce tutoriel (john.de-graaff.net) pour mettre le code pin, me connecter et finalement supprimer l'authentification par code pin (pour ne plus avoir besoin de le faire manuellement!).

$ sudo apt-get install minicom

J'ai configuré minicom pour les quatre ttyUSB*, j'ai trouvé le baurdate via un développeur chinois

pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB0
pu port		/dev/ttyUSB0
pu baudrate	115200
pu bits		8
pu parity	N
pu stopbits	1
pu minit	ATZ
pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB1
pu port		/dev/ttyUSB1
pu baudrate	115200
pu bits		8
pu parity	N
pu stopbits	1
pu minit	ATZ
pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB2
pu port		/dev/ttyUSB2
pu baudrate	115200
pu bits		8
pu parity	N
pu stopbits	1
pu minit	ATZ
pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB3
pu port		/dev/ttyUSB3
pu baudrate	115200
pu bits		8
pu parity	N
pu stopbits	1
pu minit	ATZ

Connexion!!

pi@raspberrypi(rw):~$ sudo minicom ttyUSB2
Bienvenue avec minicom 2.7
 
OPTIONS: I18n 
Compilé le Jan 12 2014, 05:42:53.
Port /dev/ttyUSB2, 19:07:44
 
Tapez CTRL-A Z pour voir l'aide concernant les touches spéciales
 
ATZ    
OK
 
CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7 | VT102 | Connecté 0:0 | ttyUSB2

Une fois dans minicom, connecté au modem, on peut essayer plein de choses :

ATI
Manufacturer: 
Model: +CGMM: DWM-221
Revision: 2.3.2
IMEI: 353880061962187
+GCAP: +CGSM,+FCLASS,+DS
 
OK

Mettre le code pin (1234 n'est pas mon vrai code…) :

AT+CPIN="0000"
+CME ERROR: incorrect password
AT+CPIN="1234"
OK

Ne plus demander le code pin dans le futur pour se connecter :

AT+CLCK="SC",0,"1234"                                                           
OK

Réactiver la demande du code pin :

AT+CLCK="SC",1,"1234"                                                           
OK

Voir si la demande du code pin est activée (CLCK: 1) ou désactivée (CLCK: 0) :

AT+CLCK="SC",2                                                                  
+CLCK: 0 

Force du signal (5 à 22) :

AT+CSQ
+CSQ: 15,99
 
OK
AT&V
&C: 2; &D: 2; &E: 0; &F: 0; &S: 0; &W: 0; E: 1; L: 0; M: 0; Q: 0; V: 1;
X: 0; Z: 0; \Q: 3; \S: 0; \V: 0; O: 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; +CMEE: 2; +WS46: 12; +CFUN:; +BMSETCUSTVER: ;
+BMEFSVER: ; +BMCGMR: 1158590976; +BMGMI: 1158590968; +QCGMI: 1158590968;
+BMGMM: 1158590960; +QCGMM: 1158590960; +BMCALLEN: 0; +BMMODODR: 2;
+BMSN: ""; +QCSN: ""; +BMIMEI: 1158590936;  +QCIMEI: 1158590936;
+BMESN: 1158590928; +BMMEID: 1158590920; +BMTFLAG: ; +BMCK: 1158590912;
+BMPCMLOOP: 0; +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;
+CEREG: 0; +CSCS: "IRA"; +CSTA: 129; +CR: 0; +CRC: 0;
+CGDCONT: (1,"IPV4V6","","0.0.0.0",0,0); +CGDSCONT: ; +CGTFT: ;
+CGEQREQ: ; +CGEQMIN: ; +CGEQOS: ; +CGQREQ: ; +CGQMIN: ; +CGEREP: 0,0;
+CGDATA: "PPP"; +CGCLASS: "A"; +CGPIAF: 0,0,0,0; +CGSMS: 1; +CSMS: 0;
+CMGF: 0;  +CSAS: 0; +CRES: 0; +CSCA: "+32475161616",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; +CEMODE: 0; +CVHU: 1; +CPIN: ,;
+CMEC: 0,0,0,0; +CIND: 0,2,1,1,0,0,1,2; +CMER: 0,0,0,0,0; +CGATT: 1;
+CGACT(1,4); +CPBS: "ME"; +CPMS: "ME","ME","ME"; +CNMI: 0,0,0,0,0;
+CMMS: 0; +FTS: 0; +FRS: 0; +FTH: 3; +FRH: 3; +FTM: 96; +FRM: 96;
+CCUG: 0,0,0; +COPS: 0,0,""; +CUSD: 0; +CAOC: 1; +CCWA: 0; +CCLK: "";
+CPOL: 0,2,"",0,0,0,0; +CPLS: 0; +CTZR: 0;  +CTZU: 0; +CLIP: 0; +COLP: 0;
+CDIP: 0; +CLIR: 0; +CSDF: 1; +CEN: 0; +EB: 1,0,30; +EFCS: 1; +ER: 0;
+ESR: 1; +ETBM: 1,1,20; +MA: ; +MR: 0; +MS: ; +MV18R: 0; +MV18S: 0,0,0;
+CXT: 0; +CDR: 0; +CDS: 0,1,2048,6; +CFC: 0; +CFG: ""; +CQD: 10;
+CCRC: 0; +QCMUX: C,2; +CRM: 0; +CTA: 30; +ILRR: 0; +QCPIN: ,; +FAA: 0;
+FAP: 0,0,0; +FBO: 0; +FBU: 0; +FCQ: 1,0; +FCC: 0,1,0,0,0,0,0,0; +FCR: 0;
+FCT: 1E; +FEA: 0; +FFC: 0,0,0,0; +FHS: 0; +FIE: 0; +FIP: 0;
+FIS: 0,1,0,0,0,0,0,0; +FLI: ""; +FLO: 1; +FLP: 0; +FMS: 0;
+FNR: 0,0,0,0;  +FNS: ""; +FPA: ""; +FPI: ""; +FPP: 0; +FPR: 8; +FPS: 1;
+FPW: ""; +FRQ: 0,0; +FRY: 0; +FSA: ""; +FSP: 0; *CNTI: 0; ^PREFMODE: 0;
^DSCI: 0; ^CPIN: ,
 
OK

On peut configurer dans le fichier /etc/network/interfaces :

 

Et dans le fichier ppp :

 

Enfin, on peut activer l'interface ppp0 :

 

Et voir que tout roule dans ifconfig :

 

On peut désactiver les autres interfaces réseau et vérifier qu'on a bien le réseau :

 

Sources

configuration_d_une_cle_4g_lte.1472923955.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)