can't get device descriptor!!

bridged with qdn.public.ddk.usb
Post Reply
York Du

can't get device descriptor!!

Post by York Du » Tue Sep 03, 2002 1:18 am

I'm writing a driver for kodak dvc300 digital video camera,but can't get its
device descriptor.The problem occurs in the function insertion:when I insert
the usb plug into the slot,screen display :"usb device
descriptor:input/output error".Can anyone tell me how to settle it!(qnx rtp
6.1.0 and uddk1.0)
Thanks for your help!!
Yuqing Du
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <stddef.h>
#include <signal.h>
#include <sys/usbdi.h>

void removal(struct usbd_connection *connection,usbd_device_instance_t
*instance)
{
struct usbd_device *dev;
int status;
dev = usbd_device_lookup(connection, instance);
assert(dev != NULL);
status = usbd_detach(dev);
assert(status == EOK);
}
void insertion(struct usbd_connection *connection,usbd_device_instance_t
*instance)
{
struct usbd_device *dev;
struct usbd_desc_node *node;
usbd_device_descriptor_t *ddesc;
usbd_interface_descriptor_t *idesc;
usbd_configuration_descriptor_t *cdesc;

if (usbd_attach(connection,instance,4096,&dev)) {
perror("usb attach: ");
return;
}
if ((ddesc=usbd_device_descriptor(dev,&node))==NULL){
perror("usb device descriptor: ");
usbd_detach(dev);
return;
}
else{
printf("Vendor ID : 0x%04X\n", ddesc->idVendor);
printf("Device ID : 0x%04X\n", ddesc->bcdDevice);
printf("Product ID: 0x%04X\n", ddesc->idProduct);
}

if ((cdesc=usbd_configuration_descriptor(dev,1&node))==NULL) {
perror("usb configuration descriptor: ");
usbd_detach(dev);
return;
}
if ((idesc=usbd_interface_descriptor(dev,1,0,0,&node))==NULL) {
perror("usb interface descriptor: ");
usbd_detach(dev);
return;
}
if (usbd_select_config(dev, 1)) {
perror("usbd select config: ");
usbd_detach(dev);
return;
}
if (usbd_select_interface(dev, 0, 0)) {
perror("usbd select interface: ");
usbd_detach(dev);
return;
}
}
int main(int argc, char *argv[])
{
int status;
usbd_connect_parm_t parm;
usbd_funcs_t funcs;
usbd_device_ident_t speci;
struct usbd_connection *connection;

funcs.nentries = _USBDI_NFUNCS;
funcs.insertion = insertion;
funcs.removal = removal;
funcs.event = NULL;

speci.vendor = USBD_CONNECT_WILDCARD;
speci.device = USBD_CONNECT_WILDCARD;
speci.dclass = USBD_CONNECT_WILDCARD;
speci.subclass = USBD_CONNECT_WILDCARD;
speci.protocol = USBD_CONNECT_WILDCARD;

parm.path = NULL;
parm.vusb = USB_VERSION;
parm.vusbd = USBD_VERSION;
parm.flags = 0;
parm.argc = 0;
parm.argv = NULL;
parm.evtbufsz = 0;
parm.ident = &speci;
parm.funcs = &funcs; /* the insertion/removal callbacks */
parm.connect_wait = USBD_CONNECT_WAIT;
status = usbd_connect(&parm, &connection);
assert(status == EOK);

while (1)sleep(60);
return 0;
}

Henry Van Dyke

Re: can't get device descriptor!!

Post by Henry Van Dyke » Fri Sep 13, 2002 2:21 pm

When you run the 'usb' utility is the device displayed ?


York Du (yqdu@cs.ecnu.edu.cn) wrote:
: I'm writing a driver for kodak dvc300 digital video camera,but can't get its
: device descriptor.The problem occurs in the function insertion:when I insert
: the usb plug into the slot,screen display :"usb device
: descriptor:input/output error".Can anyone tell me how to settle it!(qnx rtp
: 6.1.0 and uddk1.0)
: Thanks for your help!!
: Yuqing Du
: #include <stdio.h>
: #include <errno.h>
: #include <assert.h>
: #include <stddef.h>
: #include <signal.h>
: #include <sys/usbdi.h>

: void removal(struct usbd_connection *connection,usbd_device_instance_t
: *instance)
: {
: struct usbd_device *dev;
: int status;
: dev = usbd_device_lookup(connection, instance);
: assert(dev != NULL);
: status = usbd_detach(dev);
: assert(status == EOK);
: }
: void insertion(struct usbd_connection *connection,usbd_device_instance_t
: *instance)
: {
: struct usbd_device *dev;
: struct usbd_desc_node *node;
: usbd_device_descriptor_t *ddesc;
: usbd_interface_descriptor_t *idesc;
: usbd_configuration_descriptor_t *cdesc;

: if (usbd_attach(connection,instance,4096,&dev)) {
: perror("usb attach: ");
: return;
: }
: if ((ddesc=usbd_device_descriptor(dev,&node))==NULL){
: perror("usb device descriptor: ");
: usbd_detach(dev);
: return;
: }
: else{
: printf("Vendor ID : 0x%04X\n", ddesc->idVendor);
: printf("Device ID : 0x%04X\n", ddesc->bcdDevice);
: printf("Product ID: 0x%04X\n", ddesc->idProduct);
: }

: if ((cdesc=usbd_configuration_descriptor(dev,1&node))==NULL) {
: perror("usb configuration descriptor: ");
: usbd_detach(dev);
: return;
: }
: if ((idesc=usbd_interface_descriptor(dev,1,0,0,&node))==NULL) {
: perror("usb interface descriptor: ");
: usbd_detach(dev);
: return;
: }
: if (usbd_select_config(dev, 1)) {
: perror("usbd select config: ");
: usbd_detach(dev);
: return;
: }
: if (usbd_select_interface(dev, 0, 0)) {
: perror("usbd select interface: ");
: usbd_detach(dev);
: return;
: }
: }
: int main(int argc, char *argv[])
: {
: int status;
: usbd_connect_parm_t parm;
: usbd_funcs_t funcs;
: usbd_device_ident_t speci;
: struct usbd_connection *connection;

: funcs.nentries = _USBDI_NFUNCS;
: funcs.insertion = insertion;
: funcs.removal = removal;
: funcs.event = NULL;

: speci.vendor = USBD_CONNECT_WILDCARD;
: speci.device = USBD_CONNECT_WILDCARD;
: speci.dclass = USBD_CONNECT_WILDCARD;
: speci.subclass = USBD_CONNECT_WILDCARD;
: speci.protocol = USBD_CONNECT_WILDCARD;

: parm.path = NULL;
: parm.vusb = USB_VERSION;
: parm.vusbd = USBD_VERSION;
: parm.flags = 0;
: parm.argc = 0;
: parm.argv = NULL;
: parm.evtbufsz = 0;
: parm.ident = &speci;
: parm.funcs = &funcs; /* the insertion/removal callbacks */
: parm.connect_wait = USBD_CONNECT_WAIT;
: status = usbd_connect(&parm, &connection);
: assert(status == EOK);

: while (1)sleep(60);
: return 0;
: }

York Du

Re: can't get device descriptor!!

Post by York Du » Sat Sep 14, 2002 3:09 am

No device information!just display 'I/O error'.( 'dev-uhci &' runned).
Is the problem the Kodak DVC 300 conformed usb1.0?

Henry Van Dyke

Re: can't get device descriptor!!

Post by Henry Van Dyke » Mon Sep 16, 2002 1:29 pm

York Du (yqdu@cs.ecnu.edu.cn) wrote:
: No device information!just display 'I/O error'.( 'dev-uhci &' runned).
: Is the problem the Kodak DVC 300 conformed usb1.0?



What chipset is you USB controller ?
pci -vvvv

Do any other USB devices work ?

York Du

Re: can't get device descriptor!!

Post by York Du » Tue Sep 17, 2002 1:16 pm

Below is the result of command "pci -vvvv":
Class = Serial Bus (Universal Serial Bus)
Vendor ID = 8086h, Intel Corporation
Device ID = 2412h, 82801AA USB Controller

Other devices work normally,such as USB flash disk and MP3 player.
Thanks for your responses!

Henry Van Dyke

Re: can't get device descriptor!!

Post by Henry Van Dyke » Tue Sep 17, 2002 2:33 pm

York Du (yqdu@cs.ecnu.edu.cn) wrote:
: Below is the result of command "pci -vvvv":
: Class = Serial Bus (Universal Serial Bus)
: Vendor ID = 8086h, Intel Corporation
: Device ID = 2412h, 82801AA USB Controller

: Other devices work normally,such as USB flash disk and MP3 player.
: Thanks for your responses!


Ok. Thats good to know.

Can you run devu-uhci in verbose mode and post the output

'devu-uhci -vvvvvv'

Is it possible for you to try the camera with an OHCI compatible
host controller to see it there is any difference ?

thanks.

York Du

Re: can't get device descriptor!!

Post by York Du » Sun Sep 22, 2002 12:06 pm

have runned 'devu-uhci -vvvvvv',but there is nothing--just display process
id.
And I'm confused that the camera worked very well under windows 2000
installed on the same machine.I ' ll be mad!:-(

