Where in The Linux Source Does Recognition of Specific Usb Devices Happen

Where in the Linux source does recognition of specific USB devices happen?

There are a lot of other parameters besides vendor and product ID that can influence which driver is chosen. There's a version number, device class, subclass, and protocol, and interface class, subclass, and protocol. The kernel reads all of those from the device and builds up a string containing all of them that looks like this (example is one of my devices, not yours):

usb:v15A9p0004d0001dc00dsc00dp00icFFiscFFipFF

That string is then passed to modprobe, which matches it against strings (with wildcards) found in the modules themselves. You can see the list of matching rules for a particular module by running modinfo on it. The source code construct that corresponds to those rules is MODULE_DEVICE_TABLE. The individual entries in the device table are usually built with the USB_DEVICE macro, so grepping USB_DEVICE.*8187 instead of just 8187 should narrow it down.

If you have a device plugged in and working, you can find out which driver is associated with it by looking at its sysfs entry:

ls -l /sys/bus/usb/devices/*/driver

If you can build one of those device descriptor strings, you can ask modprobe to look the driver up for you without actually loading it by doing this (again my device as example):

modprobe -v -n 'usb:v15A9p0004d0001dc00dsc00dp00icFFiscFFipFF'

All of the numbers are available in the output of lsusb -v if you can get it. If not, try zeros and maybe you'll get a wildcard match. Make sure you use uppercase letters for your hex digits, and lowercase for everything else. This will only work if the driver is present in /lib/modules so it's no good for finding drivers that were left out of your kernel compile.

If all else fails, the low-tech approach is to take the human-readable device name from lsusb, and google it plus the word "Linux".

Using some of the above methods, I found that your device's driver is called rtl8187, with the vendor and product IDs registered from drivers/net/wireless/rtl818x/rtl8187/dev.c.

Forcing driver to device match

Find the module in the sysfs tree. In this case it was in

/sys/bus/usb-serial/drivers/cp2101

In this directory, there is a new_id file entry that can be used to dynamically add VID PID pair like this :

echo VID PID >new_id

Here is a LWN entry about this feature

Android Studio doesn't see device

To change what your application defaults to when you click run or debug in Android Studio, follow these steps:

1. go to Run

2. Click on Edit Configurations

3. Select the project

4. find the Target Device section under the General tab on the Android Application page.

That seems to be where you toggle what the project builds to. If you're importing a project it actually defaults to Emulator, not sure why. You can also select "Open Select Deployment Target Dialog" to list both connected as well as emulated devices.

My Android device does not appear in the list of adb devices

Looks like the installed driver was in bad state. Here is what I did to make it work:

  1. Delete the device from Device Manager.
  2. Rescan for hardware changes.
  3. List item "Slate 21" will show up with "Unknown driver" status.
  4. Click on "Update Driver" and select /extras/google/usb_driver

Device Manager will find the driver and warn you about installing it. Select "Yes."
This time the device got installed properly.

Note that I didn't have to modify winusb.inf file or update any other driver.

Hope this helps.

Is there any telephony framework in linux?

Yes it is is called ofono - project started by Intel/Nokia for Maemo/Moblin. From wikipedia:

oFono is a free, open source project for mobile telephony (GSM/UMTS)
applications. It uses high-level D-Bus API for use by telephony
applications. It uses 3GPP standard. It is free software released
under the terms of the GNU General Public License v2.

And Asterisk and Freeswitch are PBX software and probably are not what you are looking for.



Related Topics



Leave a reply



Submit