Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
janeks
Posts: 5
Joined: 08 Nov 2010, 21:14

modeswitch works with command line, but not after plugin USB

Post by janeks » 08 Nov 2010, 22:48

Hi!

I succesfuly switched the mode for Huawei E1752 by using commandline:
usb_modeswitch -c /etc/usb_modeswitch.conf

usb_modeswitch.conf:

Code: Select all

########################################################
# Huawei E1752
#
# Contributor: 

DefaultVendor=  0x12d1
DefaultProduct= 0x1446

TargetVendor=	0x12d1
TargetProdct=	0x1001

MessageEndpoint=	0x01

MessageContent=	"55534243000000000000000000000011060000000000000000000000000000"
But it could not autoswitch after pluging in the USB device neither with or without addition above in /etc/usb_modeswitch.conf file.
Could it be connected with problem instalation of data package:

Code: Select all

/usb-modeswitch-data-20100826# make install
install -d /etc/usb_modeswitch.d
install -D --mode=644 40-usb_modeswitch.rules /lib/udev/rules.d/40-usb_modeswitch.rules
install --mode=644 -t /etc/usb_modeswitch.d ./usb_modeswitch.d/*
if [ -f /etc/issue ]; then \
                if [ -n `which udevadm 2>/dev/null` ]; then \
                        UDEVADM=`which udevadm`; \
                        UDEVADM_VER=`$UDEVADM -V 2>/dev/null`; \
                        if [ -z $UDEVADM_VER ]; then \
                                UDEVADM_VER=`$UDEVADM --version 2>/dev/null`; \
                        fi; \
                        if [ $UDEVADM_VER -gt 127 ]; then \
                                $UDEVADM control --reload-rules; \
                        else \
                                $UDEVADM control --reload_rules; \
                        fi \
                elif [ `which udevcontrol 2>/dev/null` ]; then \
                `which udevcontrol` reload_rules; \
                fi \
        fi
/bin/sh: line 7: [: -gt: unary operator expected
/bin/sh: line 10: control: command not found
make: *** [rules-reload] Error 127
If yes - how it could be fixed?

brgds
Janeks[/code]

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

Post by Josh » 08 Nov 2010, 23:40

Don't use "/etc/usb_modeswitch.conf" for device configurations. It's a global configuration, the device configurations are in "/etc/usb_modeswitch.d". Please reinstall the program package for the original global config file.

There is a file named 12d1:1446 with your setup in the data folder. If you want to use it on the command line, just type
"usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:1446".

If the automatic switching does not work, switch on logging as described on the main doc page, paragraph "Troubleshooting".
Did you install the "tcl" package, by the way ?


janeks
Posts: 5
Joined: 08 Nov 2010, 21:14

Post by janeks » 09 Nov 2010, 08:08

I switched on logging, but nothing happens - I could not find a log file.
Hm, did I need to reboot or restart a service?

brgds
Janeks

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

Post by Josh » 09 Nov 2010, 08:51

Your "udevadm" program seems to be peculiar somehow. That's what the install error came from. This is not a big problem but it may require a reboot, which otherwise wouldn't have been necessary.

To avoid a reboot you can also run "udevadm --reload-rules" (with older versions it's "--reload_rules").

And again: do you have the "tcl" package installed ? Try running "tclsh" (exit with "exit").


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

Post by Josh » 10 Nov 2010, 21:57

Also, you might check if there are other switching attempts directed at your device.

Do a "grep 1446 *" in /lib/udev/rules.d and /etc/udev/rules.d - the only result should be in "40-usb_modeswitch.rules".

janeks
Posts: 5
Joined: 08 Nov 2010, 21:14

Post by janeks » 10 Nov 2010, 22:35

Josh wrote:Also, you might check if there are other switching attempts directed at your device.

Do a "grep 1446 *" in /lib/udev/rules.d and /etc/udev/rules.d - the only result should be in "40-usb_modeswitch.rules".

Code: Select all

boxy:/lib/udev/rules.d# grep 1446 *
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"
boxy:/lib/udev/rules.d# cd /etc/udev/rules.d
boxy:/etc/udev/rules.d# grep 1446 *
boxy:/etc/udev/rules.d# 
BTW: Do I realy need the tcl?
I have not it in the deafault packages

Code: Select all

apt-get install tcl
Reading package lists... Done
Building dependency tree... Done
Package tcl is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package tcl has no installation candidate
Something similar is for udevadm.

brgds
Janeks

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

Post by Josh » 10 Nov 2010, 23:09

So we need to talk about your system.

What kind of distribution do you run?

Kernel version ("uname -r") ?

"udevadm" is really a core system tool and should come together with "udev".
Maybe you have the old bunch of tools ? Try typing on a shell: "udev<Tab>" and see what comes up.


janeks
Posts: 5
Joined: 08 Nov 2010, 21:14

Post by janeks » 11 Nov 2010, 00:26

I have debian on PPC: 2.6.32.13

I had also on my system an older GSM modem Nokia N30, that was attached throught usb-serial adapter.
Now I removed them and rebooted I found the modem in ttty's list and I was able to connect to modem by using minicom and use AT commands.

Here is my udev[tab] output

Code: Select all

udev
udevcontrol  udevinfo     udevsettle   udevtrigger  
udevd        udevmonitor  udevtest  

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

Post by Josh » 11 Nov 2010, 09:38

Yes, these are the old udev tools. "udevadm" wraps up all of them in one program; e.g. "udevtrigger" became "udevadm trigger".

For Tcl, also try "tcl8.4".

janeks
Posts: 5
Joined: 08 Nov 2010, 21:14

Post by janeks » 11 Nov 2010, 10:01

There is also another problem - I got sudden restart/shutdown of my linux box.
Later I found from syslog and internet resources that it is connected with this message:

Code: Select all

kernel: option: option_instat_callback: error -71
F.ex. here is similar problem discussion:
http://www.murga-linux.com/puppy/viewtopic.php?p=357695

Are you faced with this - do you know how to fix it?

The tcl8.4 I'll test later in evening when I will have access to my linux box.

brgds
Janeks

Post Reply