How to feed the output of a barcode scanner into two systems? - barcode-scanner

I have a ds4308 barcode scanner and have to feed the output of a scanner into two systems like one PC and one Raspberry Pi.
How to do it?

Related

Redirect USB HID Barcode output to /dev/tty device

I am having a USB-HID barcode scanner. When I try to scan the barcode the output is displaying on STDOUT. I am using Ubuntu machine. I want the output to be redirected to some tty device. So I will be doing open(tty*) with blocking mode.Wait till the Barcode data is captured in that /dev/tty*.
How can i achieve the redirecting part ?
So your problem is basically that you are not able to "bind" the barcode reader input to your software which redirects it to the /dev/tty*?
In this case I would recommend the Python evdev module. "evdev" stands for "event device" which is a Linux kernel term (see evdev on Wikipedia). Your barcode reader is an event device (/dev/input/event*) like a keyboard or gamepad. You could create an event device object with Python evdev and use the grab_context() method to bind the input exclusively to your script. Mention that there are also Linux evdev libraries for other languages which probably all refer to the C implementation.
Having a similar issue I started to write a software for piping barcode input to the network via MQTT. If you want to have a look at example code you could check out my project. The relevant Python files are directly in the root directory.

How do you get input from a USB microphone in Python 3?

How do you get input from a USB microphone in Python 3? I want to use a raspberry pi 3 model b and a USB microphone. The USB microphone has the automatic gain off. I want to get the decibel level of the sound the USB microphone is picking up, and I want to use that information as a variable to be used in the Python 3 program. I DO NOT WANT to record sound from the USB microphone, save it as a wave file, and use the wave file in the program. I want the program to be working with real time sound.

How does Linux determine a device class?

Linux newbie question.
Just wondering how Linux determines which device class a device is? Specifically, when I plug a barcode scanner in how does it know it is an ttyACM device? I have a scanner that works with my Linux OS but the new model isn't recognized so I'm wondering if I can alter a file somewhere in the system that tells it to recognize the scanner as ttyACM0 and use the existing drivers.
USB devices (I assume your scanner is USB) are identified by vendorId and productId (two 16bit integers), each driver fill an array with the list of supported vendor/prods id (creating a relation vendor:prod->driver), I guess at compile time all the id in the array are merged together in a list which then is used for a lookup search when a device is plugged in.
Usually you can see vendor and product id of the attached device with dmesg command right after the device is plugged in (or with lsusb).
For ttyACM see acm_ids[] in drivers/usb/class/cdc-acm.c
Careful playing around with device drivers, even being ttyACM a terminal interface only if the interface tty->hardware is implemented poorly some command may break the hardware.
Perhaps this question should be in Unix & Linux stackexchange

Get MIDI note from USB interface on Arduino Yun

I am using an Arduino Yun and a MIDI to USB interface and my goal is to read the incoming MIDI note on the installed Linux operating system.
The goal is to have the computer on the Yun read the note and send it to the Arduino which then transmits a square wave over the pins at the note played on the piano.
But I can't figure out how to read from the USB interface; the Linux system is command line only and I can't figure out a good way to read the incoming note.
There is nothing special about USB; the USB MIDI driver makes the interface show up as a normal MIDI port, which can be accessed like any other MIDI port.
If you want to write a shell script, the easiest way is probably to parse the output of aseqdump.
See Translating MIDI input into computer keystrokes on Linux? for an example.
If you want to write a C program, you have to use the ALSA sequencer API; consider using the aseqdump source code as a template.
If you just want to send the raw MIDI bytes over the serial line, you can simply read them from /dev/snd/midiC?D?.

LabVIEW string output

How do I send a string output from a DAQ Board (NI- USB 6259) using LabVIEW? I want to send commands such as "CELL 0" or "READ" to a potentiostat device using LabVIEW.
Thanks
The 6259 doesn't do string output. It's a data acquisition board that's intended for reading/sourcing analog voltages or sending/receiving individual digital signals. It's not a communications device.
If you're really trying to send strings to this device, you probably need something more like an RS-232 or GPIB connection.
As eaolson said a DAQ is not intended to control devices. However it is an interesting project to enter the guts of the communication protocol. Doing it with a DAQ would require to:
Identify the protocol (GPIB or RS-232)
Make your cable from the DAQ output connector
For each command, generate the waveform in LabVIEW, by using the letters' ASCII code, stop bits, etc. This is the funniest part (INMHO, but I understand it's not everybody!)
Send it (using DAQ analog write VIs, you should find many examples for this)
The oscilloscope will be your best friend

Resources