#ifndef NO_WINDRVR
ret = (*ioctl_func) (fd, request, wdioctl);
#else
- if (xpcu->dev) {
- if (!xpcu->handle) {
- xpcu->handle = usb_open(xpcu->dev);
-#ifndef NO_USB_RESET
- if (xpcu->handle) {
- usb_reset(xpcu->handle);
- xpcu->handle = usb_open(xpcu->dev);
- }
-#endif
- }
-
- xpcu->interface = xpcu->dev->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber;
- xpcu->alternate = usi->dwAlternateSetting;
- }
+ xpcu_set_interface(xpcu, usi);
#endif
DPRINTF("unique: %lu, interfacenum: %lu, alternatesetting: %lu, options: %lx\n",
usi->dwUniqueID, usi->dwInterfaceNum,
return ret;
}
+void xpcu_set_interface(struct xpcu_s *xpcu, struct usb_set_interface *usi) {
+ if (xpcu->dev) {
+ if (!xpcu->handle) {
+ xpcu->handle = usb_open(xpcu->dev);
+#ifndef NO_USB_RESET
+ if (xpcu->handle) {
+ usb_reset(xpcu->handle);
+ xpcu->handle = usb_open(xpcu->dev);
+ }
+#endif
+ }
+
+ xpcu->interface = xpcu->dev->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber;
+ xpcu->alternate = usi->dwAlternateSetting;
+ }
+}
+
struct xpcu_s *xpcu_open(void) {
static struct xpcu_s xpcu;
int __attribute__ ((visibility ("hidden"))) xpcu_deviceinfo(struct xpcu_s *xpcu, unsigned char *buf);
int __attribute__ ((visibility ("hidden"))) xpcu_transfer(struct xpcu_s *xpcu, struct usb_transfer *ut);
+void __attribute__ ((visibility ("hidden"))) xpcu_set_interface(struct xpcu_s *xpcu, struct usb_set_interface *usi);
struct xpcu_s __attribute__ ((visibility ("hidden"))) *xpcu_open(void);
void __attribute__ ((visibility ("hidden"))) xpcu_close(struct xpcu_s *xpcu);