How to show Barcode read by @jpkelly/node-red-usbhid nodes

Scenario

Raspberry Pi.

Followed the Linux instructions as per node-red-usbhid (node) - Node-RED

Have set up a standard Honeywell HH490 model USB Barcode reader.

This is to be a standalone device with no HMI, it is there to accept a barcode and pass the text onto a further workflow, so no chance to have the barcode reader act as a keyboard into a dashboard element

If I open Text editor and scan a barcode I get the text expected (per attached b/c image this would be AB ) so the bc scanner is working fine.

When I scan a barcode and print to console from the following flow I get 8 responses, which I assume represents 2 for start char (usually *) 2 each for A and B and 2 for end char, again usually *

How can I turn the buffer stream returned into the response expected = AB

Any help appreciated

[
    {
        "id": "1fb9bfd6b774893e",
        "type": "tab",
        "label": "Flow 1",
![barcode (1)|114x100](upload://3jjcUwTQMgwa5jxV34Op5DWwpIS.gif)

        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "48a2823d0ca13bd0",
        "type": "gethiddevices-p",
        "z": "1fb9bfd6b774893e",
        "name": "",
        "x": 460,
        "y": 80,
        "wires": [
            [
                "b5d9b5ddd4d558a8"
            ]
        ]
    },
    {
        "id": "32a82573f9e3fe82",
        "type": "inject",
        "z": "1fb9bfd6b774893e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 260,
        "y": 80,
        "wires": [
            [
                "48a2823d0ca13bd0"
            ]
        ]
    },
    {
        "id": "b5d9b5ddd4d558a8",
        "type": "debug",
        "z": "1fb9bfd6b774893e",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 630,
        "y": 80,
        "wires": []
    },
    {
        "id": "779ea1705617b5e3",
        "type": "hiddevice-p",
        "z": "1fb9bfd6b774893e",
        "connection": "adddbb6873e3b38d",
        "name": "",
        "x": 450,
        "y": 140,
        "wires": [
            [
                "42ac4e6eaaeb4af7"
            ],
            [],
            [
                "571b2af7d94c3ab2"
            ]
        ]
    },
    {
        "id": "c0a71c38fae4c315",
        "type": "inject",
        "z": "1fb9bfd6b774893e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 140,
        "wires": [
            [
                "779ea1705617b5e3"
            ]
        ]
    },
    {
        "id": "c5529c599568862c",
        "type": "debug",
        "z": "1fb9bfd6b774893e",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 840,
        "y": 120,
        "wires": []
    },
    {
        "id": "42ac4e6eaaeb4af7",
        "type": "function",
        "z": "1fb9bfd6b774893e",
        "name": "Hex to String",
        "func": "const hexBuffer = msg.payload;\nmsg.org = hexBuffer;\n\n// Convert the hex buffer to a Buffer object\nconst buffer = Buffer.from(hexBuffer, 'hex');\n\n// Convert the Buffer to a string\nconst string = buffer.toString();\n\n// Assign the string to msg.payload for further processing\nmsg.payload = string;\nconsole.log (`Buffer`)\nconsole.log (hexBuffer)\n\nconsole.log (`String`)\nconsole.log (string)\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 650,
        "y": 120,
        "wires": [
            [
                "c5529c599568862c"
            ]
        ]
    },
    {
        "id": "571b2af7d94c3ab2",
        "type": "debug",
        "z": "1fb9bfd6b774893e",
        "name": "debug 6",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 700,
        "y": 180,
        "wires": []
    },
    {
        "id": "adddbb6873e3b38d",
        "type": "hidconfig-p",
        "vid": "3118",
        "pid": "4257",
        "interface": "",
        "path": "/dev/hidraw3",
        "name": ""
    },
    {
        "id": "5848074e288b8495",
        "type": "global-config",
        "env": [],
        "modules": {
            "@jpkelly/node-red-usbhid": "1.1.0"
        }
    }
]

Console log

Buffer
<Buffer 02 00 00 00 00 00 00 00>
String
 
Buffer
<Buffer 02 00 00 00 00 00 00 00>
String
 
Buffer
<Buffer 02 00 04 00 00 00 00 00>
String
 
 
Buffer
<Buffer 02 00 04 00 00 00 00 00>
String
 
 
Buffer
<Buffer 02 00 05 00 00 00 00 00>
String
 
 
Buffer
<Buffer 02 00 05 00 00 00 00 00>
String
 
 
Buffer
<Buffer 00 00 00 00 00 00 00 00>
String
Buffer
<Buffer 00 00 00 00 00 00 00 00>
String

Have look in the node-red-node-pi-gpio package, there is a keyboard node that should return key presses without having to decode USB hid messages.

Thx. Will try out when back in the office and come back to you later this week. Have tried with USB keyboard into my Mac running NR but KB not sensed by the gpio node, guess this is due to not being a Pi :slight_smile:

It is very much linux specific