Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need Some Serious HelP.......






hello!!
i have just learned about mac usb driver programming and have
encounteredsome problems thus could anyone help me out here?
i am currently developing a usb driver for a webcam. My question is how do
i
store the data of the webcam into a buffer after sending a control message?
the control message is send thru control pipe while pipe one is used to
read
the data. do i send the control message over and then use a while loop to
read the data and then store it into the buffer??
any opinon,views or help will be greatly appreciated!
thks!

code: do i do it like this?

void downLoadImage(IOUSBInterfaceInterface **interface,int size)
//size-> refers to the size of the
{
                              picture
      UInt8 buffer[size];
kern_return_t kernResult;
      //    int msg =0x1f500140;
            IOUSBDevRequest req;
            req.bmRequestType = USBmakebmRequestType(kUSBOut,
kUSBVendor,kUSBDevice);
            req.bRequest=0x1;
        req.wValue=0x9300;
        req.wIndex=0;
            req.wLength=0;

      //  req.pData=msg;

            kernResult=(*interface)->ControlRequest(interface,0,&req);
            if (kernResult != kIOReturnSuccess)
            {
                  //printf("Unable to perform bulk write (%08x)\n",
kernResult);
                  (void) (*interface)->USBInterfaceClose(interface);
                  (void) (*interface)->Release(interface);

            }
            printf("downloading Image\n");
            UInt32 numBytesRead;
            numBytesRead = sizeof(gReadBuffer) - 1;

            while(sizeof(gReadBuffer)!=size)
            {

                  IOReturn kernaResult = (*interface)->ReadPipe( interface,
1,
gReadBuffer,&numBytesRead);
                  if (kernaResult != kIOReturnSuccess)
                  {
                        printf("Unable to perform bulk read (%08x)\n",
kernResult);
                        (void) (*interface)->USBInterfaceClose(interface);
                        (void) (*interface)->Release(interface);
                        //break;
                  }
                  printf("image dled %s (%ld bytes) from bulk endpoint\n",
gReadBuffer);
            }
}

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.