How to Solve Libusb_Error_Busy on Raspberry Pi (Debian) Running Node.Js

How to solve LIBUSB_ERROR_BUSY on Raspberry Pi (Debian) running Node.js

I did some research into this: The reason is that the Raspberry Pi attaches a kernel driver to connected devices. You need to check for a kernel driver and detach it before claiming the interface.

Seeing as you are using node-usb, here is some pseudo code:

device.open()
const deviceInterface = device.interfaces[0]

let driverAttached = false
if (printerInterface.isKernelDriverActive()) {
driverAttached = true
deviceInterface.detachKernelDriver()
}

deviceInterface.claim()

// ... use the device interface

deviceInterface.release(() => {
if (driverAttached) {
deviceInterface.attachKernelDriver()
}

device.close()
})

Find two consecutive rows

Assuming the rows have sequential IDs, something like this may be what you're looking for:

select top 1 * 
from
Bills b1
inner join Bills b2 on b1.id = b2.id - 1
where
b1.IsEstimate = 1 and b2.IsEstimate = 1
order by
b1.BillDate desc


Related Topics



Leave a reply



Submit