Olivetti - Olicard 300: automate driver loading
I'm trying to make an internet usb dongle work.
The device is an Olivetti Olicard 300, which doesn't seems supported for using on Linux, as describes by specs reported on the Olivetti site:
http://www.olivetti.it/Tool/Product/Pan ... 639&idp=60
On this siteThere are some more infos about vendor etc... seems that "2020" vendor id is referred to Visiontek... Look for 2020:0002 and olicard 300 on that page...
Looking for a solution, I've exeprimented a "rude" empirical procedure that is working (even if with some issues with modem-manager: solved by killing its process):
- inserting usbkey it's recognized as 2020:0002 device: "Product MT6225", but it is seen as a "Zero-CD" "/dev/sr?"
- running "eject /dev/sr?" solves the switching problem and appear a new usbdevice recognized as 2020:4000
- at this point there aren't any kernel modules that automagically handle this device so searching on the web I've tried to manually load "usbserial"
- modprobe usbserial vendor=0x2020 product=0x4000
- serial device files /dev/ttyUSB0, USB1 and USB2 appears! And I was able to use /dev/ttyUSB0 as 3G modem, sending various AT commands to it and reading its answers (for example using minicom).
- at the end I'm able also to use a pppd/chat script (but I think also wvdial or other program like that work fine) to "call" my ISP and obtain a "ppp0" internet interface.
- end
But I'cant successfully automate all that procedure using udev rule and a bash script... something goes wrong and It's not a so clean solution.
So I've done a closer look to usb_modeswitch README to learn something more about its way to work.
I've also found a "Mass Message" that seems to work well also for my usb dongle switch as reported there:
http://www.draisberghof.de/usb_modeswit ... f=3&t=1487
So I've tried to automate the switching by using the "clean way": usb_modeswitch!
I've add an entry in /lib/udev/40-usb_modeswich.rules, as well describes usbmodeswitch README and create a custom config file "/etc/usb_modeswitch.d/2020:0002".
Code: Select all
$ grep -A10 Olicard_300 /lib/udev/rules.d/40-usb_modeswitch.rules
# Olivetti Olicard_300 - Tim-21.1 (made by MediaTek MT6225)
ATTRS{idVendor}=="2020", ATTRS{idProduct}=="0002", RUN+="usb_modeswitch '%b/%k'"
# the file is created automatically, PLEASE DO NOT MODIFY IT!!!
LABEL="modeswitch_rules_end"
Code: Select all
$ cat /etc/usb_modeswitch.d/2020\:0002
# Olicard_300
DefaultVendor= 0x2020
DefaultProduct= 0x0002
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
Ok, now seems to work fine all the switch: the default device 2020:0002 is switched to 2020:4000. And I notice no need to stop modem-manager process as before.
I report /var/log/messages records appearing by plug the dongle in.
Code: Select all
pr 14 11:14:39 darkstar kernel: [ 8699.339039] usb 1-4.1: new high-speed USB device number 19 using ehci_hcd
Apr 14 11:14:39 darkstar kernel: [ 8699.431654] usb 1-4.1: New USB device found, idVendor=2020, idProduct=0002
Apr 14 11:14:39 darkstar kernel: [ 8699.431658] usb 1-4.1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
Apr 14 11:14:39 darkstar kernel: [ 8699.431661] usb 1-4.1: Product: MT6225
Apr 14 11:14:39 darkstar kernel: [ 8699.431663] usb 1-4.1: Manufacturer: Network Connect
Apr 14 11:14:39 darkstar kernel: [ 8699.431665] usb 1-4.1: SerialNumber: 531598307853860
Apr 14 11:14:39 darkstar kernel: [ 8699.432341] scsi19 : usb-storage 1-4.1:1.0
Apr 14 11:14:39 darkstar mtp-probe: checking bus 1, device 19: "/sys/devices/pci0000:00/0000:00:04.1/usb1/1-4/1-4.1"
Apr 14 11:14:39 darkstar mtp-probe: bus: 1, device: 19 was not an MTP device
Apr 14 11:14:39 darkstar logger: usb_modeswitch: using overriding config file /etc/usb_modeswitch.d/2020:0002; make sure this is intended
Apr 14 11:14:39 darkstar logger: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files
Apr 14 11:14:39 darkstar usb_modeswitch: switching device 2020:0002 on 001/019
Apr 14 11:14:40 darkstar kernel: [ 8700.447156] usb 1-4.1: USB disconnect, device number 19
Apr 14 11:14:41 darkstar kernel: [ 8701.131039] usb 1-4.1: new high-speed USB device number 20 using ehci_hcd
Apr 14 11:14:41 darkstar kernel: [ 8701.225530] usb 1-4.1: New USB device found, idVendor=2020, idProduct=4000
Apr 14 11:14:41 darkstar kernel: [ 8701.225533] usb 1-4.1: New USB device strings: Mfr=9, Product=10, SerialNumber=0
Apr 14 11:14:41 darkstar kernel: [ 8701.225536] usb 1-4.1: Product: MT6225
Apr 14 11:14:41 darkstar kernel: [ 8701.225539] usb 1-4.1: Manufacturer: Network Connect
Apr 14 11:14:41 darkstar kernel: [ 8701.229784] scsi20 : usb-storage 1-4.1:1.6
Apr 14 11:14:41 darkstar mtp-probe: checking bus 1, device 20: "/sys/devices/pci0000:00/0000:00:04.1/usb1/1-4/1-4.1"
Apr 14 11:14:41 darkstar mtp-probe: bus: 1, device: 20 was not an MTP device
Apr 14 11:14:42 darkstar kernel: [ 8702.235177] scsi 20:0:0:0: Direct-Access UsbModem Storage Disk 6225 PQ: 0 ANSI: 0 CCS
Apr 14 11:14:42 darkstar kernel: [ 8702.252661] sd 20:0:0:0: [sdc] Attached SCSI removable disk
Code: Select all
USB_ModeSwitch log from Tue Apr 14 11:06:14 CEST 2015
Raw args from udev: /1-4.4.2:1.0
Using global config file: /etc/usb_modeswitch.conf
Using top device dir /sys/bus/usb/devices/1-4.4.2
----------------
USB values from sysfs:
manufacturer Network Connect
product MT6225
serial 531598307853860
----------------
SCSI attributes not needed, moving on
checking config: /etc/usb_modeswitch.d/2020:0002
! matched. Reading config data
Using config file from override folder /etc/usb_modeswitch.d
Logger is /usr/bin/logger
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1
Command to be run:
usb_modeswitch -I -W -D -s 20 -b 1 -g 17 -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)
--------------------------------
Reading long config from command line
* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.4 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x2020
DefaultProduct= 0x0002
TargetVendor= not set
TargetProduct= not set
TargetClass= not set
TargetProductList=""
DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint= not set
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
InquireDevice disabled
Success check enabled, max. wait time 20 seconds
System integration mode enabled
Use given bus/device number: 001/017 ...
Note: target parameter missing; success check limited
Looking for default devices ...
bus/device number matched
searching devices, found USB ID 2020:0002
found matching vendor ID
found matching product ID
adding device
Found device in default mode, class or configuration (1)
Getting the current device configuration ...
OK, got current device configuration (1)
Using interface number 0
Using 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 found; name unknown, limitation of libusb1
OK, driver "unkown" detached
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
Bus/dev search active, referring success check to wrapper. Bye.
ok:busdev
--------------------------------
(end of usb_modeswitch output)
Checking success of mode switch for max. 20 seconds ...
Waiting for device file system (1 sec.) ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Reading attributes ...
Target config not matching - current values are
1-4.4.2:1.0/bInterfaceClass: 02
bConfigurationValue: 1
bNumConfigurations: 1
busnum: 1
devnum: 18
idProduct: 4000
idVendor: 2020
manufacturer: Network Connect
product: MT6225
serial:
Mode switching may have failed. Exiting
there aren't any serial device files named /dev/ttyUSB* as expected.
Seems the right kernel module the dongle IDs are to to be added was "option":
Code: Select all
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1
We could "force" option module to manage olicard "2020:4000" device by running the following command:
Code: Select all
Apr 14 12:20:19 darkstar kernel: [12639.790101] option 1-4.1:1.0: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.790230] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB0
Apr 14 12:20:19 darkstar kernel: [12639.790589] option 1-4.1:1.1: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.790649] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB1
Apr 14 12:20:19 darkstar kernel: [12639.791095] option 1-4.1:1.2: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.791295] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB2
Apr 14 12:20:19 darkstar kernel: [12639.791969] option 1-4.1:1.3: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.792083] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB3
Apr 14 12:20:19 darkstar kernel: [12639.792841] option 1-4.1:1.4: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.792905] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB4
Apr 14 12:20:19 darkstar kernel: [12639.793343] option 1-4.1:1.5: GSM modem (1-port) converter detected
Apr 14 12:20:19 darkstar kernel: [12639.793404] usb 1-4.1: GSM modem (1-port) converter now attached to ttyUSB5
Code: Select all
# echo "AT+CFUN=1" >/dev/ttyUSB0
^C-su: echo: write error: Chiamata di sistema interrotta
Code: Select all
# lsmod|grep option
option 17551 0
usb_wwan 7662 1 option
usbserial 26300 2 usb_wwan,option
# modprobe -r option
# modprobe usbserial vendor=0x2020 product=0x4000
Code: Select all
Apr 14 13:22:26 darkstar kernel: [16366.800353] option1 ttyUSB4: GSM modem (1-port) converter now disconnected from ttyUSB4
Apr 14 13:22:26 darkstar kernel: [16366.800369] option 1-4.1:1.4: device disconnected
Apr 14 13:22:26 darkstar kernel: [16366.800426] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
Apr 14 13:22:26 darkstar kernel: [16366.800441] option 1-4.1:1.3: device disconnected
Apr 14 13:22:26 darkstar kernel: [16366.800562] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
Apr 14 13:22:26 darkstar kernel: [16366.800577] option 1-4.1:1.2: device disconnected
Apr 14 13:22:26 darkstar kernel: [16366.800628] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
Apr 14 13:22:26 darkstar kernel: [16366.800642] option 1-4.1:1.1: device disconnected
Apr 14 13:22:26 darkstar kernel: [16366.800755] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
Apr 14 13:22:26 darkstar kernel: [16366.800769] option 1-4.1:1.0: device disconnected
Apr 14 13:22:26 darkstar kernel: [16366.800780] USB Serial deregistering driver GSM modem (1-port)
Apr 14 13:22:26 darkstar kernel: [16366.809006] usbcore: deregistering interface driver usbserial_generic
Apr 14 13:22:26 darkstar kernel: [16366.809019] USB Serial deregistering driver generic
Apr 14 13:22:26 darkstar kernel: [16366.809030] usbcore: deregistering interface driver usbserial
Apr 14 13:22:59 darkstar kernel: [16400.069555] usbcore: registered new interface driver usbserial
Apr 14 13:22:59 darkstar kernel: [16400.069569] USB Serial support registered for generic
Apr 14 13:22:59 darkstar kernel: [16400.069615] usbserial_generic 1-4.1:1.2: generic converter detected
Apr 14 13:22:59 darkstar kernel: [16400.069684] usb 1-4.1: generic converter now attached to ttyUSB0
Apr 14 13:22:59 darkstar kernel: [16400.069693] usbserial_generic 1-4.1:1.3: generic converter detected
Apr 14 13:22:59 darkstar kernel: [16400.069745] usb 1-4.1: generic converter now attached to ttyUSB1
Apr 14 13:22:59 darkstar kernel: [16400.069754] usbserial_generic 1-4.1:1.4: generic converter detected
Apr 14 13:22:59 darkstar kernel: [16400.069806] usb 1-4.1: generic converter now attached to ttyUSB2
Apr 14 13:22:59 darkstar kernel: [16400.069815] usbserial_generic 1-4.1:1.5: generic converter detected
Apr 14 13:22:59 darkstar kernel: [16400.069867] usb 1-4.1: generic converter now attached to ttyUSB3
Apr 14 13:22:59 darkstar kernel: [16400.069882] usbcore: registered new interface driver usbserial_generic
Apr 14 13:22:59 darkstar kernel: [16400.069884] usbserial: USB Serial Driver core
As I said, the above reported behaviour is related to my actual system:
Code: Select all
OS: Slackware-14.0
Kernel: 3.2.45-smp
usb_modeswitch version:
-----------------------
# usb_modeswitch --version
* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.4 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
seems that they using: 2.2.0 usb-modeswitch
and 3.16 linux kernel
Anyway on that new system after installation of modem-manager and usb_modeswitch:
- usb_modeswitch has new config entries and one reports my dongle vendor:product, so the switch is done out of the box, without any config editing needs.
- option module doesn't seems to be able to automatically take and manage the device.
- but if I manually load it and force it to mange the dongle (echo "2020 4000" > /sys/.../new_id), the "option" module of that kernel version seems to be able to manage fine the olicard-300: it makes /dev/ttyUSB* devices and I'm able to use /dev/ttyUSB0 as modem to connect to internet.
Now, I've a couple of questions to you.
Is there a way as cleaner as possible to automate the last step of that specific dongle managment?
usb_modeswitch does the switch, but I need also the modem device /dev/ttyUSB0 to be automatically created by the right kernel module.
I've done a look inside the "option.c" source. An idea could be to insert olicard300 IDs and rebuild/reinstall that module....
... But are we sure there isn't a better driver linux compatible to manage that olicard?
Pharaps also a third party driver to add as a firmware...
Or calling option (or usbserial) module from a udev rule would be the better choice?
Sorry for my very long post!!!
Anyway, hope you can help me...
Thanks in advance!