BeagleboneBlack 3G/4G
一.Compile kernel
1.修改driver自動bind
vi /drivers/usb/serial/option.c |
2.compile kernel
export PATH=$PATH:/your toolchain path |
1.
<*> USB Serial Converter support --->
│ Symbol: USB_SERIAL [=y]
│ Type : tristate
│ Prompt: USB Serial Converter support
│ Location:
│ -> Device Drivers
│ -> USB support (USB_SUPPORT [=y])
│ Defined at drivers/usb/serial/Kconfig:5
│ Depends on: USB_SUPPORT [=y] && USB [=y] && TTY [=y]
2.
[*] USB Generic Serial Driver
│ Symbol: USB_SERIAL_GENERIC [=y]
│ Type : boolean
│ Prompt: USB Generic Serial Driver
│ Location:
│ -> Device Drivers
│ -> USB support (USB_SUPPORT [=y])
│ -> USB Serial Converter support (USB_SERIAL [=y])
│ Defined at drivers/usb/serial/Kconfig:45
│ Depends on: USB_SUPPORT [=y] && USB [=y] && USB_SERIAL [=y]
3.
<*> USB driver for GSM and CDMA modems
│ Symbol: USB_SERIAL_OPTION [=y]
│ Type : tristate
│ Prompt: USB driver for GSM and CDMA modems
│ Location:
│ -> Device Drivers
│ -> USB support (USB_SUPPORT [=y])
│ -> USB Serial Converter support (USB_SERIAL [=y])
│ Defined at drivers/usb/serial/Kconfig:620
│ Depends on: USB_SUPPORT [=y] && USB [=y] && USB_SERIAL [=y]
│ Selects: USB_SERIAL_WWAN [=n]
4.
<*> PPP (point-to-point protocol) support
│ Symbol: PPP [=y]
│ Type : tristate
│ Prompt: PPP (point-to-point protocol) support
│ Location:
│ -> Device Drivers
│ -> Network device support (NETDEVICES [=y])
│ Defined at drivers/net/ppp/Kconfig:5
│ Depends on: NETDEVICES [=y]
│ Selects: SLHC [=n]
│ Selected by: IPWIRELESS [=n] && PCMCIA [=n] && NETDEVICES [=y] && \
│ TTY [=y]
5.
[*] PPP filtering
│ Symbol: PPP_FILTER [=y]
│ Type : boolean
│ Prompt: PPP filtering
│ Location:
│ -> Device Drivers
│ -> Network device support (NETDEVICES [=y])
│ -> PPP (point-to-point protocol) support (PPP [=y])
│ Defined at drivers/net/ppp/Kconfig:71
│ Depends on: NETDEVICES [=y] && PPP [=y]
6.
[*] PPP multilink support
│ Symbol: PPP_MULTILINK [=y]
│ Type : boolean
│ Prompt: PPP multilink support
│ Location:
│ -> Device Drivers
│ -> Network device support (NETDEVICES [=y])
│ -> PPP (point-to-point protocol) support (PPP [=y])
│ Defined at drivers/net/ppp/Kconfig:98
│ Depends on: NETDEVICES [=y] && PPP [=y]
如果沒有設定下列會有錯誤
Couldn't set tty to PPP discipline: Invalid argument
7.
<*> PPP MPPE compression (encryption)
│ Symbol: PPP_MPPE [=y]
│ Type : tristate
│ Prompt: PPP MPPE compression (encryption)
│ Location:
│ -> Device Drivers
│ -> Network device support (NETDEVICES [=y])
│ -> PPP (point-to-point protocol) support (PPP [=y])
│ Defined at drivers/net/ppp/Kconfig:84
│ Depends on: NETDEVICES [=y] && PPP [=y]
│ Selects: CRYPTO [=y] && CRYPTO_SHA1 [=y] && CRYPTO_ARC4 [=y] && \
│ CRYPTO_ECB [=y]
8.
<*> PPP support for async serial ports
│ Symbol: PPP_ASYNC [=y]
│ Type : tristate
│ Prompt: PPP support for async serial ports
│ Location:
│ -> Device Drivers
│ -> Network device support (NETDEVICES [=y])
│ -> PPP (point-to-point protocol) support (PPP [=y])
│ Defined at drivers/net/ppp/Kconfig:152
│ Depends on: NETDEVICES [=y] && TTY [=y] && PPP [=y]
│ Selects: CRC_CCITT [=y]
不一定要
<*> USB Modem (CDC ACM) support
│ Symbol: USB_ACM [=y]
│ Type : tristate
│ Prompt: USB Modem (CDC ACM) support
│ Location:
│ -> Device Drivers
│ -> USB support (USB_SUPPORT [=y])
│ -> Support for Host-side USB (USB [=y])
│ Defined at drivers/usb/class/Kconfig:6
│ Depends on: USB_SUPPORT [=y] && USB [=y] && TTY [=y]
│ Selected by: USB_VL600 [=n] && NETDEVICES [=y] && USB [=y] && \
│ NET [=y] && USB_NET_CDCETHER [=y] && TTY [=y]
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- |
二.Compile usb_modeswitch
wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-2.5.2.tar.bz2
修改makefile:
CC = arm-linux-gnueabihf-gcc |
make
usb_modeswitch to /bin
usb_modeswitch.conf to /etc
三.Compile pppd
wget https://download.samba.org/pub/ppp/ppp-2.4.5.tar.gz |
四.確認USB Dongle正常
1001lsusb
剛接上dongle 裝置是 0685:7000 ZD Incorporated HSDPA Modem
lsusb |
一段時間自動抓取後,會變成
12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA
lsusb |
這也是不需要usb_modeswitch的原因
ls dev
觀察一下dev,會發現ttyUSB0-3,就是USB Dongle
ls /dev |grep USB |
基本上 usb driver option 有修改都會有,如果沒有可能是沒有修改,
可以測試以下方式
echo 12d1 1001 > /sys/bus/usb-serial/drivers/option1/new_id |
或是
echo 12d1 1001 > /sys/bus/usb-serial/drivers/generic/new_id |
基本上使用generic driver 也可以,因為測試過
測試裝置正不正常
microcom /dev/ttyUSB0 |
OR
echo -e "AT\r" > /dev/ttyUSB0 |
測試SIM卡是否可以上網
echo -e "AT+COPS?\r" > /dev/ttyUSB0 |
如果返回0 , 可能PINCODE 沒有開
echo -e "AT+CPIN=\"0000\"\r" > /dev/ttyUSB0 |
測試訊號強度
echo -e "AT+CSQ\r" > /dev/ttyUSB0