Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
cenozoic
Posts: 4
Joined: 16 Sep 2014, 20:36

usb_modeswitch not triggering

Post by cenozoic » 16 Sep 2014, 21:02

I'm trying to get my Vodafone K5150 LTE modem working on Raspberry Pi with Raspbian Wheezy. I have installed the usb-modeswitch and usb-modswitch-data packages. The modem's id is 12d1:1f16, so I have added this line into /lib/udev/rules.d/40-usb_modeswitch.rules:

Code: Select all

# vodafone K5150
ATTR{idVendor}=="12d1", ATTR{idProduct}=="1f16", RUN+="usb_modeswitch '%b/%k'"
I also have created additional file in /usr/share/usb_modeswitch/12d1:1f16 with this contents:

Code: Select all

# K5150

TargetVendor=  0x12d1
TargetProduct= 0x1f16

Configuration=2
Manual mode switching works correctly and the modem seems to work (I was able to connect with it).

The problem is that the modeswitching should happen automatically and it does not. I have tried creating the 12d1:1f16 file in /etc/usb_modeswich.d, no change. I also tried to enable logging in /etc/usb_modeswitch.conf, but I can't see any logfile anywhere. It really seems like usb_modeswitch doesn't get run at all on device plugging. But udev seems to be working properly and the rule file is where it should be.

What am I doing wrong?

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: usb_modeswitch not triggering

Post by Josh » 16 Sep 2014, 21:50

Some udev debugging might clear things up ... I assume you have not the latest version of usb_modeswitch installed, which would change the process below slightly.


1. Disable mode-switching (edit /etc/usb_modeswitch.conf) just to be on the safe side, run this command:
"udevadm monitor"
and plug your modem in.


2. From the monitor output, pick the path to the top device (not the interface). In my setup, this was:
"/devices/pci0000:00/0000:00:12.2/usb5/5-3". Note that your values will be different.

This is the specific device that is supposed to trigger the mode-switch rule.


3. Run "udevadm info -a -p <your-path-from above>"
You will get the full attribute tree that can be checked by a rule entry. In
my setup, it contained these lines which are relevant:

ATTR{idVendor}=="12d1"
...
ATTR{idProduct}=="1f16"

If one of these is missing in your setup, there may be an issue with the specific udevd version.


4. Run "udevadm test --action=add <your-path-from above>"
This is a simulation and should clearly name usb_modeswitch as being run.

cenozoic
Posts: 4
Joined: 16 Sep 2014, 20:36

Re: usb_modeswitch not triggering

Post by cenozoic » 16 Sep 2014, 22:14

Josh wrote:2. From the monitor output, pick the path to the top device (not the interface). In my setup, this was:
"/devices/pci0000:00/0000:00:12.2/usb5/5-3". Note that your values will be different.
I got "/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.3".
3. Run "udevadm info -a -p <your-path-from above>"
You will get the full attribute tree that can be checked by a rule entry. In
my setup, it contained these lines which are relevant:

ATTR{idVendor}=="12d1"
...
ATTR{idProduct}=="1f16"

If one of these is missing in your setup, there may be an issue with the specific udevd version.
Yeah, I get these lines, along with some others, all with the right values, it seems.

4. Run "udevadm test --action=add <your-path-from above>"
This is a simulation and should clearly name usb_modeswitch as being run.
Hm, I really can't interpret the output, but it seems something is amiss here:

Code: Select all

root@raspberrypi:~# udevadm test --action=add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.3 
udev_builtin_add_property: ID_SERIAL=Vodafone__Huawei__K5150_FFFFFFFFFFFFFFFF
udev_builtin_add_property: ID_SERIAL_SHORT=FFFFFFFFFFFFFFFF
udev_builtin_add_property: ID_BUS=usb
udev_builtin_add_property: ID_USB_INTERFACES=:080650:020e00:0a0002:
udev_rules_apply_to_event: MODE 0664 /lib/udev/rules.d/91-permissions.rules:36
udev_event_execute_rules: no node name set, will use kernel supplied name 'bus/usb/001/012'
udev_node_add: creating device node '/dev/bus/usb/001/012', devnum=189:11, mode=01664, uid=0, gid=0
udev_node_mknod: preserve file '/dev/bus/usb/001/012', because it has correct dev_t
udev_node_mknod: preserve permissions /dev/bus/usb/001/012, 021664, uid=0, gid=0
node_symlink: preserve already existing symlink '/dev/char/189:11' to '../bus/usb/001/012'
udev_device_update_db: created db file '/run/udev/data/c189:11' for '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.3'
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/012
DEVNUM=012
DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.3
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=K5150
ID_MODEL_ENC=K5150
ID_MODEL_ID=1f16
ID_REVISION=0102
ID_SERIAL=Vodafone__Huawei__K5150_FFFFFFFFFFFFFFFF
ID_SERIAL_SHORT=FFFFFFFFFFFFFFFF
ID_USB_INTERFACES=:080650:020e00:0a0002:
ID_VENDOR=Vodafone__Huawei_
ID_VENDOR_ENC=Vodafone\x20\x28Huawei\x29
ID_VENDOR_ID=12d1
MAJOR=189
MINOR=11
PRODUCT=12d1/1f16/102
SUBSYSTEM=usb
TYPE=0/0/255
UDEV_LOG=6
USEC_INITIALIZED=18983188134

cenozoic
Posts: 4
Joined: 16 Sep 2014, 20:36

Re: usb_modeswitch not triggering

Post by cenozoic » 16 Sep 2014, 22:23

Also, forgot to mention usb_modeswitch version:

Code: Select all

root@raspberrypi:~# usb_modeswitch -e

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 1.2.3 (C) Josua Dietze 2012
 * Based on libusb0 (0.1.12 and above)

 ! PLEASE REPORT NEW CONFIGURATIONS !
That looks awfully old, doesn't it?

cenozoic
Posts: 4
Joined: 16 Sep 2014, 20:36

Re: usb_modeswitch not triggering [SOLVED]

Post by cenozoic » 17 Sep 2014, 10:24

Well, I decided to upgrade my usb-modeswitch package to the 2.2.0 (compiling it from the source) and now the modeswitching works completely automatically without even needing to modify any files with device-specific setup. Sorry about the fuss, didn't realize how old the official Raspbian package is.

Post Reply