Hello,
   This is the most basic code I could think off to
just print out the device descriptor fields. 

----------------------------------------------------
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>

static void * my_usb_probe
(
  struct usb_device *dev, 
  unsigned int ifnum, 
  const struct usb_device_id *table
);

static struct usb_driver my_usb_driver =
{
  name : "driver",
  probe : my_usb_probe
};

static void * my_usb_probe
(
 struct usb_device *dev, 
 unsigned int ifnum, 
 const struct usb_device_id *table
)
{
  dbg("%d %d",dev->descriptor.idVendor,
dev->descriptor.idProduct);

  return NULL;
}

int my_driver_init()
{
  dbg("in init");

  usb_register(&my_usb_driver);

  return 0;
}

void my_driver_exit()
{
  dbg("in exit");
}

module_init (my_driver_init);
module_exit (my_driver_exit);
-----------------------------------------------------
The module loads and I see "in init" in dmesg but the
values for idVendor and idProduct are wrong. Is there
anything that I am doing wrong here.? I included all
the header files mentioned in usb_skeleton.c and the
module loading gives segmentation fault. 

I compile the code using

gcc -c -I/usr/src/linux/include -DDEBUG -D__KERNEL__ 
-DMODULE my_driver.c

                               Thanks in advance      

                               Naveen


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to