2013-07-09 77 views
0

libusb提供libusb_set_interface_alt_setting()方法來爲接口提供備用設置。我的問題是爲接口進行備用設置的意義。libusb_set_interface_alt_setting()是做什麼的?

if ((ret = libusb_claim_interface(handle, interface)) == LIBUSB_SUCCESS) 
     { 
      printf("%s: interface %d claimed.\n", __FUNCTION__, interface); 

      /* Set alternate interface */ 
      if ((ret = libusb_set_interface_alt_setting(handle, interface, alternate)) == LIBUSB_SUCCESS) 
      { 
       printf("%s: alternate interface %d set.\n", __FUNCTION__, alternate); 
       return CIMAX_USB_NO_ERROR; 
      } 
      else 
      printf("%s: setting alternate interface %d failed (%s)!\n", __FUNCTION__, alternate, libusb_error_name(ret)); 
     } 
     else 
      printf("%s: claim interface %d failed (%s)!\n", __FUNCTION__, interface, libusb_error_name(ret)); 

回答

0

備用接口設定爲多功能devices.To使用特定功能或接口,則需要選擇界面和相關聯的備用設置。

例如,攝像機需要初始化兩個接口設置,一個用於音頻,另一個用於視頻。

0

USB設備支持單個設備中的多個接口。該API根據功能用戶空間應用程序的要求設置當前界面的活動備用設置。在內部,它使用IOCTL_USB_SETINTF將應用程序的需求傳達給Linux USB主機框架的usbcore模塊。