0

I'm building a remote tracking device with a Raspberry PI3, using a Vodafone/Huawei 3g pendrive model k3765 and a GlobalSat G-STAR IV usb gps receiver. I'm unable to make them working properly right after the Raspberry PI is booted, With this rc.local script I'm forced to add sleep 100 to postpone the execution otherwise the wdial is unable to connect to the 3G dongle.

(
    sleep 100
    exec /usr/bin/wvdial Defaults &
    exec /usr/sbin/gpsd /dev/ttyUSB3 -G -n -F /var/run/gpsd.sock
) &

wdial.conf defaults configuration:

.......
   Modem = /dev/ttyUSB0
   Baud = 115200
   Init1 = ATZ
   Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
   .........

Moreover the 3G device is unable to communicate with Wvdial when initialized after the GPS:

[    4.492276 usb 1-1.5: New USB device found, idVendor=067b, idProduct=2303
[    3.179414] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.179422] usb 1-1.5: Product: USB-Serial Controller D
[    3.179430] usb 1-1.5: Manufacturer: Prolific Technology Inc.
[    3.261904] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.405519] usbcore: registered new interface driver brcmfmac
[    3.555526] brcmfmac: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
[    3.995861] systemd-journald[142]: Received request to flush runtime journal from PID 1
[    4.492091] usbcore: registered new interface driver usbserial
[    4.492199] usbcore: registered new interface driver usbserial_generic
[    4.492276] usbserial: USB Serial support registered for generic
[    4.497753] usbcore: registered new interface driver pl2303
[    4.497874] usbserial: USB Serial support registered for pl2303
[    4.498008] pl2303 1-1.5:1.0: pl2303 converter detected
[    4.503024] usb 1-1.5: pl2303 converter now attached to ttyUSB0
[    4.788779] random: crng init done

[    5.355603] usb 1-1.2: new high-speed USB device number 7 using dwc_otg
[    5.487659] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1520
[    5.487692] usb 1-1.2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[    5.487761] usb 1-1.2: Product: HUAWEI Mobile
[    5.487777] usb 1-1.2: Manufacturer: HUAWEI Technology
[    5.489834] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[    5.490257] scsi host0: usb-storage 1-1.2:1.0
[    5.608987] systemd-journald[142]: Received request to flush runtime journal from PID 1
[    6.182547] uart-pl011 3f201000.serial: no DMA platform data
[    6.581231] scsi 0:0:0:0: CD-ROM Vodafone CD ROM (Huawei)  2.31 PQ: 0 ANSI: 2
[    6.707228] sr 0:0:0:0: [sr0] scsi-1 drive
[    6.707241] cdrom: Uniform CD-ROM driver Revision: 3.20
[    6.708303] sr 0:0:0:0: Attached scsi CD-ROM sr0
[    6.718098] Adding 102396k swap on /var/swap.  Priority:-1 extents:6 across:2559996k SSFS
[    6.748494] sr 0:0:0:0: Attached scsi generic sg0 type 5
[    6.875322] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    6.875713] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    7.104064] usb 1-1.2: USB disconnect, device number 7

[   10.626059] Bluetooth: Core ver 2.22
[   10.626128] NET: Registered protocol family 31
[   10.626134] Bluetooth: HCI device and connection manager initialized
[   10.626154] Bluetooth: HCI socket layer initialized
[   10.626168] Bluetooth: L2CAP socket layer initialized
[   10.626200] Bluetooth: SCO socket layer initialized
[   10.640867] Bluetooth: HCI UART driver ver 2.3
[   10.640880] Bluetooth: HCI UART protocol H4 registered
[   10.640886] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   10.641049] Bluetooth: HCI UART protocol Broadcom registered
[   10.856795] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   10.856805] Bluetooth: BNEP filters: protocol multicast
[   10.856826] Bluetooth: BNEP socket layer initialized

[   11.505661] usb 1-1.2: new high-speed USB device number 8 using dwc_otg
[   11.657771] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1465
[   11.657786] usb 1-1.2: New USB device strings: Mfr=4, Product=3, SerialNumber=0
[   11.657794] usb 1-1.2: Product: HUAWEI Mobile
[   11.657802] usb 1-1.2: Manufacturer: HUAWEI Technology
[   11.663980] usb-storage 1-1.2:1.5: USB Mass Storage device detected
[   11.665049] scsi host0: usb-storage 1-1.2:1.5
[   11.666333] usb-storage 1-1.2:1.6: USB Mass Storage device detected
[   11.667116] scsi host1: usb-storage 1-1.2:1.6
[   11.716495] usbcore: registered new interface driver option
[   11.716624] usbserial: USB Serial support registered for GSM modem (1-port)
[   11.717764] option 1-1.2:1.0: GSM modem (1-port) converter detected
[   11.718252] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[   11.718618] option 1-1.2:1.3: GSM modem (1-port) converter detected
[   11.719061] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[   11.719174] option 1-1.2:1.4: GSM modem (1-port) converter detected
[   11.719546] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3
[   11.750659] cdc_ether 1-1.2:1.1 wwan0: register 'cdc_ether' at usb-3f980000.usb-1.2, Mobile Broadband Network Device, 02:50:f3:00:00:00
[   11.751182] usbcore: registered new interface driver cdc_ether
[   12.733814] scsi 0:0:0:0: CD-ROM  Vodafone CD ROM (Huawei)  2.31 PQ: 0 ANSI: 2
[   12.735116] scsi 1:0:0:0: Direct-Access  Vodafone Storage (Huawei) 2.31 PQ: 0 ANSI: 2
[   12.738472] sd 1:0:0:0: Attached scsi generic sg0 type 0
[   12.741085] sr 0:0:0:0: [sr0] scsi-1 drive
[   12.742362] sr 0:0:0:0: Attached scsi CD-ROM sr0

