Hi,
I’m trying to print from an imp05 to a label printer over USB (Brother QL-700)
I am using the modified QL720NW_UART_USB driver code based on mysticpants/Electric-Imp-Usb-Drivers UartOverUsbDriver. https://github.com/electricimp/Usb/tree/v0.1.0/examples/QL720NW_UART_USB_Driver
So far so good. The imp device and USB driver recognize the device and installs the driver.
But sending print commands to the printer results in zero response on the printer in terms of printing or status lights.
I added some logging statements to the driver and the print commands are written to the Bulk Out endpoint.
There also seems to be a lot of activity on the Bulk In endpoint (appears to be all 0x00 chars) but the UsbHost.On(“data” callback is not called (and I could not find another event type where the bulk in data might appear).
Any pointers on how to move forward would be muchly appreciated.
Here is the code:
// Initialize USB Host
usbHost <- USB.Host(hardware.usb);
usbHost._DEBUG=true
server.log(“Usb initialized”)
// Register the UART over USB driver with USB Host
usbHost.registerDriver(QL720NWUartUsbDriver, QL720NWUartUsbDriver.getIdentifiers());
server.log(“driver registered”)
// Subscribe to USB connection events
usbHost.on(“connected”,function (device) {
server.log(typeof device + " was connected!");
switch (typeof device) {
case "QL720NWUartUsbDriver":
// Initialize Printer Driver with USB UART device
printer <- QL720NW(device);
// Print a text label
printer
.setOrientation(QL720NW.LANDSCAPE)
.setFont(QL720NW.FONT_SAN_DIEGO)
.setFontSize(QL720NW.FONT_SIZE_48)
.write("San Diego 48 ")
.print();
// Configure Barcode
barcodeConfig <- {
"type": QL720NW.BARCODE_CODE39,
"charsBelowBarcode": true,
"width": QL720NW.BARCODE_WIDTH_M,
"height": 1,
"ratio": QL720NW.BARCODE_RATIO_3_1
}
// Print bacode of the imp's mac address
printer.writeBarcode(imp.getmacaddress(), barcodeConfig).print();
break;
}
})
usbHost.on(“data”,function (data) {
server.log("data " + (typeof data))
})
// Subscribe to USB disconnection events
usbHost.on(“disconnected”,function(deviceName) {
server.log(deviceName + " disconnected");
})