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

 * 设置USB设备所使用的配置值

 */

short usbSetConfiguration(unsigned char *pDataBuf)

{

    SETUPPKG *setup;

 

    setup = &usbDevSetup;

 

    setup->bmRequest = 0x0;

    setup->bRequest = SET_CONFIG;

    setup->wValue = 0x01;

    setup->wIndex = 0;

    setup->wLength = 0;

 

    return ctrlCmdSet((unsigned int)setup, pDataBuf);

}