Activation Codes and Methods, Hardware Details, Sniffing
joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 12 May 2015, 12:35

Logging was already enabled, but Olicard there aren't any ttyUSB related logs files in /var/log/.
Let's clean all old logs:

Code: Select all

# rm /var/log/usb_modeswitch_*
Then let's try to re-plugin olicard dongle... and see what dmesg reports.

Code: Select all

[ 8480.942782] usb 2-4.1: new high-speed USB device number 12 using ehci-pci
[ 8481.023404] usb 2-4.1: New USB device found, idVendor=2020, idProduct=0002
[ 8481.023409] usb 2-4.1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[ 8481.023412] usb 2-4.1: Product: MT6225 
[ 8481.023415] usb 2-4.1: Manufacturer: Network Connect
[ 8481.023417] usb 2-4.1: SerialNumber: 531598307853860
[ 8481.024113] usb-storage 2-4.1:1.0: USB Mass Storage device detected
[ 8481.024336] scsi host15: usb-storage 2-4.1:1.0
[ 8482.044907] usb 2-4.1: USB disconnect, device number 12
[ 8482.734788] usb 2-4.1: new high-speed USB device number 13 using ehci-pci
[ 8482.828280] usb 2-4.1: New USB device found, idVendor=2020, idProduct=4000
[ 8482.828284] usb 2-4.1: New USB device strings: Mfr=9, Product=10, SerialNumber=0
[ 8482.828287] usb 2-4.1: Product: MT6225 
[ 8482.828290] usb 2-4.1: Manufacturer: Network Connect
[ 8482.831077] cdc_mbim 2-4.1:1.0: cdc-wdm1: USB WDM device
[ 8482.831318] cdc_mbim 2-4.1:1.0 wwan1: register 'cdc_mbim' at usb-0000:00:04.1-4.1, CDC MBIM, e6:28:27:10:ea:90
[ 8482.832121] option 2-4.1:1.2: GSM modem (1-port) converter detected
[ 8482.832263] usb 2-4.1: GSM modem (1-port) converter now attached to ttyUSB3
[ 8482.832975] option 2-4.1:1.3: GSM modem (1-port) converter detected
[ 8482.833097] usb 2-4.1: GSM modem (1-port) converter now attached to ttyUSB4
[ 8482.833851] option 2-4.1:1.4: GSM modem (1-port) converter detected
[ 8482.833932] usb 2-4.1: GSM modem (1-port) converter now attached to ttyUSB5
[ 8482.834352] option 2-4.1:1.5: GSM modem (1-port) converter detected
[ 8482.834433] usb 2-4.1: GSM modem (1-port) converter now attached to ttyUSB6
[ 8482.834807] usb-storage 2-4.1:1.6: USB Mass Storage device detected
[ 8482.834879] scsi host16: usb-storage 2-4.1:1.6
[ 8483.838931] scsi 16:0:0:0: Direct-Access     UsbModem Storage Disk     6225 PQ: 0 ANSI: 0 CCS
[ 8483.853161] sd 16:0:0:0: [sdd] Test WP failed, assume Write Enabled
[ 8483.855162] sd 16:0:0:0: [sdd] Asking for cache data failed
[ 8483.855166] sd 16:0:0:0: [sdd] Assuming drive cache: write through
[ 8483.856784] sd 16:0:0:0: [sdd] Attached SCSI removable disk
Ok, now let's go to var log dir and we should have an usbmodeswitch log file related to "2-4.1" usb device...

Code: Select all

# ls /var/log/usb_*
/var/log/usb_modeswitch_2-4.1
As expected...
Now we can open that log file and read what contains...

Code: Select all


USB_ModeSwitch log from Tue May  12 12:10:00 CEST 2015

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: /2-4.1

Use top device dir /sys/bus/usb/devices/2-4.1
Check class of first interface ...
 Interface class is 08.

----------------
USB values from sysfs:
  manufacturer	Network Connect
  product	MT6225
  serial	531598307853860
----------------
ConfigList: /usr/share/usb_modeswitch/2020:0002
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/2020:0002
! matched. Read config data
config: TargetVendor set to 2020
config: TargetProductList set to 2000,4010,4000
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Device may have an MBIM configuration, check driver ...
 driver for MBIM devices is available
Find MBIM configuration number ...
 No MBIM configuration found, switch to legacy modem mode
Command to be run:
usb_modeswitch -W -D -s 20  -b 2 -g 12 -v 2020 -p 0002 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x2020
DefaultProduct= 0x0002
TargetVendor=   0x2020
TargetProductList="2000,4010,4000"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
NeedResponse=0
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Use given bus/device number: 002/012 ...
Look for default devices ...
 bus/device number matched
  found USB ID 2020:0002
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Network Connect
     Product: MT6225 
  Serial No.: 531598307853860
-------------------------
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
Bus/dev search active, refer success check to wrapper. Bye!

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Check success of mode switch for max. 20 seconds ...
 Wait for device file system (1 sec.) ...
 Read attributes ...
 All attributes matched
Mode switching was successful, found 2020:4000 (Network Connect: MT6225)
Logger is /usr/bin/logger
 No vendor-specific class found, skip driver check
Check for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exit
So, we don't have any ttyUSB related log file...
I remember first time I attached my the other dongle... Huawei, ttyUSB related log files were created...


As regard tcl script, on my system dispatcher is a binary executable...

Code: Select all

# file /usr/sbin/usb_modeswitch*
/usr/sbin/usb_modeswitch:            ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
/usr/sbin/usb_modeswitch_dispatcher: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
Anyway I can access to source code and read what usb_modeswitch.tcl contains.
....
Mmmm, it's a bit difficult for me to clearly understand it... and why gsmmodem links is not created, nor I have any ttyUSB related log file
Anyway I'll try to re-read it....

If you can already says something about log I posted, let me know...

Thank again,
see you!

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 12 May 2015, 23:37

joe wrote:As regard tcl script, on my system dispatcher is a binary executable...
So you are not using the latest source from this site?

You obviously are running the Ubuntu fork of the usb_modeswitch dispatcher. That explains a lot.
I don't maintain that one.

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 13 May 2015, 11:02

I'm using this slackware package:

Code: Select all

usb_modeswitch-2.2.1-i486-1"
I've rebuilt it with Volkerding slackbuild... (changing $VERSION var etc...).
Perhaps it is the make argument static that creates a binary version of dispatcher...
The following commands are used by slackbuild script to compile usb_modeswitch package

Code: Select all

make clean
# "make static" uses the embed "jim" Tcl interpreter
make static

install -D -s --mode=755 usb_modeswitch $PKG/usr/sbin/usb_modeswitch
install -D --mode=755 usb_modeswitch.sh $PKG/lib/udev/usb_modeswitch
install -D --mode=644 usb_modeswitch.conf $PKG/etc/usb_modeswitch.conf.new
install -D --mode=644 usb_modeswitch.1 $PKG/usr/man/man1/usb_modeswitch.1
install -d $PKG/var/lib/usb_modeswitch
install -D -s --mode=755 usb_modeswitch_dispatcher $PKG/usr/sbin/usb_modeswitch_dispatcher
You can find the above shell script at:
http://ftp.osuosl.org/pub/slackware/sla ... SlackBuild

Seems also Pat Volkerding upgraded his usb_modeswitch slackbuild to 2.2.1 version on Apr 17... (by just changing first line about copyright adding year "2015").

Code: Select all

# diff /tmp/usb_modeswitch.SlackBuild build/usb_modeswitch/usb_modeswitch.SlackBuild
5c5
< # Copyright 2010, 2012, 2013, 2015  Patrick J. Volkerding, Sebeka, Minnesota, USA
---
> # Copyright 2010, 2012, 2013  Patrick J. Volkerding, Sebeka, Minnesota, USA
As you can see this is not Ubuntu! 8)

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 13 May 2015, 16:00

Ah, I see. I didn't know that anyone actually used that variant ...

Anyway, you have two possibilities: either you install the "tcl" package and leave away the "static" parameter which installs the unchanged script as "usb_modeswitch_dispatcher", or you play around with the script in the source folder and repeat the 'binary' installation like you did before after every edit.

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 13 May 2015, 16:26

I understood, but the problem is how to edit dispatcher script...

I mean, I am still not able to understand why ttyUSB log files ar not created, and why no ttyUSB port is linked to a new /dev/gsmmodem_1 symlink...

That is the matter... :?

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 13 May 2015, 18:36

There may be a bug in the tcl script I have here ...

There is a line right underneath "proc {SymLinkName}".

If it says

"global device"

then change it to

"global device flags".

Any changes?

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 14 May 2015, 01:12

Ok, I've done a little patch... let me know if I well understood your suggest:

Code: Select all

# cat gsmmodem_symlink.patch 
--- usb-modeswitch-2.2.1/usb_modeswitch.tcl     2015-05-13 23:59:15.921409091 +0200
+++ usb_modeswitch.tcl  2015-05-14 00:06:12.796437393 +0200
@@ -736,7 +736,7 @@
 
 
 proc {SymLinkName} {path} {
-global device
+global device flags
 
 proc {hasInterrupt} {ifDir} {
        if {[llength [glob -nocomplain $ifDir/ttyUSB*]] == 0} {
Ok, putted it in build directory, then I've modified the SlackBuild file including the patch:

Code: Select all

# grep -B10 -A10 gsmm usb_modeswitch.SlackBuild 
rm -rf $SRCPKGNAM-$VERSION
tar xvf $CWD/$SRCPKGNAM-$VERSION.tar.?z* || exit 1
cd $SRCPKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# apply patch to tcl script to proper create /dev/gsmmodem symlink
patch < $CWD/gsmmodem_symlink.patch || exit 1

make clean
# "make static" uses the embedded "jim" Tcl interpreter
make static

install -D -s --mode=755 usb_modeswitch $PKG/usr/sbin/usb_modeswitch
install -D --mode=755 usb_modeswitch.sh $PKG/lib/udev/usb_modeswitch
install -D --mode=644 usb_modeswitch.conf $PKG/etc/usb_modeswitch.conf.new
install -D --mode=644 usb_modeswitch.1 $PKG/usr/man/man1/usb_modeswitch.1
install -d $PKG/var/lib/usb_modeswitch
CWD var is set to `pwd`...

Ok, then upgrade my usb_modeswitch package with the just built patched one.
And finally I've plugin the poor Olicard on more time...

This is the new log after upgraded with patched package.

Code: Select all

USB_ModeSwitch log from Thu May  14 00:42:22 CEST 2015

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: /2-4.1

Use top device dir /sys/bus/usb/devices/2-4.1
Check class of first interface ...
 Interface class is 08.

----------------
USB values from sysfs:
  manufacturer	Network Connect
  product	MT6225
  serial	531598307853860
----------------
ConfigList: /usr/share/usb_modeswitch/2020:0002
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/2020:0002
! matched. Read config data
config: TargetVendor set to 2020
config: TargetProductList set to 2000,4010
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Device may have an MBIM configuration, check driver ...
 driver for MBIM devices is available
Find MBIM configuration number ...
 No MBIM configuration found, switch to legacy modem mode
Command to be run:
usb_modeswitch -W -D -s 20  -b 2 -g 14 -v 2020 -p 0002 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x2020
DefaultProduct= 0x0002
TargetVendor=   0x2020
TargetProductList="2000,4010"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
NeedResponse=0
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Use given bus/device number: 002/014 ...
Look for default devices ...
 bus/device number matched
  found USB ID 2020:0002
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Network Connect
     Product: MT6225 
  Serial No.: 531598307853860
-------------------------
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
Bus/dev search active, refer success check to wrapper. Bye!

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Check success of mode switch for max. 20 seconds ...
 Wait for device file system (1 sec.) ...
 Read attributes ...
 Attributes are different but target values are unexpected:
    2-4.1:1.0/bInterfaceClass: 02
    bConfigurationValue:       1
    bNumConfigurations:        1
    busnum:                    2
    devnum:                    15
    idProduct:                 4000
    idVendor:                  2020
    manufacturer:              Network Connect
    product:                   MT6225
    serial:                    
Mode switching was successful, found 2020:4000 (Network Connect: MT6225)
Logger is /usr/bin/logger
 No vendor-specific class found, skip driver check
Check for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exit

Unfortunately, the only /dev/gsmmodem link refers to /dev/ttyUSB0 that is related to my Huawei dongle: it is plugged in too...
I expected a new /dev/gsmmodem_1 linked to /dev/ttyUSB3 (the first ttyUSB file related to first olicard interface managed by option driver...).

Moreover there are no other log file related to ttyUSB probing..

So seems your suggest didn't work...
If I can post some other details to help you, please let me know! I feel we are close to solution! :D

Anyway, thanks a lot for support!
See you

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 17 May 2015, 18:45

Turns out the part with the logging in "SymLinkName" was pretty much screwed up.

Try the attached version of the wrapper script in your source folder.

[deleted]

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 17 May 2015, 23:43

I've tried it, but still no gsmmodem link is created... nor any ttyUSB logs in /var/

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 18 May 2015, 07:47

Hmm - next question: do you have the following line in /lib/udev/rules.d/40-usb_modeswitch.rules?
It's the one that triggers the sym-linking.

Code: Select all

KERNEL=="ttyUSB*", ATTRS{bNumConfigurations}=="*", PROGRAM="usb_modeswitch --symlink-name %p %s{idVendor} %s{idProduct} %E{PRODUCT}", SYMLINK+="%c"

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 18 May 2015, 09:59

Code: Select all

$ grep sym /lib/udev/rules.d/40-usb_modeswitch.rules
# Adds a symlink "gsmmodem[n]" to the lowest ttyUSB port with interrupt
KERNEL=="ttyUSB*", ATTRS{bNumConfigurations}=="*", PROGRAM="usb_modeswitch --symlink-name %p %s{idVendor} %s{idProduct} %E{PRODUCT}", SYMLINK+="%c"
Seems the same...

usbmodeswitch is able to create gsmmodem link, but just for my other dongle (Huawei E-353).

Code: Select all

# file /dev/gsmmodem 
/dev/gsmmodem: symbolic link to `ttyUSB0'
I expected a new link after Olicard plugin, called "gsmmodem_1" or something like that.. and linked at its first "option" interface, that is /dev/ttyUSB3 in this case.

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

Re: Olivetti - Olicard 300: automate driver loading

Post by Josh » 18 May 2015, 11:44

One last check - is the modem USB ID of the Olicard listed in "/var/lib/usb_modeswitch/link_list" ?

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 18 May 2015, 11:59

Nope...

I've noticed thoose files even before and contain just Huawei-E353 VId/PId (12d1:1506)

Code: Select all

# cat /var/lib/usb_modeswitch/bind_list 
12d1:1506
[root@darkstar ~]# cat /var/lib/usb_modeswitch/link_list 
12d1:1506
Nothing related to 2020:4000 Olicard ids.
I thought usb_modeswitch had to automatically fill link_list with proper ids... so I didn't edit anything by hand...
Let me know if we need something like the following:

Code: Select all

echo '2020:4000' >> /var/lib/usb_modeswitch/link_list.

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Olivetti - Olicard 300: automate driver loading

Post by LOM » 18 May 2015, 17:09

Your usb_modeswitch log (7 posts up) does not have pid 4000 in the target product list.
Please correct your 2020:0002 device config file

joe
Posts: 31
Joined: 14 Apr 2015, 14:43

Re: Olivetti - Olicard 300: automate driver loading

Post by joe » 18 May 2015, 17:36

Thank you!
I didn't use a specific config file such as "/etc/usb_modeswitch.d/2020:0002"
Instead I had edited "/usr/share/usb_modeswitch/2020:0002", but this one was replaced at re-install time so now I have:

Code: Select all

# cat /usr/share/usb_modeswitch/2020\:0002 
# Mediatek MT6229, Micromax MMX 377G
TargetVendor=0x2020
TargetProductList="2000,4010"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
Let's try to add "4000" target product ID and a comment referring to MT6225 product name.

Code: Select all

# cat /usr/share/usb_modeswitch/2020\:0002 
# Mediatek MT6229, Micromax MMX 377G, Mediatek MT6225
TargetVendor=0x2020
TargetProductList="2000,4010,4000"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
Now let's try to connect the dongle...

Code: Select all

USB_ModeSwitch log from Mon May  18 17:24:45 CEST 2015

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: /2-4.1

Use top device dir /sys/bus/usb/devices/2-4.1
Check class of first interface ...
 Interface class is 08.

----------------
USB values from sysfs:
  manufacturer	Network Connect
  product	MT6225
  serial	531598307853860
----------------
ConfigList: /usr/share/usb_modeswitch/2020:0002
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/2020:0002
! matched. Read config data
config: TargetVendor set to 2020
config: TargetProductList set to 2000,4010,4000
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Device may have an MBIM configuration, check driver ...
 driver for MBIM devices is available
Find MBIM configuration number ...
 No MBIM configuration found, switch to legacy modem mode
Command to be run:
usb_modeswitch -W -D -s 20  -b 2 -g 13 -v 2020 -p 0002 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x2020
DefaultProduct= 0x0002
TargetVendor=   0x2020
TargetProductList="2000,4010,4000"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
NeedResponse=0
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Use given bus/device number: 002/013 ...
Look for default devices ...
 bus/device number matched
  found USB ID 2020:0002
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Network Connect
     Product: MT6225 
  Serial No.: 531598307853860
-------------------------
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
Bus/dev search active, refer success check to wrapper. Bye!

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Check success of mode switch for max. 20 seconds ...
 Wait for device file system (1 sec.) ...
 Read attributes ...
 All attributes matched
Mode switching was successful, found 2020:4000 (Network Connect: MT6225)
Logger is /usr/bin/logger
 No vendor-specific class found, skip driver check
Check for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exit

Even this time I've obtained just one log file confirming successful mode switching, but no logs about any gsmmodem links... And of course no /dev/gsmmodem_1 found...

Post Reply