Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
daturach
Posts: 3
Joined: 15 Jul 2015, 20:56

Huawei E3531 (0x12d1:0x15d2) together with Raspberry Pi B+

Post by daturach » 15 Jul 2015, 21:52

Hello all

I recently bought a USB stick model Huawei E3531 that I want to connect to a Raspberry Pi B+ running Kernel 3.18.7+
My project is to send telemetry data to the internet. Everything works fine through my cable modem. Now I would like to replace these cables by a E3531.

I need some advise how to proceed.
This is what I have done so far:

- Compiled usb_modeswitch from the source. I am running Version 2.2.3
- Created a config file "12d1_15d2" in /etc/usb_modeswitch.d with the following content:

Code: Select all

# Huawei E3531
DefaultVendor= 0x12d1
DefaultProduct= 0x15d2
TargetVendor= 0x12d1
TargetProduct= 0x15d3
MessageContent"55534243123456780000000000000011062000000100000000000000000000"
- Updated file "40usb_modeswitch.rules" in /lib/udev/rules.d/ with the following content:
# Huawei E3531
ATTR{idVendor}=="12d1", ATTR{idProduct}=="15d3", RUN+="usb_modeswitch '%b/%k'"
The results of running "lsusb -v -d 12d1:15d2" before switching and "lsusb -v -d 12d1:15d3" after switching are the same as in thread http://www.draisberghof.de/usb_modeswit ... f=3&t=2347

"lsusb" before switching:

Code: Select all

Bus 001 Device 005: ID 12d1:15d2 Huawei Technologies Co., Ltd.
I had to run twice this command to switch the modem (don't know why)

Code: Select all

sudo usb_modeswitch -v 12d1 -p 15d2 -M '55534243123456780000000000000011062000000100000000000000000000'
The result is:

Code: Select all

Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 005 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: HUAWEI
     Product: HUAWEI Mobile
  Serial No.: FFFFFFFFFFFFFFFF
-------------------------
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
-> Run lsusb to note any changes. Bye!
Then "lsusb" gives this:

Code: Select all

Bus 001 Device 006: ID 12d1:15d3 Huawei Technologies Co., Ltd.
Then I run ifconfig -a, get this:

Code: Select all

wwan0     Link encap:Ethernet  HWaddr 00:1e:10:1f:00:00
           UP BROADCAST RUNNING 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 lg file transmission:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

My question is what should be done next to switch this modem automatically while booting?

Thanks for your help.

Walter

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei E3531 (0x12d1:0x15d2) together with Raspberry Pi

Post by LOM » 16 Jul 2015, 02:14

daturach wrote:My question is what should be done next to switch this modem automatically while booting?
Edit your udev rule so that it matches the dongles default/startup id.
That is 15d2, not 15d3.

daturach
Posts: 3
Joined: 15 Jul 2015, 20:56

Re: Huawei E3531 (0x12d1:0x15d2) together with Raspberry Pi

Post by daturach » 16 Jul 2015, 14:14

Thanks for spotting this.

My next step: wvdial installation...

daturach
Posts: 3
Joined: 15 Jul 2015, 20:56

Re: Huawei E3531 (0x12d1:0x15d2) together with Raspberry Pi

Post by daturach » 17 Jul 2015, 12:30

Ok, after a bit of tweaking, this is what I get from "/var/log/messages":

Code: Select all

usb 1-1.5: USB disconnect, device number 5
usb 1-1.5: new high-speed USB device number 6 using dwc_otg
usb 1-1.5: New USB device found, idVendor=12d1, idProduct=15d3
usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.5: Product: HUAWEI Mobile
usb 1-1.5: Manufacturer: HUAWEI
usb 1-1.5: SerialNumber: FFFFFFFFFFFFFFFF
usb-storage 1-1.5:1.4: USB Mass Storage device detected
scsi host1: usb-storage 1-1.5:1.4
usb-storage 1-1.5:1.5: USB Mass Storage device detected
scsi host2: usb-storage 1-1.5:1.5
usbcore: registered new interface driver cdc_ncm
usbcore: registered new interface driver cdc_wdm
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
huawei_cdc_ncm 1-1.5:1.1: MAC-Address: 00:1e:10:1f:00:00
huawei_cdc_ncm 1-1.5:1.1: cdc-wdm0: USB WDM device
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (1-port)
huawei_cdc_ncm 1-1.5:1.1 wwan0: register 'huawei_cdc_ncm' at usb-bcm2708_usb-1.5, Huawei CDC NCM device, 00:1e:10:1f:00:00
usbcore: registered new interface driver huawei_cdc_ncm
option 1-1.5:1.0: GSM modem (1-port) converter detected
usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0
option 1-1.5:1.2: GSM modem (1-port) converter detected
usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1
option 1-1.5:1.3: GSM modem (1-port) converter detected
usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2
scsi 2:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
scsi 1:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
sd 2:0:0:0: [sda] Attached SCSI removable disk
sd 2:0:0:0: Attached scsi generic sg0 type 0
sr 1:0:0:0: [sr0] scsi-1 drive
sr 1:0:0:0: Attached scsi generic sg1 type 5
I don't understand all these lines. However, I am wondering if there are other Product Ids hidden in this stick.
I have discovered "idProduct=15d3" as listed above.

Other question: there are 3 USB ports (ttyUSB0-2). What are the differences between these ports?

Thanks for your help.

Walter

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei E3531 (0x12d1:0x15d2) together with Raspberry Pi

Post by LOM » 17 Jul 2015, 13:47

Your 3 serial interfaces are:

ttyUSB0 3G Modem
ttyUSB1 3G Application Interface (diag)
ttyUSB2 3G PC UI Interface (at cmd)

but the dongle does also have an interface which is a direct ethernet adapter, huawei_cdc_ncm + cdc-wdm has already grabbed that interface and created the ethernet device wwan0 and its command channel cdc-wdm0.
You need NetworkManager in order to connect to the net via wwan0.

Post Reply