* vid&pid problems in usb_probe()
@ 2004-05-08 3:48 dongzai007
2004-05-08 4:45 ` Randy.Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: dongzai007 @ 2004-05-08 3:48 UTC (permalink / raw)
To: linux-kernel
I am writting an usb driver.You know function usb_probe(...) is used to determine whether the usbdevices just pluged in is what the driver is for.
The Vid and Pid of my usb device are 0x1111 and 0x0000 respectively.
the program is :
static void* usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
{
..............
..............
printk("<1>Vid:%x\nPid:%x\n",udev->descriptor.idVendor,udev->descriptor.idProduct);
if ((udev->descriptor.idVendor!=0x1111)
||(udev->descriptor.idProduct!=0x0000)) return NULL;
..............
}
when I plug the device whose vid & pid is 0x1111 & 0x0000 respectively.
this Module displayed
Vid:0
Pid:201
usb.c ........ no active driver for this device;
and when I plug another device , I also got wrong vid & pid.
But when I wrote program as below:
__u16 tmp=0x1111;
printk("<1>%x",tmp);
it can print "1111" on the screen. That means my syntax is correct.
I mean, the problem may be at the data transfered into function usb_probe()
Maybe data transfered into function usb_probe() is wrong.
I wonder where is the problem, how can i solve.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: vid&pid problems in usb_probe()
2004-05-08 3:48 vid&pid problems in usb_probe() dongzai007
@ 2004-05-08 4:45 ` Randy.Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy.Dunlap @ 2004-05-08 4:45 UTC (permalink / raw)
To: dongzai007; +Cc: linux-kernel
On Sat, 8 May 2004 11:48:44 +0800 (CST) <dongzai007@sohu.com> wrote:
|
|
| I am writting an usb driver.You know function usb_probe(...) is used to determine whether the usbdevices just pluged in is what the driver is for.
a. Please learn to use the Enter/Return key around character position
70 (or before) on each line.
b. what kernel version? (*always*)
c. You should ask this on the linux-usb-development mailing list:
linux-usb-devel@lists.sf.net
| The Vid and Pid of my usb device are 0x1111 and 0x0000 respectively.
|
| the program is :
|
| static void* usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
| {
| ..............
| ..............
|
| printk("<1>Vid:%x\nPid:%x\n",udev->descriptor.idVendor,udev->descriptor.idProduct);
|
| if ((udev->descriptor.idVendor!=0x1111)
| ||(udev->descriptor.idProduct!=0x0000)) return NULL;
|
| ..............
| }
|
| when I plug the device whose vid & pid is 0x1111 & 0x0000 respectively.
| this Module displayed
|
|
| Vid:0
| Pid:201
|
| usb.c ........ no active driver for this device;
|
| and when I plug another device , I also got wrong vid & pid.
|
| But when I wrote program as below:
|
| __u16 tmp=0x1111;
| printk("<1>%x",tmp);
|
| it can print "1111" on the screen. That means my syntax is correct.
| I mean, the problem may be at the data transfered into function usb_probe()
| Maybe data transfered into function usb_probe() is wrong.
|
| I wonder where is the problem, how can i solve.
Seeing more (or all) of your source code could help.
I'm especially curious (suspicious) about your USB descriptor data
structures.
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: vid&pid problems in usb_probe()
@ 2004-05-08 9:05 dongzai007
2004-05-08 17:25 ` Randy.Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: dongzai007 @ 2004-05-08 9:05 UTC (permalink / raw)
To: linux-kernel
Thank you for replying,but I don't know what you mean,
USB descriptor data structure is defined in
"/usr/include/linux/usb.h"
my kernel version is 2.4.18.
----- Original Message -----
From: Randy.Dunlap
To: dongzai007@sohu.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: vid&pid problems in usb_probe()
Sent: Sat May 08 12:45:54 CST 2004
> On Sat, 8 May 2004 11:48:44 +0800 (CST) <dongzai007@sohu.com> wrote:
>
> |
> |
> | I am writting an usb driver.You know function usb_probe(...) is used to determine whether the usbdevices just pluged in is what the driver is for.
>
> a. Please learn to use the Enter/Return key around character position
> 70 (or before) on each line.
>
> b. what kernel version? (*always*)
>
> c. You should ask this on the linux-usb-development mailing list:
> linux-usb-devel@lists.sf.net
>
>
> | The Vid and Pid of my usb device are 0x1111 and 0x0000 respectively.
> |
> | the program is :
> |
> | static void* usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
> | {
> | ..............
> | ..............
> |
> | printk("<1>Vid:%x
Pid:%x
",udev->descriptor.idVendor,udev->descriptor.idProduct);
> |
> | if ((udev->descriptor.idVendor!=0x1111)
> | ||(udev->descriptor.idProduct!=0x0000)) return NULL;
> |
> | ..............
> | }
> |
> | when I plug the device whose vid & pid is 0x1111 & 0x0000 respectively.
> | this Module displayed
> |
> |
> | Vid:0
> | Pid:201
> |
> | usb.c ........ no active driver for this device;
> |
> | and when I plug another device , I also got wrong vid & pid.
> |
> | But when I wrote program as below:
> |
> | __u16 tmp=0x1111;
> | printk("<1>%x",tmp);
> |
> | it can print "1111" on the screen. That means my syntax is correct.
> | I mean, the problem may be at the data transfered into function usb_probe()
> | Maybe data transfered into function usb_probe() is wrong.
> |
> | I wonder where is the problem, how can i solve.
>
> Seeing more (or all) of your source code could help.
> I'm especially curious (suspicious) about your USB descriptor data
> structures.
>
> --
> ~Randy
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: vid&pid problems in usb_probe()
2004-05-08 9:05 dongzai007
@ 2004-05-08 17:25 ` Randy.Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy.Dunlap @ 2004-05-08 17:25 UTC (permalink / raw)
To: dongzai007; +Cc: linux-kernel
On Sat, 8 May 2004 17:05:24 +0800 (CST) <dongzai007@sohu.com> wrote:
| Thank you for replying,but I don't know what you mean,
| USB descriptor data structure is defined in
| "/usr/include/linux/usb.h"
|
| my kernel version is 2.4.18.
Are you saying that your driver uses /usr/include/linux/usb.h ?
If so, that's wrong. It should use linux-2.4.18/include/linux/usb.h
instead, and it will if you build/make the driver correctly.
So, how do you build this driver? Show the Makefile or command
line that you use.
Regarding the data structure, I don't know what /usr/include/linux/usb.h
on your system contains since that is not a kernel header file (and
drivers shouldn't use those). I do recall, however, that many moons
ago, there were some usb structs in usb.h that were not defined
with __attribute__((packed)), and that could cause field offsets
to be off a bit, er, byte (or more).
And what processor arch. are you doing this on?
Driver source code?
~Randy
| ----- Original Message -----
| From: Randy.Dunlap
| To: dongzai007@sohu.com
| Cc: linux-kernel@vger.kernel.org
| Subject: Re: vid&pid problems in usb_probe()
| Sent: Sat May 08 12:45:54 CST 2004
|
| > On Sat, 8 May 2004 11:48:44 +0800 (CST) <dongzai007@sohu.com> wrote:
| >
| > |
| > |
| > | I am writting an usb driver.You know function usb_probe(...) is used to determine whether the usbdevices just pluged in is what the driver is for.
| >
| > a. Please learn to use the Enter/Return key around character position
| > 70 (or before) on each line.
| >
| > b. what kernel version? (*always*)
| >
| > c. You should ask this on the linux-usb-development mailing list:
| > linux-usb-devel@lists.sf.net
| >
| >
| > | The Vid and Pid of my usb device are 0x1111 and 0x0000 respectively.
| > |
| > | the program is :
| > |
| > | static void* usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
| > | {
| > | ..............
| > | ..............
| > |
| > | printk("<1>Vid:%x
| Pid:%x
| ",udev->descriptor.idVendor,udev->descriptor.idProduct);
| > |
| > | if ((udev->descriptor.idVendor!=0x1111)
| > | ||(udev->descriptor.idProduct!=0x0000)) return NULL;
| > |
| > | ..............
| > | }
| > |
| > | when I plug the device whose vid & pid is 0x1111 & 0x0000 respectively.
| > | this Module displayed
| > |
| > |
| > | Vid:0
| > | Pid:201
| > |
| > | usb.c ........ no active driver for this device;
| > |
| > | and when I plug another device , I also got wrong vid & pid.
| > |
| > | But when I wrote program as below:
| > |
| > | __u16 tmp=0x1111;
| > | printk("<1>%x",tmp);
| > |
| > | it can print "1111" on the screen. That means my syntax is correct.
| > | I mean, the problem may be at the data transfered into function usb_probe()
| > | Maybe data transfered into function usb_probe() is wrong.
| > |
| > | I wonder where is the problem, how can i solve.
| >
| > Seeing more (or all) of your source code could help.
| > I'm especially curious (suspicious) about your USB descriptor data
| > structures.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: vid&pid problems in usb_probe()
@ 2004-05-09 2:03 dongzai007
2004-05-09 2:16 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: dongzai007 @ 2004-05-09 2:03 UTC (permalink / raw)
To: linux-kernel
Sorry, I forgot to tell you, I have copied all the header files in
"linux2.4.18/include/linux" to "/usr/include/linux". I am sure that
there is no difference between "linux2.4.18/include/linux" and "/usr/include/linux"
I build this driver like this:
#gcc -c usb.c
#insmod -f usb.o //due to version dismatch, i should use -f
then plug a usb device.
Could you help me test this program? Do you have an usb device? You can write a program
like this, and test if it can report the right vid & pid.
I downloaded a new kernel 2.6.5, after i started with the new kernel, lots of modules
can not be loaded, so i changed back to 2.4.18, then I found my X-windows can not
start. Did this error have something to do with this unstablity?
----- Original Message -----
From: Randy.Dunlap
To: dongzai007@sohu.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: vid&pid problems in usb_probe()
Sent: Sun May 09 01:25:34 CST 2004
> On Sat, 8 May 2004 17:05:24 +0800 (CST) <dongzai007@sohu.com> wrote:
>
> | Thank you for replying,but I don't know what you mean,
> | USB descriptor data structure is defined in
> | "/usr/include/linux/usb.h"
> |
> | my kernel version is 2.4.18.
>
> Are you saying that your driver uses /usr/include/linux/usb.h ?
> If so, that's wrong. It should use linux-2.4.18/include/linux/usb.h
> instead, and it will if you build/make the driver correctly.
>
> So, how do you build this driver? Show the Makefile or command
> line that you use.
>
> Regarding the data structure, I don't know what /usr/include/linux/usb.h
> on your system contains since that is not a kernel header file (and
> drivers shouldn't use those). I do recall, however, that many moons
> ago, there were some usb structs in usb.h that were not defined
> with __attribute__((packed)), and that could cause field offsets
> to be off a bit, er, byte (or more).
>
> And what processor arch. are you doing this on?
>
> Driver source code?
>
> ~Randy
>
>
> | ----- Original Message -----
> | From: Randy.Dunlap
> | To: dongzai007@sohu.com
> | Cc: linux-kernel@vger.kernel.org
> | Subject: Re: vid&pid problems in usb_probe()
> | Sent: Sat May 08 12:45:54 CST 2004
> |
> | > On Sat, 8 May 2004 11:48:44 +0800 (CST) <dongzai007@sohu.com> wrote:
> | >
> | > |
> | > |
> | > | I am writting an usb driver.You know function usb_probe(...) is used to determine whether the usbdevices just pluged in is what the driver is for.
> | >
> | > a. Please learn to use the Enter/Return key around character position
> | > 70 (or before) on each line.
> | >
> | > b. what kernel version? (*always*)
> | >
> | > c. You should ask this on the linux-usb-development mailing list:
> | > linux-usb-devel@lists.sf.net
> | >
> | >
> | > | The Vid and Pid of my usb device are 0x1111 and 0x0000 respectively.
> | > |
> | > | the program is :
> | > |
> | > | static void* usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
> | > | {
> | > | ..............
> | > | ..............
> | > |
> | > | printk("<1>Vid:%x
> | Pid:%x
> | ",udev->descriptor.idVendor,udev->descriptor.idProduct);
> | > |
> | > | if ((udev->descriptor.idVendor!=0x1111)
> | > | ||(udev->descriptor.idProduct!=0x0000)) return NULL;
> | > |
> | > | ..............
> | > | }
> | > |
> | > | when I plug the device whose vid & pid is 0x1111 & 0x0000 respectively.
> | > | this Module displayed
> | > |
> | > |
> | > | Vid:0
> | > | Pid:201
> | > |
> | > | usb.c ........ no active driver for this device;
> | > |
> | > | and when I plug another device , I also got wrong vid & pid.
> | > |
> | > | But when I wrote program as below:
> | > |
> | > | __u16 tmp=0x1111;
> | > | printk("<1>%x",tmp);
> | > |
> | > | it can print "1111" on the screen. That means my syntax is correct.
> | > | I mean, the problem may be at the data transfered into function usb_probe()
> | > | Maybe data transfered into function usb_probe() is wrong.
> | > |
> | > | I wonder where is the problem, how can i solve.
> | >
> | > Seeing more (or all) of your source code could help.
> | > I'm especially curious (suspicious) about your USB descriptor data
> | > structures.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: vid&pid problems in usb_probe()
2004-05-09 2:03 dongzai007
@ 2004-05-09 2:16 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2004-05-09 2:16 UTC (permalink / raw)
To: dongzai007; +Cc: linux-kernel
On Sun, May 09, 2004 at 10:03:54AM +0800, dongzai007@sohu.com wrote:
> Sorry, I forgot to tell you, I have copied all the header files in
> "linux2.4.18/include/linux" to "/usr/include/linux". I am sure that
> there is no difference between "linux2.4.18/include/linux" and "/usr/include/linux"
>
> I build this driver like this:
>
> #gcc -c usb.c
> #insmod -f usb.o //due to version dismatch, i should use -f
>
> then plug a usb device.
That is _not_ the proper way to build a kernel module. Please read the
Linux Device Drivers for examples of how to do this the correct way
(it's availble online for free.)
> Could you help me test this program? Do you have an usb device? You can write a program
> like this, and test if it can report the right vid & pid.
> I downloaded a new kernel 2.6.5, after i started with the new kernel, lots of modules
> can not be loaded, so i changed back to 2.4.18, then I found my X-windows can not
> start. Did this error have something to do with this unstablity?
Did you read the release notes about how to move to the 2.6 kernel? I
recommend using that one for development, as the USB interface is nicer,
and faster, and the build process is _vastly_ simpler.
Also, this belongs on the linux-usb-devel mailing list, not here.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-05-09 2:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-08 3:48 vid&pid problems in usb_probe() dongzai007
2004-05-08 4:45 ` Randy.Dunlap
-- strict thread matches above, loose matches on Subject: below --
2004-05-08 9:05 dongzai007
2004-05-08 17:25 ` Randy.Dunlap
2004-05-09 2:03 dongzai007
2004-05-09 2:16 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox