Created
July 17, 2011 02:07
-
-
Save hirokuma/1087031 to your computer and use it in GitHub Desktop.
libusb-1.0 search endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(int inf = 0; inf < pConfig->bNumInterfaces; inf++) { | |
const libusb_interface& inter = pConfig->interface[inf]; | |
for(int alt = 0; alt < inter.num_altsetting; alt++) { | |
const libusb_interface_descriptor& idesc = inter.altsetting[alt]; | |
for(int desc = 0; desc < idesc.bNumEndpoints; desc++) { | |
const libusb_endpoint_descriptor& EndPnt = idesc.endpoint[desc]; | |
assert(EndPnt.bDescriptorType == LIBUSB_DT_ENDPOINT); | |
if(EndPnt.bEndpointAddress & LIBUSB_ENDPOINT_IN) { | |
m_EndPntIn = EndPnt.bEndpointAddress; | |
} | |
else { | |
m_EndPntOut = EndPnt.bEndpointAddress; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment