Linux переключить режим модема

Подключаем Debian к интернет через usb модем

Подключаем Debian к интернет через usb модем Huawei E3531i

Важно! USB модем это устройство с 2 состояниями. Вначале оно определяется как cdrom, далее переключается в режим модема. Принцип работы такой, что после переключения в режим модема в режим cdrom его не вернуть.

Подключаем Huawei E3551i

Это устройство не модем в привычном понимании, USB это роутер, с веб интерфейсом. После поключения проверим как определилось устройство:

# lsusb . Bus 001 Device 003: ID 12d1:1f01 Huawei Technologies Co., Ltd. . 

У устройства есть идентификатор производителя (vendor id) 12d1 и идентификатор устройства (product id) 1f01 . В этом режиме устройство подключено в качестве cdrom. usb storage . Посмотрим информацию детальнее.

# lsusb -v 12d1 -p 1f01 lsusb -v -d 12d1:1f01 Bus 001 Device 005: ID 12d1:1f01 Huawei Technologies Co., Ltd. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 255 bMaxPacketSize0 64 idVendor 0x12d1 Huawei Technologies Co., Ltd. idProduct 0x1f01 bcdDevice 1.02 iManufacturer 1 HUAWEI iProduct 2 HUAWEI Mobile iSerial 3 FFFFFFFFFFFFFFFF bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) 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 255 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0001 

Для того, чтобы перевести устройство в режим модема необходимо знать строку инициализации и воспользоваться утилитой usb_modeswitch . Переведем устройство в режим модема.

# usb_modeswitch -I -W -v 0x12d1 -p 0x1f01 -M 55534243123456780000000000000a11062000000000000100000000000000 Taking all parameters from the command line * usb_modeswitch: handle USB devices with multiple modes * Version 1.1.4 (C) Josua Dietze 2010 * Based on libusb0 (0.1.12 and above) ! PLEASE REPORT NEW CONFIGURATIONS ! DefaultVendor= 0x12d1 DefaultProduct= 0x1f01 TargetVendor= not set TargetProduct= not set TargetClass= not set TargetProductList="" DetachStorageOnly=0 HuaweiMode=0 SierraMode=0 SonyMode=0 GCTMode=0 MessageEndpoint= not set MessageContent="55534243123456780000000000000a11062000000000000100000000000000" NeedResponse=0 ResponseEndpoint= not set Interface=0x00 InquireDevice disabled Success check disabled System integration mode disabled usb_set_debug: Setting debugging level to 15 (on) usb_os_find_busses: Found 005 usb_os_find_busses: Found 004 usb_os_find_busses: Found 003 usb_os_find_busses: Found 002 usb_os_find_busses: Found 001 usb_os_find_devices: Found 002 on 005 usb_os_find_devices: Found 001 on 005 error obtaining child information: Inappropriate ioctl for device usb_os_find_devices: Found 001 on 004 usb_os_find_devices: Found 001 on 003 usb_os_find_devices: Found 001 on 002 usb_os_find_devices: Found 005 on 001 usb_os_find_devices: Found 002 on 001 skipping descriptor 0xB skipped 1 class/vendor specific endpoint descriptors skipped 6 class/vendor specific interface descriptors skipping descriptor 0x25 skipped 1 class/vendor specific endpoint descriptors skipped 7 class/vendor specific interface descriptors usb_os_find_devices: Found 001 on 001 error obtaining child information: Inappropriate ioctl for device error obtaining child information: Inappropriate ioctl for device Looking for default devices . searching devices, found USB ID 0489:e03c searching devices, found USB ID 1d6b:0001 searching devices, found USB ID 1d6b:0001 searching devices, found USB ID 1d6b:0001 searching devices, found USB ID 1d6b:0001 searching devices, found USB ID 12d1:1f01 found matching vendor ID found matching product ID adding device searching devices, found USB ID 04f2:b209 searching devices, found USB ID 1d6b:0002 Found devices in default mode or class (1) Accessing device 005 on bus 001 . Using endpoints 0x01 (out) and 0x81 (in) Using 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 found ("usb-storage") OK, driver "usb-storage" detached Setting up communication with interface 0 . Using endpoint 0x01 for message sending . Trying to send message 1 to endpoint 0x01 . OK, message successfully sent Resetting response endpoint 0x81 Resetting message endpoint 0x01 -> Run lsusb to note any changes. Bye. 
# lsusb . Bus 001 Device 005: ID 12d1:14dc Huawei Technologies Co., Ltd. . 

Устройство сменило идетификатор с 0x1f01 на 0x14dc , то есть переключено. Создадим файл конфигурации чтобы переключение происходило автоматически.

# cd /etc/usb_modeswitch.d # nano 12d1:1f01 ####################################################### # Huawei E3531i DefaultVendor=0x12d1 DefaultProduct=0x1f01 TargetVendor=0x12d1 TargetProduct=0x14dc MessageContent="55534243123456780000000000000a11062000000000000100000000000000" CheckSuccess=20 

Теперь можно переключать устройство следующим образом:

usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:1f01 

Важно! Данную модель невозможно подключить как модем и в списке виртуальных консолей не будет /dev/ttyUSBx. Так что нет смысла использовать /sbin/modprobe usbserial vendor=0x12d1 product=0x14dc

Читайте также:  Посмотреть версию oracle linux

Основные параметры устройства можно посмотреть

# dmesg | grep usb [ 3.702443] usb 1-4: new high speed USB device using ehci_hcd and address 3 [ 3.835947] usb 1-4: New USB device found, idVendor=12d1, idProduct=14dc [ 3.835969] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 3.835982] usb 1-4: Product: HUAWEI Mobile [ 3.835986] usb 1-4: Manufacturer: HUAWEI [ 3.836184] usb 1-4: configuration #1 chosen from 1 choice 
# lsusb -v -d 12d1:14dc Bus 001 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 2 Communications bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x12d1 Huawei Technologies Co., Ltd. idProduct 0x14dc bcdDevice 1.02 iManufacturer 1 HUAWEI iProduct 2 HUAWEI Mobile iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 94 bNumInterfaces 3 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 2 Communications bInterfaceSubClass 6 Ethernet Networking bInterfaceProtocol 0 iInterface 5 CDC Ethernet Control Model (ECM) CDC Header: bcdCDC 1.10 CDC Union: bMasterInterface 0 bSlaveInterface 1 CDC Ethernet: iMacAddress 7 001e101f0000 bmEthernetStatistics 0x00000000 wMaxSegmentSize 1514 wNumberMCFilters 0x0000 bNumberPowerFilters 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 9 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 10 CDC Data bInterfaceSubClass 6 bInterfaceProtocol 0 iInterface 6 CDC Ethernet Data Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 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 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 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 0x03 EP 3 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 2 Communications bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0001 Self Powered 
# ifconfig eth1 up # ifconfig -a . eth1 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00 inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0 inet6 addr: fe80::21e:10ff:fe1f:0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:930 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:439037 (428.7 KiB) TX bytes:1084 (1.0 KiB) . 

Ура! Если правильно установлена сим карта, то мы подключены к интернет!

Читайте также:  Astra linux перезапуск cups

Источник

Оцените статью
Adblock
detector