code cleanup
This commit is contained in:
parent
f71f257eb0
commit
77040e9f27
1 changed files with 6 additions and 6 deletions
|
@ -44,16 +44,16 @@ PosPrinter::PosPrinter()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libusb_kernel_driver_active(devicePtr_, 0) == 1) { // find out if kernel driver is attached
|
if (libusb_kernel_driver_active(devicePtr_, 0) == 1) { // find out if kernel driver is attached
|
||||||
std::cout << "Kernel Driver Active" << std::endl;
|
std::cout << "Kernel driver active" << std::endl;
|
||||||
if (libusb_detach_kernel_driver(devicePtr_, 0) == 0) // detach it
|
if (libusb_detach_kernel_driver(devicePtr_, 0) == 0) // detach it
|
||||||
std::cout << "Kernel Driver Detached!" << std::endl;
|
std::cout << "Kernel driver detached!" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
retValue = libusb_claim_interface(
|
retValue = libusb_claim_interface(
|
||||||
devicePtr_, 0); // claim interface 0 (the first) of device (mine had jsut 1)
|
devicePtr_, 0); // claim interface 0 (the first) of device (mine had jsut 1)
|
||||||
if (retValue < 0) {
|
if (retValue < 0) {
|
||||||
std::cout << "Cannot Claim Interface" << std::endl;
|
std::cout << "Cannot claim printer interface" << std::endl;
|
||||||
throw std::runtime_error("Cannot claim interface");
|
throw std::runtime_error("Cannot claim printer interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_device_list(devList, 1);
|
libusb_free_device_list(devList, 1);
|
||||||
|
@ -64,9 +64,9 @@ PosPrinter::~PosPrinter()
|
||||||
int retValue;
|
int retValue;
|
||||||
retValue = libusb_release_interface(devicePtr_, 0); // release the claimed interface
|
retValue = libusb_release_interface(devicePtr_, 0); // release the claimed interface
|
||||||
if (retValue != 0) {
|
if (retValue != 0) {
|
||||||
std::cout << "Cannot Release Interface" << std::endl;
|
std::cout << "Cannot release printer interface" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Released Interface" << std::endl;
|
std::cout << "Printer interface released" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_close(devicePtr_); // close the device we opened
|
libusb_close(devicePtr_); // close the device we opened
|
||||||
|
|
Loading…
Reference in a new issue