Page 1 of 2

Disable HiLink of E3256

Posted: 15 Mar 2017, 14:35
by birkelund
Hi
I have tried to override the normal usb-modeswitch behavour for a Huawei E3256 device, but without luck.

No matter what i seems to do, the device is present in HiLink mode (12d1:14db) but I would like it to be in serial mode (12d1:1001) so that I can use it with gammu.

I can see in the syslog that modeswitch change the dongle from cdrom mode (12d1:1f01) and into HiLink Mode.

Here is the content of the /etc/usb_modeswitch.d/12d1:1f01

Code: Select all

# Huawei E3531s-2 - switch to modem mode instead of HiLink CDC-Ether mode
TargetVendor=0x12d1
TargetProduct=0x1f01
DefaultVendor=0x12d1
DefaultTarget=0x14db


# switch to 12d1:1001 (modem mode, 3 virtual serial ports)
MessageContent="55534243123456780000000000000011063000000100010000000000000000"

And here are the content of /etc/usb_modeswitch.conf

Code: Select all

# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# Evaluated by the wrapper script /usr/sbin/usb_modeswitch_dispatcher
#
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"


# Disable automatic mode switching globally (e.g. to access the original
# install storage)

DisableSwitching=0


# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=1


# Optional increase of "delay_use" for the usb-storage driver; there are hints
# that a recent kernel default change to 1 sec. may lead to problems, particu-
# larly with USB 3.0 ports. Set this to at least 3 (seconds) in that case.
# Does nothing if the current system value is same or higher

#SetStorageDelay=4
What am I doing wrong? How do I get 12d1:1f01 into 12d1:1001? I really hope somebody can help, as i've spend a lot of time on this.

Re: Disable HiLink of E3256

Posted: 15 Mar 2017, 20:16
by Josh
Have you had a look at the log?

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=1

Re: Disable HiLink of E3256

Posted: 15 Mar 2017, 23:26
by birkelund
I dont have any specific files in /var/log/

Code: Select all

alternatives.log  daemon.log    fontconfig.log  messages.1  wtmp
apt               daemon.log.1  fsck            ntpstats    Xorg.0.log
auth.log          debug         kern.log        samba       Xorg.0.log.old
auth.log.1        debug.1       kern.log.1      syslog
boot.log          dmesg         lastlog         syslog.1
bootstrap.log     dpkg.log      lightdm         user.log
btmp              faillog       messages        user.log.1
If i take a look in syslog then i have the

Code: Select all

Mar 13 10:17:06 MirrorPi kernel: [    9.024128] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
Mar 13 10:17:06 MirrorPi usb_modeswitch: switch device 12d1:1f01 on 001/004
Mar 13 10:17:06 MirrorPi avahi-daemon[446]: Server startup complete. Host name is MirrorPi.local. Local service cookie is 3293869510.
Mar 13 10:17:06 MirrorPi kernel: [    9.231007] usb 1-1.3: USB disconnect, device number 4

Mar 13 10:17:08 MirrorPi logger: usb_modeswitch: switched to 12d1:14db on 001/005
Mar 13 10:17:08 MirrorPi systemd[1]: Started USB_ModeSwitch.


Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 11:28
by birkelund
Does this gives any clue to what could be wrong?

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 21:50
by Josh
usb_modeswitch is obviously starting automatically and switching the modem, but not creating a log. Do you have any information which version of usb_modeswitch is installed?

Run "usb_modeswitch -h" if you can't find anything.

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 22:25
by birkelund
Yes, i run 2.2.0

Code: Select all

pi@MirrorPi:~ $ usb_modeswitch -e

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.0 (C) Josua Dietze 2014
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 23:07
by Josh
Can you try to install the current version?

Your's is a bit dated and will likely include bugs that have been fixed since.

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 23:25
by birkelund
Thats weird. Even after uninstalling usb-modeswitch and rebooting, the usb dongle is still in HiLink mode?

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 23:50
by birkelund
Updating usb-modeswitch seemed to do the trick. I had to get it from jessie backports source but it seems to be working.

Thank you very much for spending the time on helping me.

Re: Disable HiLink of E3256

Posted: 21 Mar 2017, 23:55
by birkelund
I was to fast..

It worked perfectly, then i rebooted and now the usb dongle is back in HiLink mode..

But the log file is finally present.

Code: Select all

USB_ModeSwitch log from Tue Mar 21 22:50:43 CET 2017

