Skip navigation.
Home
The QNX Community Portal

View topic - Difficulty in opening pipes in the usb device

Difficulty in opening pipes in the usb device

Discussions, suggestions, requests about this website.

Difficulty in opening pipes in the usb device

Postby charuta » Thu Oct 08, 2009 9:33 am

Hi,
I m writing the driver for the usb modem. It uses CDC settings for the driver. I am able to attach the device. Get the configuration & interface descriptors. But when i go for endpoint descriptors, it gives me error 'memory fault [core dumped]'. or when i try usin the usbd_parse_descriptors for the endpoint descriptors, it doesnt get the descriptors at al, instead nothing in the for looop is printed. So can anyone please suggest how the pipes are established between a CDC device & usb host. And wats the *node & *root significance used in usbd_parse_descriptors()?Are there any other attributes which can be used to open pipe instead of bmAttributes in endpoint?
My for loop is as follows:

for (i=0; (ddesc = usbd_parse_descriptors(device,root,USB_DESC_ENDPOINT,i,node ))!= NULL ; ++i)
{

printf("packet size: %d\n",ddesc->endpoint.wMaxPacketSize);
printf("attribute: %d\n",ddesc->endpoint.bmAttributes);
printf("address: %d\n",ddesc->endpoint.bEndpointAddress);
switch(ddesc->endpoint.bmAttributes)
{
case USB_ATTRIB_CONTROL:
if ((usbd_open_pipe (device,ddesc,&control_pipe_out)) != EOK)
{
perror ("Could not open the CONTROL pipe \n");
exit (0);
}
else
{
printf("opened control pipe\n");
break;
}
case USB_ATTRIB_INTERRUPT:
if ((usbd_open_pipe (device,ddesc,&intr_pipe)) != EOK)
{
perror ("Could not open the interrupt pipe \n");
exit (0);
}
else
{
printf("opened interrupt pipe\n");
break;
}

case USB_ATTRIB_BULK:
if(ddesc->endpoint.bEndpointAddress & USB_ENDPOINT_IN )
{
printf("bulk in endpoint\n");
if ((usbd_open_pipe (device, ddesc, &data_pipe_in )) != EOK)
{
perror ("Could not open the in pipe \n");
exit (0);
//break;
}
else
{
printf("opened bulk in pipe\n");
break;
}
}
else if(ddesc->endpoint.bEndpointAddress & USB_ENDPOINT_OUT )
{
printf("bulk out endpoint\n");
if ((usbd_open_pipe (device,ddesc,&data_pipe_out)) != EOK)
{
perror ("Could not open the out pipe \n");
exit (0);
}
else
{
printf("opened bulk out pipe\n");
break;
}
}
default:
printf("pipes not opened as configurations did not match\n");

}

}
charuta
New Member
 
Posts: 3
Joined: Tue Sep 29, 2009 10:43 am

Postby Tim » Thu Oct 08, 2009 12:59 pm

Charuta,

Most of the questions you are asking about the root/node can be found in the helpviewer information on usbd_parse_descriptors.

Can you show the other parts of your code besides the for loop. The lines leading up to that where you define/fill out device, root and node.

Did you download and look at the USB SDK as that has some handy code examples.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am


Return to OpenQNX Site

Who is online

Users browsing this forum: No registered users and 1 guest