So I have my computer linked up via bluetooth to two different devices, and I'd like to relay the input from one device to the other device automatically.
I figure I can do this with a script, but I'm pretty green with scripting languages, and I'm not even sure if this is possible.
I know that like Linux, OSX treats serial ports as if they were file directories, so I figure this can't be too hard. I just have no idea where to start.
Can someone point me in the right direction?
I would use a simple python script. Manipulating serial ports is simple with the pyserial module. Then create thread for each port that reads from one port and writes to the other.
Related
I am writing a python pyserial app and need to debug it. It is not getting anything on its rx beyond the prompt. I would like to open up a parallel minicom on same tty and be able to see the port rx.
Is this possible without hardware logging ? Can I simply use a serial settings to allow 2 apps to run simultaneously on ttyUSB0 ?
Short answer: No, you can't access your serial ports from two processes at the same time.
There are workarounds that can give you a much cheaper solution than purchasing a hardware sniffer or a scope with serial decoding capabilities though.
You will have to define a couple of virtual serial ports and use port forwarding. This procedure has been explained here: on Linux and Windows 1, 2.
I´m working on my own smart home system using some arduinos and Xbees, receiving them on a raspberry pi / mac os X with node.js via serial line connected xbee.
I was thinking about a small simulation so that i can develop without need of running hardware. The only way i know to simulate a serial line is using named pipes which would need two files, one for the input and one for the output. This would need heavy changes within my node.js code (using xbee-api module) which i would like to avoid.
Does anyone know another way to simulate a serial line communication without splitting the communication into two files? My aim would be to simply change the name for the serial port in the configuration of my main code which should than send and receive frames.
I now decided to write my own simulator because there seems to be no other solution. I work corrently on a simulation of the serialport module for nodejs.
I'm trying to reverse the protocol used by an early nineties logic analyzer an its PC software.
The device is connected via RS-232 (propietary wiring) and communicates with a DOS program, successfully running on DOSBOX.
I'm able to control the device with the original software but it would be useful to autimathe the downloading of data from the analyzer using a custom program but to do so I need to know what is going on the serial port.
Ineed to know what mode is the serial port set, while I know for sure the datarate is either 1200 or 9600 bps (configurable on the device) I don't know the flow control (I guess it is RTS/CTS).
I also need to tap into the conversation between the prgram and the device without disturbing their communication.
Reading the serial port with another program (cutecom/minicom) prevents the emulator from receiving the data from the hardware.
So, summing up, what I need to know is:
What configuration is set on /dev/ttyS0 (via IOCTL calls, i think)
What goes on between program and device.
I was thinking in programming a library which acts as a proxy for the standard c library (via LD_PRELOAD) but there must be an easier way to do this.
You can use slsnif (Serial Line SNIFfer).
http://linux.die.net/man/1/slsnif
Here's a link to the sourceforge project so you can download it. I don't believe it comes with any modern distributions but I could be wrong so check your distro's software repository first.
http://sourceforge.net/projects/slsnif/
I use ttyrpld for tty sniffing. I ported it to PPC and run it on 2.6.32. It logs all of the tty traffic on the board to files, one per tty. Works well.
I am trying to use scilab for a project and I need to pass on some values to a robot via a serial port.
I had done this successfully on Matlab. I have ported almost everything to Scilab now but I don't know how to pass those parameter through serial port.
On the Sclilab site there are some modules, but they only work under Windows
http://atoms.scilab.org/
I am the maintainer for the Serial Communication toolbox in Scilab. This works on Linux as well. You can find it here: http://atoms.scilab.org/toolboxes/serial. This is fairly easy to use- it has functions to establish communication with the serial port, to read from and write to the serial port, and to terminate communication with the serial port. Please let me know about any feedback or questions you may have. Thanks.
I want to be able to connect a computer A's USB port to computer B's USB port so as to make computer A act as computer B's keyboard.
Any idea how I would go about doing that?
I'm not looking for a ready-made solution (though if one already exists and is open-sources I
would not object), but for a starting point or a good resource.
I imagine I'd need to write a driver that simulates the keyboard's protocol, and I would also need to sort out the entire USB master/slave scenario.
Anyway, any help would be appreciated.
P.S.
I want to do it with the mouse as well, but I imagine it will be a very similar process, and I think (but I might be wildly mistaken) that starting with the keyboard will be easier.
I am really excited to have found something that will do this from Hagstrom Electronics. It take a serial input and sends a USB keyboard output to another PC. If you combine this with a readily available USB to serial adaptor, then you are golden.
http://www.hagstromelectronics.com/products/usbkm232.html
I have been searching for weeks to find this, so I decided to go back to some forums and share the discovery.
Linux has support for USB gadget mode, but I think you need special hardware for that. I.e. the USB port in a normal PC can not do gadget mode.
An alternative is to wire an LPT port to a PS/2 keyboard input, this is technically simpler.
If it wasn't for the USB, I'd connect the two via LAN and have a client/server C# program that emulates a keyboard / mouse (e.g. via DirectInput).
For the USB part as far as I can tell you'll need some hardware adapter. If you're into hardware development or at least unafraid of a soldering iron and some µc programming, have a look at http://www.obdev.at/products/vusb/hidkeys.html where a HID stack for a small atmel chip is available for free. For this solution you'd need two atmega chips which communicate via I²C or SPI or such.
I'd recommend electrical separation of the two pcs, too. You never know if they share the same electrical ground or not.