С этой задачей поможет справиться пакет программ SMSTools и USB-модем Huawei E1552.
Готовим модем. Есть у меня "железка"-модем и рабочая система gentoo.
Вставляю модем в USB:
# lsusb
Bus 005 Device 006: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
Bus 005 Device 002: ID 0402:7675 ALi Corp.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Точнее:
# lsusb -vvvНо, модем виден как набор дисков, а мне нужен модем. Воспользуюсь программой usb_modeswitch:
Bus 005 Device 006: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x12d1 Huawei Technologies Co., Ltd.
idProduct 0x1446 E1552/E1800/E173 (HSPA modem)
bcdDevice 0.00
iManufacturer 2 HUAWEI Technology
iProduct 1 HUAWEI Mobile
iSerial 0
bNumConfigurations 1
# usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -m 0x01 -M "55534243123456780000000000000011060000000000000000000000000000"
Look for target devices ...
No devices in target mode or class found
Look for default devices ...
product ID matched
Found devices in default mode (1)
Access device 010 on bus 005
Get the current device configuration ...
OK, got current device configuration (1)
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)
Inquire device details; driver will be detached ...
Looking for active driver ...
OK, driver detached
SCSI inquiry data (for identification)
-------------------------
Vendor String: HUAWEI
Model String: Mass Storage
Revision String: 2.31
-------------------------
USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
Product: HUAWEI Mobile
Serial No.: not provided
-------------------------
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
Could not reset endpoint (probably harmless): -99
Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!
# lsusb
Bus 005 Device 011: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Bus 005 Device 002: ID 0402:7675 ALi Corp.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# ls /dev/ttyU*Вынул+вставил модем - настройки "слетели".
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2
Путь №2 - воспользоваться тем, что можно проинициализировать устройство на использование только модема:
# usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -m 0x01 -M "55534243123456780000000000000011060000000000000000000000000000"Вынул+вставил модем -о! появился модем!
# minicom /dev/ttyUSB0
minicom>AT^U2DIAG=0
minicom>Ctrl+A X
Nov 27 14:33:30 localhost kernel: [125649.573644] usb 5-2: new high-speed USB device number 29 using ehci-pciЗамечательно - модем есть. Переходим к FreeBSD.
Nov 27 14:33:30 localhost kernel: [125649.700016] usb 5-2: New USB device found, idVendor=12d1, idProduct=1001
Nov 27 14:33:30 localhost kernel: [125649.700041] usb 5-2: New USB device strings: Mfr=2, Product=1, SerialNumber=0
Nov 27 14:33:30 localhost kernel: [125649.700061] usb 5-2: Product: HUAWEI Mobile
Nov 27 14:33:30 localhost kernel: [125649.700077] usb 5-2: Manufacturer: HUAWEI Technology
Nov 27 14:33:30 localhost kernel: [125649.705429] usb-storage 5-2:1.0: USB Mass Storage device detected
Nov 27 14:33:30 localhost kernel: [125649.705884] option 5-2:1.0: GSM modem (1-port) converter detected
Nov 27 14:33:30 localhost kernel: [125649.707591] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB0
Nov 27 14:33:30 localhost kernel: [125649.708364] usb-storage 5-2:1.1: USB Mass Storage device detected
Nov 27 14:33:30 localhost kernel: [125649.708960] option 5-2:1.1: GSM modem (1-port) converter detected
Nov 27 14:33:30 localhost kernel: [125649.709743] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB1
Nov 27 14:33:30 localhost kernel: [125649.710083] usb-storage 5-2:1.2: USB Mass Storage device detected
Nov 27 14:33:30 localhost kernel: [125649.710298] option 5-2:1.2: GSM modem (1-port) converter detected
Nov 27 14:33:30 localhost kernel: [125649.710833] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB2
Воткнул модем в сервер и:
ugen0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on uhub1Фантастика! Я таки его сделал!
Ядро GENERIC - загрузка, есть устройства /dev/ugen0.
Добавил загрузку модуля u3g. Всё :-)
#dmesg | grep ucom
ucom0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on uhub1
ucom0: configured 3 serial ports (U0.%d)
#ls /dev | grep cuaU
cuaU0.0
cuaU0.0.init
cuaU0.0.lock
cuaU0.1
cuaU0.1.init
cuaU0.1.lock
cuaU0.2
cuaU0.2.init
cuaU0.2.lock
Но, как оказалось, не всё так радужно, - на "боевом" сервере модем не появляется ни в каком виде.