- libusb_set_configuration(dev, 1);
- libusb_detach_kernel_driver(dev, 1);
- libusb_claim_interface(dev, 1);
+ ret = libusb_set_configuration(dev, VISOMAT_CONFIGURATION);
+ if (ret < 0) {
+ fprintf(stderr, "error (%d): cannot set configuration %d.\n",
+ ret, VISOMAT_CONFIGURATION);
+ goto out_libusb_close;
+ }
+
+ libusb_set_auto_detach_kernel_driver(dev, 1);
+
+ ret = libusb_claim_interface(dev, VISOMAT_INTERFACE);
+ if (ret < 0) {
+ fprintf(stderr, "error (%d): cannot claim interface %d.\n",
+ ret, VISOMAT_INTERFACE);
+ goto out_libusb_close;
+ }