Hi all,
I've been lurking this list for a while. I'm writing a device driver for
the Intel PC Camera webcam (aka ViewQuest CS330). I'm attempting to
reverse engineer the protocol using output from a CATC analyser running
from Windows 2000, I'm lucky enough to have access to one at work.
The camera uses a vast number of vendor specific commands and while I hope
to be able to decode them all in the end I am initially just attempting to
copy what is sent during start-up to see if I can get the camera to start
streaming. I have a function in my driver code to allow me to send a
vendor specific command string (code to follow). However whatever I send
down to the device I get returned an error -12.
I have three questions:
1) What does -12 mean when it is returned in purb->status?
2) Is there a function in the kernel API to resolve a numeric error return
to a textual description (kinda like perror() in the C library)?
3) Have I got the syntax of the call right in the first place? I am
unsure what goes in purb->setup_packet, purb->transfer_buffer and
purb->transfer_buffer_length.
I am calling this function like:
cs330_send_vendor_control_packet( pcs330_dev, (unsigned long
int)0x4000010010000000 );
The string of hex is whatever I get in the CATC output in a SETUP type
packet. For example:
DATA
40 00 01 00 10 00 00 00
I have hardcoded the endpoint address etc. in the routine as this
doesn't change. When the completion routine is called, purb->status is
always -12.
Do you have any suggestions on what I am doing wrong? I'd appreciate any
help.
Cheers,
Robin
---START CODE FRAGMENT---
/* URB Completion Routine */
void cs330_control_packet_complete( urb_t *purb ) {
struct cs330_dev *pcs330_dev = (struct cs330_dev *)purb->context;
printk( "cs330: vendor control packet completed\n" );
printk( "cs330: status %d\n", purb->status );
wake_up( &pcs330_dev->wait );
}
/************************************************************************
******* * Function: cs330_send_vendor_control_packet
*
* Arguments: struct usb_device *pcs330_dev - to send to
* char *packet - contains setup packet data, 8 hex numbers
* Returns: int - whatever usb_submit_urb returns
*/
int cs330_send_vendor_control_packet( struct cs330_dev *pcs330_dev,
unsigned long int packet ) {
urb_t *purb = NULL;
unsigned char *psetup_packet;
int return_value;
printk( "cs330: vendor control packet submitted\n" );
psetup_packet = (unsigned char *)kmalloc( sizeof( char ) * 8,
SLAB_KERNEL );
memcpy( psetup_packet, &packet, 8 );
purb = usb_alloc_urb( 0 );
purb->next = NULL;
purb->dev = pcs330_dev->usb_dev;
purb->pipe = usb_sndctrlpipe( pcs330_dev->usb_dev, 0 );
purb->transfer_flags = 0;
purb->setup_packet = psetup_packet;
purb->transfer_buffer = psetup_packet;
purb->transfer_buffer_length = 8;
purb->context = pcs330_dev;
purb->complete = cs330_control_packet_complete;
return_value = usb_submit_urb( purb );
sleep_on( &pcs330_dev->wait );
usb_free_urb( purb );
kfree( psetup_packet );
return return_value;
}
---END CODE FRAGMENT---
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel