I’ve made a hardware watch dog card that connects to a PC via USB port (it uses a general USB to Serial converter) and thru the virtual serial, I need to send some bytes telling the hardware that the PC is alive.
Now I have a client that uses RouterOS on a PC and he asked me if my card is compatible with it.
Because of that I’m making this topic.
Is it possible to run a custom C application on RouterOS? The application was made by me and I have the C source code (only POSIX C).
It it’s not an option, it is possible to send direct commands to the serial via script. It needs a INIT command to be sent when the system starts and a KEEP ALIVE command to be sent each XX minutes.
But I need a way to list the serial ports availables on system.
you probably need to setup a PPP async adapter (just like a modem dialup client) and in the INIT string enter the text you want it to send. Then setup a script that enable and disables this interface for however often you need it to send it. It’s a hack, but it should work for what you need. You won’t be able to read anything from the port, but you can surely send.
Ah yes, and there is a (although ver counter-intuitive) way to read data from the serial port on the RouterOS device itself. But you cannot read arbitrary data, you have to have control over the device connected to the serial port to talk a special protocol. Something like “HTTP-over-RS232”. I did create this setup for a special application.
But as I said - you need to run custom software on the serial device to be able to use this workaround…
Having commands to read/write from/to a serial port natively in RouterOS would surely be a tremendous help. Hint hint @ MikroTik
I have used the ppp hack and it injects an invalid route into my routing table everytime it runs. That is no good, it was causing massive packet loss. Any ideas on a workaround for this?
I was thinking maybe bridge the terminal session to telnet and then accessing it via telnet, but I have no idea how to go about doing this. I am just trying to get an internal mt script to write data to the serial port. ideas?
in the current 3.x there isnt a way to script an outbound connection other than http/ftp/ping, etc. Maybe LUA has some enhanced methods for serial access in 4.x, havent looked into that yet.
Add default route fixes the route problem, but now it doesn’t write to the LCD. I was thinking it may be because it doesn’t write to the lcd until packets are sent its way?
I’m also looking to add external temp sensor/watch dog/alarm board and stumbled upon this thread.
Here’s my idea: assuming that telnet session can be scripted…:
Create metarouter.
configure the “main” ROS as an rs232 - TCP bridge (/port remote-access )
Telnet from metarouter to the “main” ROS for bi-directional communication with the device connected to rs232.