On Sun, Apr 07, 2002, Dominik Kuhlen <[EMAIL PROTECTED]> wrote: > Here are some fragments of my (1.try) code: > > I used some professional USB sniffer (CATC USBChief) to get an idea what > the computer says to the camera and vice versa. > Then I replayed the packets (at least I hope so) to > achieve the same behaviour. > As I mentioned the TOC works. > > --------- snip ----------- > #define USB_REQ_RESERVED 0x04 > static unsigned char TOC[10*512]; // some buffers > static unsigned char ThumbNail[5*0x1000]; // Thumbnail buffer > > static int sx330z_open(struct inode *inode,struct file *file) > { > -snip > // some ususal checkings > -snip > // Don't know what this is for ? some initialization I think > pipe=usb_rcvctrlpipe(sx330z->dev,0); > res=usb_control_msg(sx330z->dev, > pipe, > USB_REQ_RESERVED, // traveler hack : 0x04??? > USB_DIR_IN | USB_DIR_VENDOR, // 0xc0 > 0x0001, > 0x0000, > buf,16,HZ);
You're missing some very important code. Like what does buf point to? > printk("sx330z : 0x0001 (%d) : (%02x %02x.. > %02x)\n",res,buf[0],buf[1],buf[8]); > > // This one works fine > pipe=usb_rcvctrlpipe(sx330z->dev,0); > res=usb_control_msg(sx330z->dev, > pipe, > USB_REQ_RESERVED, // traveler hack ??? > USB_DIR_IN | USB_DIR_VENDOR, // > 0x0002, // get TOC size ?? > 0xd000, > buf,16,HZ); > TOCSize=(((buf[9]<<8)+buf[8])); > printk("sx330z : Get TOCsize (%d) ",res); > printk("sx330z : TOCSize %d \n",TOCSize); > > > // now read the TOC > res=usb_control_msg(sx330z->dev, > pipe, > USB_REQ_RESERVED, // traveler hack ?? > USB_DIR_OUT | USB_DIR_VENDOR, > 0x0003, // read TOC > 0xd000, > &trq,32,HZ); Where is trq allocated? > printk("sx330z : ReqTOCPage %d (%d) : (%02x)\n",TOCPage,res,buf[0]); > res=usb_bulk_msg(sx330z->dev,usb_rcvbulkpipe(sx330z->dev,2),buf,512,&length,2*HZ); > // Get 16Byte Ack > res=usb_bulk_msg(sx330z->dev,usb_rcvbulkpipe(sx330z->dev,2),buf,16,&length,2*HZ); > > // Next : request ThumbNail > res=usb_control_msg(sx330z->dev, > usb_sndctrlpipe(sx330z->dev,0), > USB_REQ_RESERVED, // traveler hack ????? > USB_DIR_OUT | USB_DIR_VENDOR, > 0x0004, > 0xd000, > &trq,32,2*HZ); > > // res has positive value here (shouldn't be?) > printk("sx330z : 0x0004 (%d) : \n",res); > > //Here my error appears > >res=usb_bulk_msg(sx330z->dev,usb_rcvbulkpipe(sx330z->dev,2),ThumbNail,4096,&length,2*HZ); > printk(KERN_INFO "sx330z : read TN (%d,%d bytes) \n", res,length); Use kmalloc. Don't use buffers allocated in the bss. > // get 16 Byte Ack > res=usb_bulk_msg(sx330z->dev,usb_rcvbulkpipe(sx330z->dev,2),&buf,16,&length,2*HZ); > printk(KERN_INFO "sx330z : read ack? (%d,%d bytes)\n",res,length); Why are using &buf here? Don't you mean just buf? > } > /* (kernel log file) > Apr 1 23:30:05 doku kernel: sx330z : read TOC (0,512 bytes) : 00 ... 30 > Apr 1 23:30:05 doku kernel: sx330z : read ack? (0): 16 bytes > Apr 1 23:30:05 doku kernel: sx330z : 0x0004 (32) > Apr 1 23:30:05 doku kernel: uhci.c: d400: host system error, PCI problems? > Apr 1 23:30:09 doku kernel: usb_control/bulk_msg: timeout > Apr 1 23:30:09 doku kernel: sx330z : read TN (-110,0 bytes) > */ > > ------ snip ---------- > > These calls are made during the "open" fop on character device (180,65) > !only for testing! > > Are the HZ parameters OK ? does it mean 1sec max blocking ? Yes, The timeout is the number of timer ticks and HZ will mean 1 second. > the comment before usb_control_msg says, that it will return 0 or a negative > number, but I get positve numbers. Is this unusual? > > How does the libusb work? Are there any howtos? http://libusb.sourceforge.net/ The documentation up there lacks some detail, but I'm working on that still. > My understanding problem is : > I modprobe the UHCI module plug my camera in the USB > (Double A Cable <- forbidden according to the USB Spec) > and the lowlevel driver searches for an appropriate driver, that > claims the device (interface), but how does the libusb work with > this ? Does it have some "universal" kernel module that claims any > device? Yes, it's usbdevfs (usbfs in newer kernels). JE _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel