hi there,
i tryed imitate the winoze driver for my typhoon/anubis pencam (gt 8911
vidchip inside) connected on my usb root hub..,well this is my 1st try so i
need some help with this.. i sniffled the first usb ctrl blocks with bus
houd
-since sniffusb etc wont work - and got 7 control packets initializing the
cam to send data..
as said i tryed to send a usb_control_msg but got an invalid argument error,
may i switched the bytes and words wrong way? i tryed several versions but
suddenly uhci hangs :-// for this i used to compile with libusb..
by the way - where's the difference between usb_control_msg and
usb_bulk_write
may someone knows an answer
thanks a lot - jz
/*
control blocks to enter 320x240 GC2 compression mode
9 CTL c0 10 8c 01 - 00 38 40 00 VENDOR
0us 1.1.0
9 DI c0 10 8c 01 - 00 38 40 00 .....8@.
3.9ms 1.2.0
9 CTL c0 10 8a 05 - 00 42 40 00 VENDOR
74us 2.1.0
9 DI c0 10 8a 05 - 00 42 40 00 .....B@.
4.9ms 2.2.0
9 CTL 01 0b 01 00 - 01 00 00 00 SET
INTERFACE 134us 3.1.0
9 CTL c0 10 8f 01 - 00 3b 40 00 VENDOR
48ms 4.1.0
9 DI c0 10 8f 01 - 00 3b 40 00 .....;@.
4.3ms 4.2.0
--now cam sends isochronus data...
*/
#include <sys/ioctl.h>
#include </usr/include/usb.h>
#include <string.h>
#define QUICKCAM_MINOR 80
#define NRPENCAM 1
#define TYPHOON_VID 0x797
#define PENCAM_PID 0x801A
#define UT_READ 0x80
#define USBTIMEOUT 5000
typedef struct {
struct usb_device *device;
usb_dev_handle *dev;
usb_dev_handle *bin;
usb_dev_handle *bout;
usb_dev_handle *iin;
usb_dev_handle *iout;
} pencam_t;
unsigned char data[70];
unsigned char dat[8];
struct dat *pDat;
int pencam_find(pencam_t *pencam){
struct usb_bus *bus;
struct usb_device *dev;
int err;
//char a;
usb_init();
if ( usb_find_busses()!=0 ) err=-1;
if ( usb_find_devices()!=0 ) err=-2;
printf("bus/device idVendor/idProduct\n");
for (bus = usb_busses; bus; bus = bus->next) {
for (dev = bus->devices; dev; dev = dev->next)
{
//printf("%s/%s %04X/%04X\n", bus->dirname,
dev->filename,
//dev->descriptor.idVendor,
dev->descriptor.idProduct);
if ( dev->descriptor.idVendor == TYPHOON_VID
&& dev->descriptor.idProduct == PENCAM_PID
)
{
pencam->device=dev;
pencam->dev = NULL;
printf("pencam found\n");
return 0; //found
typhoon pencam
}
}
}
printf("**FATAL ERROR!!pencam not found..");
return -3; //unknown error /not found
}//int
//
// trys to open pencam
int pencam_open(pencam_t *pencamp)
{
int result=0;
printf("usb_open %i
",pencamp->dev=usb_open(pencamp->device));
printf("usb_set_configuration %i
",usb_set_configuration(pencamp->dev,1));
printf("usb_claim_interface %i
",usb_claim_interface(pencamp->dev,0));
printf("usb_set_altinterface %i
",usb_set_altinterface(pencamp->dev,0));
pencamp->ctl= pencamp->dev;
pencamp->bin= pencamp->dev;
pencamp->bout= pencamp->dev;
pencamp->iin= pencamp->dev;
pencamp->iout= pencamp->dev;
return 0; //unknown ERROR
}
int usb_pipe_read(usb_dev_handle **dev, void *buf, size_t nbytes)
int main(int argc, char *argv[])
{
pencam_t pencams[2],*pencamp;
usb_set_debug(10);
pencamp = pencams;
printf("\nreturn pencam_find : %i",pencam_find(pencamp));
printf("\nreturn pencam_open : %i",pencam_open(pencamp));
//
// evrything went well till folowing :
/* 9 CTL c0 10 8c 01 - 00 38 40 00 VENDOR
first control packet...how it works on usb_control_msg?????
i tryed several other ways...but noone really did the job
*/
usb_control_msg(pencamp->dev , 0xc0, 0x10 , 0 , 0 , pDat , 18 ,
USBTIMEOUT);
usb_close(pencams->dev);
return 0;
}
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users