LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Using udev to tell Ubuntu to use the proper device on a multiple USB device (http://www.linuxquestions.org/questions/linux-hardware-18/using-udev-to-tell-ubuntu-to-use-the-proper-device-on-a-multiple-usb-device-722469/)

Jeff91 04-29-2009 08:03 AM

Using udev to tell Ubuntu to use the proper device on a multiple USB device
 
I have a USB device that contains multiple devices, the ID on it when I plug it in by default is:
Code:

Bus 005 Device 016: ID 1f28:0021
How ever to get the part of the device I need to work it has ID
Code:

Bus 005 Device 015: ID 1f28:0020
I am reading through the udev man file and it is starting to make my head spin... is there a simple method I can go about using to tell it to use the ID I want it to?... To be honest I'm surprised Ubuntu doesn't support multiple USB devices.

~Jeff

jschiwal 04-29-2009 09:13 AM

Does the /var/log/messages file contain references to both?

What is this device?

Jeff91 04-29-2009 11:33 AM

Here is the output when I plug the device in and it does not display what I want:
Code:

Apr 29 11:29:43 eeetop kernel: [ 9988.157115] usb 3-1: new full speed USB device using uhci_hcd and address 3
Apr 29 11:29:43 eeetop kernel: [ 9988.325192] usb 3-1: configuration #1 chosen from 1 choice
Apr 29 11:29:43 eeetop kernel: [ 9988.346768] scsi3 : SCSI emulation for USB Mass Storage devices
Apr 29 11:29:48 eeetop kernel: [ 9993.385287] scsi 3:0:0:0: Direct-Access    Cricket  T-Flash Disk    2.31 PQ: 0 ANSI: 2
Apr 29 11:29:48 eeetop kernel: [ 9993.390256] scsi 3:0:0:1: CD-ROM            Cal-Comp CD INSTALLER    2.31 PQ: 0 ANSI: 0
Apr 29 11:29:48 eeetop kernel: [ 9993.428562] sd 3:0:0:0: [sdb] Attached SCSI removable disk
Apr 29 11:29:48 eeetop kernel: [ 9993.430789] sd 3:0:0:0: Attached scsi generic sg1 type 0
Apr 29 11:29:50 eeetop kernel: [ 9995.001222] sr0: scsi3-mmc drive: 0x/0x caddy
Apr 29 11:29:50 eeetop kernel: [ 9995.019616] sr 3:0:0:1: Attached scsi generic sg2 type 5
Apr 29 11:29:50 eeetop kernel: [ 9995.277199] sr: Sense Key : No Sense [current]
Apr 29 11:29:50 eeetop kernel: [ 9995.277209] sr: Add. Sense: No additional sense information
Apr 29 11:29:50 eeetop kernel: [ 9995.485359] usb 3-1: reset full speed USB device using uhci_hcd and address 3
Apr 29 11:29:50 eeetop kernel: [ 9995.756131] usb 3-1: reset full speed USB device using uhci_hcd and address 3
Apr 29 11:29:51 eeetop kernel: [ 9996.043787] usb 3-1: reset full speed USB device using uhci_hcd and address 3
Apr 29 11:29:52 eeetop kernel: [ 9997.040616] sr: Sense Key : No Sense [current]
Apr 29 11:29:52 eeetop kernel: [ 9997.040626] sr: Add. Sense: No additional sense information
Apr 29 11:29:52 eeetop kernel: [ 9997.047279] sr: Sense Key : No Sense [current]
Apr 29 11:29:52 eeetop kernel: [ 9997.047301] sr: Add. Sense: No additional sense information
Apr 29 11:29:52 eeetop kernel: [ 9997.056382] sr: Sense Key : No Sense [current]
Apr 29 11:29:52 eeetop kernel: [ 9997.056392] sr: Add. Sense: No additional sense information
Apr 29 11:29:52 eeetop kernel: [ 9997.077278] sr: Sense Key : No Sense [current]
Apr 29 11:29:52 eeetop kernel: [ 9997.077299] sr: Add. Sense: No additional sense information

The device is a Cricket Wireless Model A600 Broadband USB Modem - on Windows it has a auto play feature that installs the drivers, the modem part itself, and lastly a MircoSD card slot. So it makes sense that it is showing as a 3 in 1 USB device. I have to get my other computer to get the method to display when it works (I will post that in a couple of hours) I believe the modem (the part of the device I need) is choice #2 though. Any ideas how I can force it to use that option when I hook it up?

Thanks,
~Jeff

tredegar 04-29-2009 01:17 PM

Quote:

...on Windows it has a auto play feature that installs the drivers..
Some of these devices are initially recognised as a CD-ROM or equivalent by linux (and windows). Windows "auto-runs" the "CD" to install the windows drivers.

The linux kernel may have advanced somewhat since I first encountered this problem with a huawei USB mobile-"phone"-dongle for mobile internet access but the utility that cracked the problem for me was usb_modeswitch - use your search engine, or see here:
http://www.draisberghof.de/usb_modeswitch/

The fact that your device (probably) isn't a Huawei doesn't matter, but switching its mode from appearing as a CD-ROM to becoming a functional device does.

Jeff91 04-29-2009 02:10 PM

Yes I found that Utility, how ever it does not currently support the Cricket A600, and I could not figure out how to register for their forums, and nor could I find the developers email thusly I am here looking for a manner of manually changing the mode :/ It does auto detect as a CD rom drive on linux/windows. I just need to figure out how to have it detect as a modem by default instead of the CD drive... I wonder if they will ever include multi-device usb into linux by default... it sounds it would save alot of people (not just me) more than a few head aches. In the mean time any idea how I can go about manually changing which part of the device Ubuntu uses?

~Jeff

tredegar 04-29-2009 02:35 PM

"Cricket A600"

Is a manufacturer's label. We'd be better informed if you gave us the output of lsusb (from a terminal).

Like this:
Code:

tred@vaio:~$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 046d:c03f Logitech, Inc. UltraX Optical Mouse
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
tred@vaio:~$


Which (Hexadecimal codes) identify your device? We are not interested in your mouse, keyboard, or whatever, just the cricket thing.

usb_modeswitch needs these hex codes to identify which exact device to switch from appearing to be a CD-ROM (we don't need that) to a functional device (we do need that). Then it can (probably) switch it to a functional mode, rather than "Hello windows, I'm a CD-ROM, install the windows drivers" (which won't work with linux, because has its own loadable or built-in modules).

Jeff91 04-29-2009 02:43 PM

I posted those IDs right off the bat here they are again:

Quote:

Originally Posted by Jeff91 (Post 3524657)
I have a USB device that contains multiple devices, the ID on it when I plug it in by default is:
Code:

Bus 005 Device 016: ID 1f28:0021
How ever to get the part of the device I need to work it has ID
Code:

Bus 005 Device 015: ID 1f28:0020

Please note that the second ID number is the one displayed from lsusb when the device is detected as a modem by my network manager, the first is when it is simply plugged in and is detected as an auto-medium.

Also here is the out put in the /var/log/messages when I plug in the device, then connect it to my VM, and then give it back to Ubuntu so it detects as the modem again:
Code:

Apr 29 14:36:42 lintop kernel: [61750.189090] usb 5-1: new full speed USB device using uhci_hcd and address 17
Apr 29 14:36:42 lintop kernel: [61750.409817] usb 5-1: configuration #1 chosen from 1 choice
Apr 29 14:36:43 lintop kernel: [61750.420184] scsi34 : SCSI emulation for USB Mass Storage devices
Apr 29 14:36:48 lintop kernel: [61755.428174] scsi 34:0:0:0: Direct-Access    Cricket  T-Flash Disk    2.31 PQ: 0 ANSI: 2
Apr 29 14:36:48 lintop kernel: [61755.431167] scsi 34:0:0:1: CD-ROM            Cal-Comp CD INSTALLER    2.31 PQ: 0 ANSI: 0
Apr 29 14:36:48 lintop kernel: [61755.438254] sd 34:0:0:0: [sdb] Attached SCSI removable disk
Apr 29 14:36:48 lintop kernel: [61755.438378] sd 34:0:0:0: Attached scsi generic sg2 type 0
Apr 29 14:36:49 lintop kernel: [61757.008224] sr1: scsi3-mmc drive: 0x/0x caddy
Apr 29 14:36:49 lintop kernel: [61757.009526] sr 34:0:0:1: Attached scsi generic sg3 type 5
Apr 29 14:36:49 lintop kernel: [61757.251177] sr: Sense Key : No Sense [current]
Apr 29 14:36:49 lintop kernel: [61757.251181] sr: Add. Sense: No additional sense information
Apr 29 14:36:50 lintop kernel: [61757.453100] usb 5-1: reset full speed USB device using uhci_hcd and address 17
Apr 29 14:36:50 lintop kernel: [61757.729347] usb 5-1: reset full speed USB device using uhci_hcd and address 17
Apr 29 14:36:50 lintop kernel: [61758.012115] usb 5-1: reset full speed USB device using uhci_hcd and address 17
Apr 29 14:36:51 lintop kernel: [61758.589172] sr: Sense Key : No Sense [current]
Apr 29 14:36:51 lintop kernel: [61758.589176] sr: Add. Sense: No additional sense information
Apr 29 14:36:51 lintop kernel: [61758.597168] sr: Sense Key : No Sense [current]
Apr 29 14:36:51 lintop kernel: [61758.597171] sr: Add. Sense: No additional sense information
Apr 29 14:36:51 lintop kernel: [61758.605167] sr: Sense Key : No Sense [current]
Apr 29 14:36:51 lintop kernel: [61758.605170] sr: Add. Sense: No additional sense information
Apr 29 14:36:51 lintop kernel: [61758.627175] sr: Sense Key : No Sense [current]
Apr 29 14:36:51 lintop kernel: [61758.627179] sr: Add. Sense: No additional sense information
Apr 29 14:37:50 lintop kernel: [61817.872116] usb 5-1: USB disconnect, address 17
Apr 29 14:37:55 lintop kernel: [61822.956082] usb 5-1: new full speed USB device using uhci_hcd and address 18
Apr 29 14:37:55 lintop kernel: [61823.181849] usb 5-1: configuration #1 chosen from 1 choice
Apr 29 14:37:55 lintop kernel: [61823.185546] cdc_acm 5-1:1.0: ttyACM0: USB ACM device
Apr 29 14:37:55 lintop kernel: [61823.217177] scsi35 : SCSI emulation for USB Mass Storage devices
Apr 29 14:38:00 lintop kernel: [61828.221192] scsi 35:0:0:0: Direct-Access    Cricket  T-Flash Disk    2.31 PQ: 0 ANSI: 2
Apr 29 14:38:00 lintop kernel: [61828.233809] sd 35:0:0:0: [sdb] Attached SCSI removable disk
Apr 29 14:38:00 lintop kernel: [61828.238805] sd 35:0:0:0: Attached scsi generic sg2 type 0
Apr 29 14:38:17 lintop kernel: [61844.633065] usb 5-1: reset full speed USB device using uhci_hcd and address 18
Apr 29 14:38:17 lintop kernel: [61844.790392] scsi36 : SCSI emulation for USB Mass Storage devices
Apr 29 14:38:17 lintop kernel: [61844.791231] cdc_acm 5-1:1.0: ttyACM0: USB ACM device
Apr 29 14:38:22 lintop kernel: [61849.793333] scsi 36:0:0:0: Direct-Access    Cricket  T-Flash Disk    2.31 PQ: 0 ANSI: 2
Apr 29 14:38:22 lintop kernel: [61849.809944] sd 36:0:0:0: [sdb] Attached SCSI removable disk
Apr 29 14:38:22 lintop kernel: [61849.814528] sd 36:0:0:0: Attached scsi generic sg2 type 0

Let me know if other information is need to help me get this issue solved.

~Jeff

tredegar 04-29-2009 02:56 PM

Oh!

So NOW you tell us you are running a VM ("Virtual Machine" Yes ?)

This makes a BIG difference, and, frankly I am out of here, because running VMs introduces another thick layer of complexity and obfuscation.

My suggestion is to get this hardware running on a real machine, then troubleshoot for the virtual machine.

One step at a time.

Good luck.

Jeff91 04-29-2009 03:05 PM

Quote:

Originally Posted by tredegar (Post 3525060)
So NOW you tell us you are running a VM ("Virtual Machine" Yes ?)

Incorrect - let me stop and explain for a moment.

The Cricket device needed to be activated on a Windows/OSX system before it can be used. I do not have Windows installed on any of my computers other than as a VM, so I loaded up the VM installed the Cricket software on it and registered the Modem on it - and the modem works just perfectly on the Windows VM. After I unassigned the Modem from the VM (giving control of it back to Ubuntu) it worked just fine. How ever the next time I plugged it in it did not display in my network manager as it had after being attached to the VM. So out of curiosities sake I loaded the VM back up - assigned control of the USB device to the VM for a moment and then promptly gave it back to Ubuntu - lo and behold after doing this the modem once more appeared in my network manager as a broadband modem. This little dance if fine and dandy for my G1Sn, how ever my EEE PC does not support vitalisation, so I need to figure out how to get it to display properly WITHOUT first having to attach and then un-attach the device to a Windows VM. Also if you look at the top the hexadecimal output number of the modem is different on Ubuntu before/after it has been attached to the Windows VM.

Sorry if I was not very clear at first - hope you can still help me some. The device is up and working fine on Windows (VM and otherwise - tried a friend's laptop) how ever it only shows up in my Ubuntu network manager after having been attached and un-attached from a Windows VM I have running on my Ubuntu system. If I need more clarification please let me know.

Thanks,
~Jeff

tredegar 04-29-2009 04:27 PM

Quote:

Incorrect - let me stop and explain for a moment.
Well, you ARE running Vmware. You should be corrected.

First of all I do not use VMs, so I cannot offer much help, but .....

Some hints though (you'll have to do your own research, because this is outside my experience):

Some devices need firmware uploading to them at boot time, or they don't work. If you power them off you'll be back at square one.

If one of your VMs (windows?) is uploading the firmware to your device, and making it work then so be it.
You need to identify what it is that is being uploaded to the device to make it work.

Some background:

Some Realtek ethernet chipsets will not work with linux unless the user has first booted to windows, then rebooted (without powering-off) to linux. The bottom line is that something has to be uploaded to the chipset to make it work. this is the "firmware". If it is not installed to the device, it will not work.

Quote:

Also if you look at the top the hexadecimal output number of the modem is different on Ubuntu before/after it has been attached to the Windows VM.
You are correct: Windows has switched the "mode" of the device, so it now shows up differently and is now functional for linux because the device has had its OS installed.

usb_modeswitch can do this for you. But you may need something in /usr/lib/firmware for it to upload.

Sorry, but I cannot help you further for now.

Jeff91 04-29-2009 08:35 PM

Thanks for the info tredegar, any one have any idea how I can go about getting my cricket to work with usb-modeswitch or how I can manually do what ever it is modeswitch does to change the "mode" of the device? I haven't had to dual boot in almost 6 months but if I can't get this device working under Ubuntu I'm going to have to clutter my Netbook's SSD with a Windows partition bleh

~Jeff

Jeff91 04-29-2009 10:00 PM

So I have been reading the documentation on the usb-modeswitch site and this is what I have attempted to add to my usb_modeswitch.conf:
Code:

DefaultVendor = 0x1f28
DefaultProduct = 0x0021

TargetVendor = 0x1f28
TargetProduct = 0x0020

MessageEndpoint = 0x08
MessageContent = "55534243d0e935861200000080000c03000000120000000000000000000000"

Anyone ever use this program before? When I run the switch command I get this error in terminal:
Code:

jeff@lintop:~$ sudo /sbin/usb_modeswitch -c /etc/usb_modeswitch.conf

 * usb_modeswitch: tool for controlling "flip flop" mode USB devices
 * Version 0.9.7 (C) Josua Dietze 2009
 * Works with libusb 0.1.12 and probably other versions

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found default devices (1)
Prepare switching, accessing device 005 on bus 005 ...
Looking for active driver ...
 No driver found. Either detached before or never attached
Setting up communication with interface 0 ...
Trying to send the message to endpoint 0x08 ...
 Sending the message returned error -110. Trying to continue
-> Run lsusb to note any changes. Bye

There is no change to my lsusb output after running this. I havn't been able to find what error -110 means but I will continue crawling google for it...

~Jeff

tredegar 04-30-2009 09:08 AM

You may not be sending it the correct MessageContent string. Where did you get that string from?

The link I gave you in post #4 has a link to this page:

http://blogger.ziesemer.com/2008/10/...do-ubuntu.html

Where Mark Ziesemer explains how to use usbsnoop to grab the string which is needed.

You should try that.

Jeff91 04-30-2009 11:36 AM

That is the correct message string (I triple checked it being so long) I used USBSnoop to find that value. Any other ideas what I might be doing wrong?

~Jeff

tredegar 04-30-2009 12:28 PM

Quote:

I used USBSnoop to find that value.
You have been busy. I'm impressed with the steps you have taken so far (and now I sort of understand about the VM bit! Apologies for my confusion.)

To get my Huawei to cease being a "CD-ROM" and become a mobile-phone modem, I had to issue two commands:
Code:

/sbin/usb_modeswitch -v 12d1 -p 1001 -d 1
/sbin/usb_modeswitch -v 12d1 -p 1001 -H 1

But the second one is unlikely to help you as it is for "Huawei"
See here:
Code:

tred@vaio:~$ usb_modeswitch -h

 * usb_modeswitch: tool for controlling "flip flop" mode USB devices
 * Version 0.9.4 (C) Josua Dietze 2008
 * Works with libusb 0.1.12 and probably other versions

Usage: usb_modeswitch [-hvpVPmMrdHn] [-c config-file]

 -h, --help                    this help
 -v, --DefaultVendor [nr]      set vendor number to look for
 -p, --DefaultProduct [nr]    set model number to look for
 -V, --TargetVendor [nr]      target vendor; if found, quit
 -P, --TargetProduct [nr]      target model, if found quit
 -C, --TargetClass [nr]        target Device class, if found quit
 -m, --MessageEndpoint [nr]    where to write message
 -M, --MessageContent [nr]    message to send
 -n, --NeedResponse [1|0]      whether to try to read a response
 -r, --ResponseEndpoint [nr]  where to read response from
 -d, --DetachStorageOnly [1|0] whether to just detach the storage driver
 -H, --HuaweiMode [1|0]        whether to just apply a special sequence
 -c, --config [config-file]    load named config file
 -Q, --quiet                  don't show progress or error messages
 -W, --verbose                print all settings before running

You need the -d option I think.

Otherwise, can you post the output of usbsnoop as in Mark Ziesemer's page? Maybe there's something you have missed.

I am not sure what this means:
"Looking for active driver ...
No driver found. Either detached before or never attached"
Is it worth taking a peek (gulp!) at the source code to see if that gives some idea of what modeswitch is trying to do?

Can you read the "CD-ROM" when it is first plugged in? Any useful information there?

Do other USB devices work OK for you?

Don't give up. That Huawei device nearly drove me crazy, but I cracked the problem in the end, and (upon reflection) it was a useful "learning experience" in that I had to get to grips with things I had shied away from, like writing udev rules and ....


All times are GMT -5. The time now is 11:13 PM.