Hi,
I am writing a Linux USB driver and got stuck trying to get the probe function
working.
The driver is for a USB 1.1 device with 2 interrupt endpoints (in/out). I have
several of these devices attached (they are controlling one gyroscope and 8
motors on a mobile robot platform), and working with libusb seems to slow.
They have a fixed vendor id (0x400) and each a different product id (jumper
settings). The output of lsusb (usbutils) is attached.
The driver is based on the usb-skeleton.c from 2.6.16, but for debugging
purposes I built a minimal driver that just tries to match the device (and
produces dmesg output). When using vendor/product ids of another usb device (a
joystick), the probe function does get called, provided that i rmmod the usbhid
driver first. The source is attached.
I am suspecting another driver gets probed and claims the device, but have no
idea which. I tried to rmmod as many drivers as possible, an lsmod of the
remaining drivers is attached.
Can I find out which drivers might claim a certain device (e.g. vendor/product
id combination)?
Is there a way to manually trigger a probe (without reattaching)?
Is there an accurate description of the usb probe cycle (except digging through
the linux source itself - which is what I am doing now)?
I'm using a stock debian kernel btw (2.6.16-1-686). My next step will be to
compile a kernel with all of the unnecessary USB parts removed.
Thanks in advance,
Sven Moellers
============================================================================
$ lsusb
Bus 001 Device 014: ID 0400:0007 National Semiconductor Corp.
Bus 001 Device 013: ID 0400:000d National Semiconductor Corp.
Bus 001 Device 012: ID 0400:000c National Semiconductor Corp.
Bus 001 Device 011: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 002: ID 06a3:0464 Saitek PLC
Bus 001 Device 010: ID 0400:000e National Semiconductor Corp.
Bus 001 Device 009: ID 0400:000f National Semiconductor Corp.
Bus 001 Device 008: ID 0400:000b National Semiconductor Corp.
Bus 001 Device 007: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 006: ID 0400:0009 National Semiconductor Corp.
Bus 001 Device 005: ID 0400:0008 National Semiconductor Corp.
Bus 001 Device 004: ID 0400:000a National Semiconductor Corp.
Bus 001 Device 003: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 001: ID 0000:0000
============================================================================
$ lsmod
Module Size Used by
floppy 55628 0
ext3 115880 1
jbd 46932 1 ext3
mbcache 7652 1 ext3
ide_generic 1120 0 [permanent]
ide_disk 14528 3
piix 8932 0 [permanent]
generic 4164 0 [permanent]
uhci_hcd 26640 0
ide_core 111440 4 ide_generic,ide_disk,piix,generic
usbcore 110560 2 uhci_hcd
e100 31044 0
mii 5056 1 e100
processor 21376 0
============================================================================
// source of the driver (minimal version for probe debugging)
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/usb.h>
#define USB_GYRO_VENDOR_ID 0x0400
#define USB_GYRO_PRODUCT_ID 0x0007
#define JS_VENDOR 0x06a3
#define JS_PRODUCT 0x0464
static struct usb_device_id gyro_table [] = {
{ USB_DEVICE(USB_GYRO_VENDOR_ID, USB_GYRO_PRODUCT_ID) },
// not working
{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR, .idVendor=USB_GYRO_VENDOR_ID },
// not working
//{ .match_flags = 0, .driver_info = 123 },
// matches everything - working for joystick
//{ USB_DEVICE(JS_VENDOR, JS_PRODUCT) },
// working
//{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR, .idVendor=JS_VENDOR },
// working
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, gyro_table);
static int gyro_probe(struct usb_interface *interface, const struct
usb_device_id *id)
{
err("********************* PROBE ***********************\n");
return 0;
}
static void gyro_disconnect(struct usb_interface *interface)
{
err("******************* DISCONNECT ********************\n");
}
static struct usb_driver gyro_driver = {
.name = "gyroscope",
.probe = gyro_probe,
.disconnect = gyro_disconnect,
.id_table = gyro_table,
//.no_dynamic_id = 0 // doesnt make a difference (concerning probe) if
enabled/disabled
};
static int __init usb_gyro_init(void)
{
int result;
err("********************* INIT *************************\n");
result = usb_register(&gyro_driver);
if (result)
err("usb_register failed. Error number %d", result);
return result;
}
static void __exit usb_gyro_exit(void)
{
err("********************* EXIT *************************\n");
usb_deregister(&gyro_driver);
}
module_init (usb_gyro_init);
module_exit (usb_gyro_exit);
MODULE_LICENSE("GPL");
----------------------------------------------------------------
This message was sent using ATIS-Webmail: http://www.atis.uka.de
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel