Giter VIP home page Giter VIP logo

Comments (11)

gdziuba avatar gdziuba commented on September 14, 2024

Did you run the commands associated to the Linux instructions? By default node red can access usb because of permissions.

These instructions?

from node-red-contrib-usbhid.

EW57 avatar EW57 commented on September 14, 2024

Yes, initially when I would attempt to reload the rules, I would get an error. Upon looking @ node-hid, I noticed a slight difference as follows sudo udevadm control --reload-rules, no errors occurred with the 'sudo' addition, however, I still have the issue of each character having its own message (as shown above). My /etc/udev/rules.d/85-pure-data.rules is as follows:
Capture

from node-red-contrib-usbhid.

gdziuba avatar gdziuba commented on September 14, 2024

Make sure you don't have any other competing rules in the same directory and assure that you restarted.

from node-red-contrib-usbhid.

gdziuba avatar gdziuba commented on September 14, 2024

@EW57 I think I figured out your issue. Sorry hadn't had a chance to look until now. You need to update your KERNEL=="hidraw2" not "hidraw0"

Signified here:
image

It should look like this:

SUBSYSTEM=="input", GROUP="input", MODE="0777"
SUBSYSTEM=="usb", MODE:="777", GROUP="input"
KERNEL=="hidraw2", MODE="0777", GROUP="input"

I should probably make this point a little bigger in the readme:

Now add the following rules to /etc/udev/rules.d/85-pure-data.rules making sure to updated KERNEL to your hidraw* device:

from node-red-contrib-usbhid.

EW57 avatar EW57 commented on September 14, 2024

Attempted an number of variations yesterday with both the Honeywell & Bur3003.

With the Honeywell, if the kernel was changed to "hidraw*", the scanner would output a string vs individual characters, so that was an improvement.

However, regardless of what scanner settings, I changed, I couldnt eliminate additional characters from being output.

For example, scanning a type 39 barcode with a value of "*03-02*" would output "��]A003-02b0"

I assume this could be rectified in the 'hex to string' function, however, I currently lack the understanding on how to manipulate that data.

With the Bur3003, regardless of what I changed the kernel value to, (or scanner settings attempted), the output would remain as shown, being a number of outputs all with single character values.

It appears that the Symbol LS2208 is a popular device & I'm attempted to try one in this application.

from node-red-contrib-usbhid.

gdziuba avatar gdziuba commented on September 14, 2024

@EW57 Glad to hear that you had improvement and got data in. It sounds like the issues you have now are "configuration" of the barcode scanner and potentially regexing out the parts you don't like with extra characters.

Have you tried using something like ChatGPT for the extra characters. It become very helpful for creating functions like this. For example, the question I would ask for the example above would look like this:

Can you help me write a function in Node-RED that will extract the the value using a regular expression out of msg.paylod. The payload looks like "��]A003-02b0" and I want to pull the variable "03-02" out.

Running it through ChatGPT it returned this function:

// Function node code
// Assuming msg.payload is the string from which you want to extract the value

// Regular expression to find the pattern "A" followed by two digits, a hyphen, and two more digits
const regex = /A(\d{2}-\d{2})/;

// Using the regular expression to search within msg.payload
const matches = msg.payload.match(regex);

// Check if we found a match
if (matches && matches.length > 1) {
    // matches[0] would be the full string that matches the regex including 'A'
    // matches[1] is the first capturing group (the part we're interested in)
    msg.payload = matches[1];
} else {
    // If no match was found, maybe handle the error or set payload to null
    msg.payload = null;
}

return msg;

Use Regexer to adjust further.

from node-red-contrib-usbhid.

intmech avatar intmech commented on September 14, 2024

I'm having a very similar issue, I've followed the linux install instructions, I'm running on a rpi4b 32bit up to date, I can see the barcode scanner outputs the correct string in a text editor on the pi's local desktop, but the usbhid node gives me gibberish.

image
image

any advice on where to look?

from node-red-contrib-usbhid.

gdziuba avatar gdziuba commented on September 14, 2024

@intmech What happens if you bypass the hex to string block? It looks like the barcode scanner is setup to send multiple messages.

When can you connect a debug node to the second output and see if you are getting any errors?

from node-red-contrib-usbhid.

intmech avatar intmech commented on September 14, 2024

from node-red-contrib-usbhid.

intmech avatar intmech commented on September 14, 2024

image

from node-red-contrib-usbhid.

gdziuba avatar gdziuba commented on September 14, 2024

@intmech, IMO the node is functioning as expected, but parsing the data is the problem. I would look at the documentation for the scanner and see if the data is being sent in a certain structure. From there, it would be possible to reverse engineer.

from node-red-contrib-usbhid.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.