I tried to unplug the GPS and reboot the Raspberry, in this way the 3G start working (notice ttyUSB0, ttyUSB1, ttUSB2 are used):

[   11.496842] usb 1-1.2: new high-speed USB device number 5 using dwc_otg
[   11.628814] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1465
[   11.628829] usb 1-1.2: New USB device strings: Mfr=4, Product=3, SerialNumber                                                                            =0
[   11.628836] usb 1-1.2: Product: HUAWEI Mobile
[   11.628847] usb 1-1.2: Manufacturer: HUAWEI Technology
[   11.633223] usb-storage 1-1.2:1.5: USB Mass Storage device detected
[   11.633906] scsi host0: usb-storage 1-1.2:1.5
[   11.634483] usb-storage 1-1.2:1.6: USB Mass Storage device detected
[   11.634996] scsi host1: usb-storage 1-1.2:1.6
[   11.653994] usbcore: registered new interface driver usbserial
[   11.654069] usbcore: registered new interface driver usbserial_generic
[   11.654137] usbserial: USB Serial support registered for generic
[   11.661953] cdc_ether 1-1.2:1.1 wwan0: register 'cdc_ether' at usb-3f980000.u                                                                            sb-1.2, Mobile Broadband Network Device, 02:50:f3:00:00:00
[   11.662121] usbcore: registered new interface driver cdc_ether
[   11.668099] usbcore: registered new interface driver option
[   11.668184] usbserial: USB Serial support registered for GSM modem (1-port)
[   11.668394] option 1-1.2:1.0: GSM modem (1-port) converter detected
[   11.672288] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[   11.672736] option 1-1.2:1.3: GSM modem (1-port) converter detected
[   11.673246] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[   11.673497] option 1-1.2:1.4: GSM modem (1-port) converter detected
[   11.673952] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[   12.648316] scsi 1:0:0:0: Direct-Access     Vodafone Storage (Huawei) 2.31 PQ                                                                            : 0 ANSI: 2
[   12.650920] scsi 0:0:0:0: CD-ROM            Vodafone CD ROM (Huawei)  2.31 PQ                                                                            : 0 ANSI: 2
[   12.652159] sd 1:0:0:0: [sda] Attached SCSI removable disk
[   12.679935] sd 1:0:0:0: Attached scsi generic sg0 type 0
[   12.680268] scsi 0:0:0:0: Attached scsi generic sg1 type 5
[   12.689555] sr 0:0:0:0: [sr0] scsi-1 drive
[   12.689561] cdrom: Uniform CD-ROM driver Revision: 3.20
[   12.690131] sr 0:0:0:0: Attached scsi CD-ROM sr0
[   36.342198] random: crng init done
[  186.560637] PPP generic driver version 2.4.2
[  186.603856] PPP BSD Compression module registered
[  186.617019] PPP Deflate Compression module registered

Then I manually plugged the GPS:

[ 1656.294709] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
[ 1656.426971] usb 1-1.5: New USB device found, idVendor=067b, idProduct=2303
[ 1656.426985] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1656.426993] usb 1-1.5: Product: USB-Serial Controller D
[ 1656.427002] usb 1-1.5: Manufacturer: Prolific Technology Inc.
[ 1657.488257] usbcore: registered new interface driver pl2303
[ 1657.488366] usbserial: USB Serial support registered for pl2303
[ 1657.488491] pl2303 1-1.5:1.0: pl2303 converter detected
[ 1657.492824] usb 1-1.5: pl2303 converter now attached to ttyUSB3

...and now they both works.

I need a way to make them work at boot with no delay.

0

Successive exec's (is) may be contributing to the problem. Add an echo statement after the first exec,and see if it even puts it out.

Vittal

0

you better explicitly wait for a trigger file to appear. e.g.:

DEV=/dev/ttyUSB0
CNT=10; while [ ! -e $DEV -a $CNT -ne 0 ]; do CNT=`expr $CNT - 1`; sleep .5; done
[ $CNT -ne 0 ] && setsid sh -c '/usr/bin/wvdial Defaults' 1>&- 2>&- &
0

I'm doing basically the same thing on an application of mine. I would try setting up wvdial as a systemd service and set it so that it restarts time after time if it fails with Restart=always and RestartSec=60 or something like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.