0

I'm trying to access a Voyager 1450g barcode scanner that is connected via USB, but navigator.usb.requestDevices() doesn't see this device.

let button = document.getElementById('request-device');
button.addEventListener('click', async () => {
let device;
try {
    device = await navigator.usb.requestDevice({ filters: [{}]});
} catch (err) {
    // No device was selected.
    console.log('Error:', err);
}

Output of the navigator.usb.requestDevices() Settings in Device Manager I will be grateful for any ideas.

Alexander
  • 169
  • 1
  • 1
  • 9

3 Answers3

2

I have a Honeywell Voyagar 1202g barcode scanner that I managed to get working with Mac and Windows.

First you will need to change the barcode scanners interface to CDC-ACM, either by using EZConfig (Honeywell software) or by scanning a barcode that you can find on their website.

Steps to get it working on Windows:

  1. Install Zadig
  2. Install HSM USB Serial Driver Package
  3. Find your device in Windows settings and update USB Composite Device driver (Let me pick from a list of drivers, uncheck compitable drivers) to use Honeywell->WinFlash Intermec Device (without this step Zadig could not find the correct interface).
  4. Using Zadig you should now see your device, update driver to libusbk
  5. Restart PC (important)

Code:

const decoder = new TextDecoder();

const startDevice = async () => {
    try {
        // you should be able to discover your PRODUCT_ID and VENDOR_ID from
        // chrome://device-log
        const device = await navigator.usb.requestDevice({
            filters: {
                productId: PRODUCT_ID,
                vendorId: VENDOR_ID
            }
        });

        // log device data to see available configurations and interfaces
        await device.open();
        // only 1 configuration was available for me
        await device.selectConfiguration(1);
        // interface 1 was bulk transfer
        await device.claimInterface(1);

        readLoop(device);
    } catch (error) {
        console.error(error);
    }
}

const readLoop = async (device) => {
    try {
        const result = await device.transferIn(1, 64);
        // this is your incoming data
        const data = decoder.decode(result.data).trim();

        readLoop(device);
    } catch (error) {
        console.error(error);
    }
}
2Steaks
  • 109
  • 1
  • 9
  • I have a question. Does it allow to send data from the barcode scanner to the website while having the browser window minimized and without focus? E.g. the website is open but the browser is minimized, and the user is normally using their computer, but the barcode scanner still sends data to the website without user needing to open and focus the website page? – Kenna Jun 08 '20 at 12:56
  • @Kenna did you come up with a solution for that? – FabricioG Jan 30 '21 at 01:07
  • Yeah, I could implement it so that it simply works, even when the browser window is not focused by the user. My solution (which differs from this one presented in the answer) allows the browser application to directly receive the data from the barcode scanner, so that it can use it for the required processing. I remember that I had to search for some documentation in order to implement everything properly, but it was not so difficult. Let me know if you need some help. – Kenna Jan 30 '21 at 18:57
0

My guess is that the virtual serial port driver (that mounts it as COM3) has captured the device. Maybe uninstall the driver and try again?

Gerrit
  • 852
  • 1
  • 9
  • 15
  • I did it several times. Unfortunately, it didn't help. – Alexander May 18 '18 at 12:33
  • 2
    Not only must you uninstall the virtual serial port driver, you also have to get Windows to load the WinUSB driver instead. The [Zadig](http://zadig.akeo.ie/) tool is designed to make this easy. – Reilly Grant May 21 '18 at 17:49
0

Got a Voyager 1400g working with Web Serial. You need to put it in CDC-ACM mode with a barcode from EZConfig

murkle.github.io/utils/webserial/honeywell_barcode_scanner.html

async function getReader() {
port = await navigator.serial.requestPort({
    filters: [{
        usbVendorId: 0x0C2E,
        usbProductId: 0x0b8a // with CDC-ACM mode, 0x0b81 is USB-HID mode
    }, ],
});
// baud rate doesn't seem to matter (?)
await port.open({
    baudRate: [57600]
});
connectButton.innerText = 'Disconnect';
console.log("Connected using Web Serial API !", port);
    const appendStream = new WritableStream({
    write(chunk) {
        console.log("chunk", chunk);
        
    }
});
port.readable.pipeThrough(new TextDecoderStream()).pipeTo(appendStream);

}

murkle
  • 477
  • 4
  • 8