Connect Ham Radio Transceiver to Mumble (Mumble-Funk)

2014/12/07 7M4MON

1. Change RTS pin when mumble is talking (make mumble-funk).

2.Injecting keyboard input events when SerialPort's CTS pin changed.



network

The interface board is isolated by photocoupler ( RTS/CTS ) or transformer (AF).



1. Change RTS pin when mumble is talking (make mumble-funk).


Mumblefunk is here.
http://www.mumble-funk.de/


but this site's script may not work.
see this bbs thread.

$ sudo apt-get install jackd
$ cd ~/mumble/release
$ sudo ./mumble

Change audio devices(input/output) to JACK

2. Injecting keyboard input events when SerialPort's CTS pin changed.

To handle comport on Linux, use python script.
see below
http://stackoverflow.com/questions/5904895/python-monitor-serial-port-rs-232-handshake-signals

To Inject keybord events on Linux, use evdev.
see below
https://github.com/gvalkov/python-evdev/blob/master/doc/tutorial.rst

So, I wrote a python script (cts2key.py).

from evdev import UInput, ecodes as e
from serial import Serial
from fcntl import  ioctl
from termios import (
    TIOCMIWAIT,
    TIOCM_CTS
)

ser = Serial('/dev/ttyUSB0')

wait_signals = (TIOCM_CTS)

ui = UInput()

if __name__ == '__main__':
    while True:
        ioctl(ser.fd, TIOCMIWAIT, wait_signals)
        
        if ser.getCTS():
	    ui.write(e.EV_KEY, e.KEY_A, 1)  # KEY_A down
            ui.syn()
        else:
            ui.write(e.EV_KEY, e.KEY_A, 0)  # KEY_A up
            ui.syn()


This script needs python-evdev.

$ apt-get install python-dev python-pip gcc
$ sudo pip install evdev

$ sudo chmod o+w /dev/uinput
$ python cts2key.py

Set the Push to Talk Setting and Shortcuts set "A" key.

OMG IT WORKS!!!