设置接口值
每个USB设备在使用之前,都必须设置其接口值,这样USB设备才能够知道使用哪一种接口,从而正常的与主机通信:
/**

 * 设置USB设备所使用的接口值

 */

short usbSetInterface(unsigned char *pDataBuf)

{

    SETUPPKG *setup;

 

    setup = &usbDevSetup;

 

    setup->bmRequest = 0x01;

    setup->bRequest = SET_INTERFACE;

    setup->wValue = 0x00;

    setup->wIndex = 0;

    setup->wLength = 0;

 

    ctrlCmdSet((unsigned int)setup, pDataBuf);

 

    return 0;

}