usbd_string function and multiple interface devices

bridged with qdn.public.ddk.usb
Post Reply
Don Krueger

usbd_string function and multiple interface devices

Post by Don Krueger » Wed Jun 11, 2003 4:23 pm

I'm working on a device driver for Neutrino and I am having problems with
the usbd_string() function. The driver appeared to work properly on my
first target system (Dell Dimension V350; QNX 6.2.0; devu-uhci) but when it
was ported to new system (Arcom SBC-GX1; QNX 6.2.1; devu-ohci) calls to
usbd_string caused memory faults. The problem occurs when the driver
retrieves the serial number string from the device. I was able to develop
a test program (see below) that demonstrated the problem.

/* ----- Start test program ----- */

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/usbdi.h>

void insertion(struct usbd_connection *conn, usbd_device_instance_t *inst)
{
struct usbd_device *dv;

printf("devno %d inserted\n", inst->devno);

if (EOK == usbd_attach(conn, inst, sizeof(int), &dv)) {
int i;

for(i = 0; i < 3; i++ ) {
usbd_device_descriptor_t* dd = usbd_device_descriptor(dv, NULL);

if(dd) {
if(dd->iSerialNumber) {
char* sn = usbd_string(dv, dd->iSerialNumber, 0);
printf("Read #%d = %s\n", i, sn ? sn : "NULL");
}
}
}
usbd_detach(dv);
}
}

int main(int argc, char *argv[]) {
struct usbd_connection *connection;
struct usbd_funcs funcs = {_USBDI_NFUNCS, insertion, NULL, NULL };
usbd_device_ident_t ident = {
USBD_CONNECT_WILDCARD, USBD_CONNECT_WILDCARD, USBD_CONNECT_WILDCARD,
USBD_CONNECT_WILDCARD, USBD_CONNECT_WILDCARD
};
usbd_connect_parm_t parm = {
NULL, USB_VERSION, USBD_VERSION, 0, 0, NULL, 0, &ident, &funcs, 60
};

if(EOK == usbd_connect(&parm, &connection) ) {
pause();
}

return EXIT_SUCCESS;
}

/* ----- End test program ----- */


When the test program is run on the Dell the serial number is read correctly
every time. On the Arcom board, however, the output resembles the
following:

devno 1 inserted
Read #0 = BQD0019
Read #2 = NULL
Read #3 = BQD0019
devno 1 inserted
Read #0 = BQD0019
Read #2 = BQD0019
Read #3 = NULL
devno 1 inserted
Read #0 = BQD0019
Read #2 = NULL
Read #3 = NULL
devno 1 inserted
Read #0 = BQD0019
Read #2 = BQD0019
Read #3 = NULL

I executed tests with other devices and found that only those that have
multiple interfaces exhibited the inability to always locate the serial
number string. Single interface devices always retrieved it properly.
Is there something I am missing here, or is there a problem with the USBD
library or devu-ohci? Any help would be appreciated.

Don Krueger

Re: usbd_string function and multiple interface devices

Post by Don Krueger » Wed Jun 11, 2003 5:43 pm

Please ignore this. I located the problem. It was an OHCI/UHCI issue.

Post Reply

Return to “qdn.public.ddk.usb”