cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

usb_modeswitch Not Switching

Mon May 16, 2016 12:36 pm

I have a Raspberry Pi 2 Model B running Raspbian Wheezy. I am trying to use usb_modeswitch to find out the DefaultProduct and TargetProduct numbers for my Vodafone K4203 3G modem.

I have usb_modeswitch installed and have attempted to find out the DefaultProduct and TargetProduct numbers by using both hot plugging and cold plugging of the usb modem. However, for both methods, typing lsusb in a terminal window only returns:

Code: Select all

Bus 001 Device 009: ID 19d2:1048 ZTE WCDMA Technologies MSM
for both instances of lsusb.

Do you know if there is there a manual way of using usb_modeswitch?
Or is it not so simple and there is in fact something else preventing usb_modeswitch from working?

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: usb_modeswitch Not Switching

Mon May 16, 2016 2:37 pm

Take the ID above and see if it is in usb-modeswitch.conf. I had to enter the ID of my K4605 Vodafone modem, to get it working with usb-modeswitch.

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Mon May 16, 2016 3:58 pm

I've quickly checked my usb_modeswitch.conf file and there is no sight of the modem ID, nor anywhere where I might input it. Before I start exploring how to edit the usb_modeswitch.conf file, I have a question:

So far I have only tried usb_modeswitch with the usb modem plugged directly into the pi's usb ports. I am aware that 3G modems usually draw a lot of current and might require more than the pi's usb ports can provide. Is there any chance that this power issue could be part of the reason as to why I cannot get usb_modeswitch to work?

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: usb_modeswitch Not Switching

Tue May 17, 2016 10:16 am

Power might be an issue, but my rather power hungry K4605 works fine directly connected to my Pi B, Pi 2, and Zero. However it does not like being plugged into a USB extension cable, [ attempts to gain a reception sweet spot ] but was happy in my non powered USB 2 hub for the Pi Zero.

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Wed May 18, 2016 10:27 am

So I decided to check my syslog to see what happens when I plug in the modem. The output I get is:

Code: Select all

May 16 21:32:03 raspberrypi kernel: [  119.300430] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
May 16 21:32:03 raspberrypi kernel: [  119.405592] usb 1-1.4: unable to read config index 2 descriptor/start: -32
May 16 21:32:03 raspberrypi kernel: [  119.405613] usb 1-1.4: chopping to 2 config(s)
May 16 21:32:03 raspberrypi kernel: [  119.408181] usb 1-1.4: New USB device found, idVendor=19d2, idProduct=1046
May 16 21:32:03 raspberrypi kernel: [  119.408202] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=4
May 16 21:32:03 raspberrypi kernel: [  119.408219] usb 1-1.4: Product: ZTE Mobile Broadband Station
May 16 21:32:03 raspberrypi kernel: [  119.408234] usb 1-1.4: Manufacturer: Vodafone(ZTE)
May 16 21:32:03 raspberrypi kernel: [  119.409182] usb 1-1.4: can't set config #1, error -71
May 16 21:32:03 raspberrypi kernel: [  119.409685] usb 1-1.4: USB disconnect, device number 4
May 16 21:32:04 raspberrypi kernel: [  119.770401] usb 1-1.4: new high-speed USB device number 5 using dwc_otg
May 16 21:32:04 raspberrypi kernel: [  119.871815] usb 1-1.4: New USB device found, idVendor=19d2, idProduct=1048
May 16 21:32:04 raspberrypi kernel: [  119.871840] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 16 21:32:04 raspberrypi kernel: [  119.871857] usb 1-1.4: Product: ZTE Mobile Broadband Station
May 16 21:32:04 raspberrypi kernel: [  119.871872] usb 1-1.4: Manufacturer: Vodafone(ZTE)
May 16 21:32:04 raspberrypi kernel: [  119.871888] usb 1-1.4: SerialNumber: blablabla
May 16 21:32:04 raspberrypi kernel: [  119.875936] usb-storage 1-1.4:1.2: USB Mass Storage device detected
May 16 21:32:04 raspberrypi kernel: [  119.876816] scsi host0: usb-storage 1-1.4:1.2
May 16 21:32:04 raspberrypi kernel: [  119.909198] cdc_ether 1-1.4:1.0 usb0: register 'cdc_ether' at usb-3f980000.usb-1.4, CDC Ethernet Device, 02:0c:e7:0b:01:02
I understand this to mean that the pi initially tries to recognize the USB modem in one of the modes - with idProduct = 1046 - but cannot. It then successfully recognizes the USB modem when it is in the other mode (Modem mode I think) - with idProducr = 1048.

The line that I am interested in is:

Code: Select all

May 16 21:32:03 raspberrypi kernel: [  119.409182] usb 1-1.4: can't set config #1, error -71
Googling it would suggest that it could possibly be due to a power problem, but there doesn't seem to be a definitive answer as to what the error message actually means.

Does anyone know what this error message means and whether it is due to a power deficiency?

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: usb_modeswitch Not Switching

Wed May 18, 2016 12:31 pm

My take is it does not get a matching config option for the device. Device is not recognised as a modem as no device is created or asigned to it.

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Wed May 18, 2016 12:42 pm

Sorry, what do you mean by a matching config option?

Also, it must be recognized as a modem because I am able to access the internet from my pi when the modem is plugged in and the pi is isolated from wifi and ethernet connections.

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Wed May 18, 2016 12:50 pm

Oh, I think I understand. So usb_modeswitch has a list of config files for specific devices? But there currently isn't one for the device that I am trying to use?

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: usb_modeswitch Not Switching

Wed May 18, 2016 3:02 pm

cbrereton wrote:Oh, I think I understand. So usb_modeswitch has a list of config files for specific devices? But there currently isn't one for the device that I am trying to use?
Right, here is what I had to put in to usb_modeswitch.conf for my Vodafone K4605

#SetStorageDelay=4
# Vodafone Huawei K4605
# ID 12d1:14c6 not 12d1:14c1
DefaultVendor=0x12d1
DefaultProduct=0x14c6
TargetVendor=0x12d1
TargetProduct=0x14c6
HuaweiNewMode=1

usb_modeswitch has an ID of 12d1:14c1 for the generic K4605 modem, but the Vodafone branded K4605 I have, has the above ID of 12d1:14c6

My wvdial.conf is as follows:


[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","APN"
Modem Type = Analog Modem
Phone = *99#
New PPPD = yes
Modem = /dev/ttyUSB0
Username = { }
Password = { }
Baud = 406800

Put in the correct value for APN as supplied by you service provider.

Modem, is the device name, that the K4605 gets assigned by the kernel.

Baud setting might be superfluous, or, value might be wrong, but it does not break anything here, so it stays.

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Thu May 19, 2016 9:56 am

My device is a ZTE K4203-z as opposed to the Huawei modems that vodafone have used in the past.

After some googling, it would appear that this modem doesn't actually use (or potentially need) usb_modeswitch to switch modes. Looking at the dmesg when you plug the modem into the pi's usb port, it would appear that the device is initially in storage mode (19d2:1046) but is automatically switched into modem mode (19d2:1048). This makes sense because I can use the modem to access the internet over 3g without needing to configure usb_modeswitch.

I need my modem to create a serial port - such as /dev/ttyUSB0 - that I can get my pi to interface with, this seems to be the method with all other modems. However, there is no such creation of any serial port in my /dev/. Instead, it would appear that the modem creates an ethernet port called usb0 instead. See my ifconfig when the modem is plugged in:

Code: Select all

eth0          Link encap:Ethernet  HWaddr b8:27:eb:6d:fe:0a  
              inet addr:123.456.789.999  Bcast:123.456.789.999  Mask:123.456.0.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:19451 errors:0 dropped:0 overruns:0 frame:0
              TX packets:131995 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:1004486 (980.9 KiB)  TX bytes:27280945 (26.0 MiB)

lo            Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:200 errors:0 dropped:0 overruns:0 frame:0
              TX packets:200 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:16656 (16.2 KiB)  TX bytes:16656 (16.2 KiB)

usb0          Link encap:Ethernet  HWaddr 02:0c:e7:0b:01:02  
              inet addr:123.456.789.999  Bcast:123.456.789.999  Mask:123.459.789.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:26 errors:0 dropped:9 overruns:0 frame:0
              TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:1697 (1.6 KiB)  TX bytes:4277 (4.1 KiB)
Is there a way of using usb0 as the interface with my pi? Or if not, how can I interface this device with my pi?

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: usb_modeswitch Not Switching

Thu May 19, 2016 8:24 pm

Well, it is interfacing with your RPi, via "usb0" - not seen this behaviour before, Linux possibly has made progress with regards to Hi-Link type modems, is my guess.

Never had any reason to buy another modem after buying my K4605 - LTE is available locally, but service providers are using it to connect more people to current towers, rather than making use of the faster speeds that LTE can provide. Network speeds available have yet to reach what my K4605 is capable of regardless of 3G or LTE being used. But I am drifting off topic. :(

Why do you need a /dev/tty0 serial interface, can you not simply exchange / replace /dev/tty0 with /dev/usb0?

cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Fri May 20, 2016 7:22 am

I need a serial interface so that I can use the modem with software like gammu - software that allows you to send SMS messages over 3G. To configure Gammu, you need to specify the port that the modem is connected to. Since usb0 does not appear in /dev, I'm not quite sure how to access it.

So in answer to your question, I'm not quite sure how i'd replace /dev/tty0 with /dev/usb0 since there is is no /dev/usb0.

ianboag
Posts: 37
Joined: Thu Jul 17, 2014 5:08 am

Re: usb_modeswitch Not Switching

Sun May 29, 2016 9:21 pm

Me too. Same problem. A ZTE modem that worked out of the box on pre-3 Pis (with no need to play with usb_modeswitch config stuff). On the Pi 3 it switches OK - shows up as a modem with lsusb. But no /dev/ttyUSBx created. No usb0 for me either.

On the Pi(pre-3) what used to happen was that dmesg announced that there were three modem ports - /dev/ttyUSB0 , 1 and 2. How can I make the latest Jessie and a Pi3 do this? DietPi (the Pi 3 version) is the same. I suspect it's more the OS than the board (?) but earlier OS versions don't run on the Pi3. Progress? ... :-)


cbrereton
Posts: 11
Joined: Thu Sep 03, 2015 1:39 pm

Re: usb_modeswitch Not Switching

Tue May 31, 2016 12:17 pm

ianboag wrote:Progress? ... :-)
I was originally trying to use my pi to send SMS messages. However, I discovered this page: http://iqjar.com/jar/sending-emails-fro ... pberry-pi/ , about how to send emails from the pi using a 3G modem. I decided to give it a go since it would help me achieve a similar outcome and it has worked fine.

Return to “General discussion”