Use global config file: /etc/usb_modeswitch.conf
Raw parameters: {--switch-mode} {1-1.4.1:1.0}
Top device directory not found (/sys/bus/usb/devices/1-1.4.1)! Exit

Re: Disable HiLink of E3256

Posted: 22 Mar 2017, 09:04
by Josh
It is pretty obvious that there are two 'authorities' fighting to mode-switch the modem.

Either there is annother tool similar to usb_modeswitch installed or there are two instances of usb_modeswitch present. Did you install any Huawei software perhaps?

Let's focus on the trigger for USB plug-in actions. Go to "/lib/udev/rules.d" and run "grep -i 12d1 *". This should reveal all files in which the Huawei vendor ID is used. Ideally, there should be only one, named "40-usb_modeswitch.rules".

If there are more, then please report.

Re: Disable HiLink of E3256

Posted: 22 Mar 2017, 17:16
by LOM
Which Linux kernel version number?

Re: Disable HiLink of E3256

Posted: 22 Mar 2017, 17:57
by Josh
Ah, LOM, I think you are suspecting that specific kernel version which handles almost all Huawei modems in usb-storage ... (This was reversed in a later version.)

Re: Disable HiLink of E3256

Posted: 22 Mar 2017, 18:26
by birkelund
Josh wrote:It is pretty obvious that there are two 'authorities' fighting to mode-switch the modem.

Either there is annother tool similar to usb_modeswitch installed or there are two instances of usb_modeswitch present. Did you install any Huawei software perhaps?

Let's focus on the trigger for USB plug-in actions. Go to "/lib/udev/rules.d" and run "grep -i 12d1 *". This should reveal all files in which the Huawei vendor ID is used. Ideally, there should be only one, named "40-usb_modeswitch.rules".

If there are more, then please report.
here is the output of /lib/udev/rules.d

Code: Select all

40-usb_modeswitch.rules:ATTRS{idVendor}=="12d1", ATTR{bInterfaceNumber}=="00", A                                                                                                                     TTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
60-libgphoto2-6.rules:ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="360f", ENV{ID_                                                                                                                     GPHOTO2}="1", ENV{GPHOTO2_DRIVER}="proprietary", ENV{ID_MEDIA_PLAYER}="1", MODE=                                                                                                                     "0664", GROUP="plugdev"
60-libgphoto2-6.rules:ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="361f", ENV{ID_                                                                                                                     GPHOTO2}="1", ENV{GPHOTO2_DRIVER}="proprietary", ENV{ID_MEDIA_PLAYER}="1", MODE=                                                                                                                     "0664", GROUP="plugdev"
60-libgphoto2-6.rules:ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1051", ENV{ID_                                                                                                                     GPHOTO2}="1", ENV{GPHOTO2_DRIVER}="proprietary", ENV{ID_MEDIA_PLAYER}="1", MODE=                                                                                                                     "0664", GROUP="plugdev"
60-libgphoto2-6.rules:ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1052", ENV{ID_                                                                                                                     GPHOTO2}="1", ENV{GPHOTO2_DRIVER}="proprietary", ENV{ID_MEDIA_PLAYER}="1", MODE=                                                                                                                     "0664", GROUP="plugdev"
69-libmtp.rules:ATTR{idVendor}=="12d1", ATTR{idProduct}=="1051", SYMLINK+="libmt                                                                                                                     p-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="                                                                                                                     1"
69-libmtp.rules:ATTR{idVendor}=="12d1", ATTR{idProduct}=="1052", SYMLINK+="libmt                                                                                                                     p-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="                                                                                                                     1"
69-libmtp.rules:ATTR{idVendor}=="12d1", ATTR{idProduct}=="360f", SYMLINK+="libmt                                                                                                                     p-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="                                                                                                                     1"
69-libmtp.rules:ATTR{idVendor}=="12d1", ATTR{idProduct}=="361f", SYMLINK+="libmt                                                                                                                     p-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="                                                                                                                     1"
Yesterday, before i turned the raspberry pi off, i unplugged the usb dongle and plugged it into one of the other usb ports. Then i started the pi again, and it worked (Usb dongle was NOT in HiLink mode). Today when i start the raspberry pi, it is still working. Not sure if the problem is fixed, or there still is some stability issue and it is merely lucky that the dongle have been working 2 times in a row....

Re: Disable HiLink of E3256

Posted: 22 Mar 2017, 18:30
by birkelund
LOM wrote:Which Linux kernel version number?
pi@MirrorPi:/ $ uname -r
4.9.13-v7+