Henry Van Dyke

Re: can't get device descriptor!!

Post by Henry Van Dyke » Mon Sep 23, 2002 1:10 pm

York Du (yqdu@cs.ecnu.edu.cn) wrote:
: have runned 'devu-uhci -vvvvvv',but there is nothing--just display process
: id.
: And I'm confused that the camera worked very well under windows 2000
: installed on the same machine.I ' ll be mad!:-(


O.k. when running with '-vvvvvvv' can run sloginfo and post
the output.

York Du

Re: can't get device descriptor!!

Post by York Du » Wed Sep 25, 2002 11:51 am

I have runned 'devu-uhci -vvvvvv',but there is nothing--just display process
id.
And I'm confused that the camera worked very well under windows 2000
installed on the same machine.I ' ll be mad!:-(

York Du

Re: can't get device descriptor!!

Post by York Du » Wed Sep 25, 2002 1:40 pm

Below is the result of sloginfo after runned 'devu-uhci -vvvvv &'

Time Sev Major Minor Args
Sep 26 05:15:03 5 3 400 [8] fs-pkg built: Aug 28 2001 10:37:09
Sep 26 05:15:07 5 3 400 Package config file
[/etc/system/package/packages]
Sep 25 21:15:08 5 6 200 Installing /dev/par port 378
Sep 25 21:15:12 1 8 0 1868982384 1482191982 1635021600 1684370546
541806368 1329930285 943128651
Sep 25 21:15:14 6 8 0 VGA primary : bus 0x0 dev/func 0x8
Sep 25 21:15:14 6 8 0 Found 1 PCI/AGP display devices
Sep 25 21:15:14 6 8 0 pci_init: found PCI device 8086:7125
Sep 25 21:15:16 5 9 0 Start: /usr/photon/bin/devi-hirun kbd
fd -d/dev/kbd ps2
mousedev

Henry Van Dyke

Re: can't get device descriptor!!

Post by Henry Van Dyke » Wed Sep 25, 2002 2:50 pm

York Du (yqdu@cs.ecnu.edu.cn) wrote:
: Below is the result of sloginfo after runned 'devu-uhci -vvvvv &'

: Time Sev Major Minor Args
: Sep 26 05:15:03 5 3 400 [8] fs-pkg built: Aug 28 2001 10:37:09
: Sep 26 05:15:07 5 3 400 Package config file
: [/etc/system/package/packages]
: Sep 25 21:15:08 5 6 200 Installing /dev/par port 378
: Sep 25 21:15:12 1 8 0 1868982384 1482191982 1635021600 1684370546
: 541806368 1329930285 943128651
: Sep 25 21:15:14 6 8 0 VGA primary : bus 0x0 dev/func 0x8
: Sep 25 21:15:14 6 8 0 Found 1 PCI/AGP display devices
: Sep 25 21:15:14 6 8 0 pci_init: found PCI device 8086:7125
: Sep 25 21:15:16 5 9 0 Start: /usr/photon/bin/devi-hirun kbd
: fd -d/dev/kbd ps2
: mousedev


Hmm

This doesn't show the stack trying to do any enumeration of the device
at all.

Normally you should see something like this :

Sep 25 10:47:46 2 12 0 CLASS_EnumerateDevice: parent 0, port 0, speed 1
Sep 25 10:47:46 2 12 0 CLASS_EnumerateDevice: Get device descriptor
Sep 25 10:47:46 2 12 0 CLASS_EnumerateDevice: Set address 1
Sep 25 10:47:46 2 12 0 CLASS_EnumerateDevice: Get full device descriptor
Sep 25 10:47:46 2 12 0 CLASS_EnumerateDeviceConfiguration: Get config descriptor
Sep 25 10:47:46 2 12 0 CLASS_EnumerateDeviceConfiguration: Get full config descriptor
Sep 25 10:47:46 2 12 0 USB_SelectConfiguration: Set config devno 1, cfg 1
Sep 25 10:47:47 2 12 0 udi_in_out: devno 1 inserted

The only reasons I can think of that your're not seeing this output is
that either the device isn't plugged in or you have multiple USB controllers
and the stack is talking to the first controller but the device is plugged
into the second controller. Do you have 2 controllers in your machine ?

York Du

Re: can't get device descriptor!!

Post by York Du » Thu Sep 26, 2002 10:18 am

There is only one controllers in my machine!Below is my steps:
1.Plug in the device.
2.Start the QNX.
3.Run the command 'devu-uchi -vvvvv &'.
4.Run the command 'sloginfo'.
But the output is same!How can I do£¿
Thanks for your help!

Post Reply

Return to “qdn.public.ddk.usb”