From 39eeebd043efd97a198ef7ac90721d2d33328cea Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Thu, 1 Dec 2022 19:43:10 +0530
Subject: [PATCH] midi cw: paddle reverse control via midi to cw key

---
 midi2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/midi2.c b/midi2.c
index a8967db..68bc74c 100644
--- a/midi2.c
+++ b/midi2.c
@@ -435,13 +435,17 @@ g_print("%s:TAB:Insert desc=%p in CMDS[%d] table\n",__FUNCTION__,desc,key);
 void midi_keyer_update(void) {
     // read the global cw_keyer_speed and send midi commands
     char wpmctrl[4] = {0xb1, 0, cw_keyer_speed}; // 0xb0, lower nibble is channel number.
-
+    char paddleReverseCtl[4] = {0xb1, 2, cw_keys_reversed};
     int status;
     if (cw_midi_output != NULL) {
 	fprintf(stderr, "MIDI Keyer: setting WPM to %d\n", cw_keyer_speed);
 	if ((status = snd_rawmidi_write(cw_midi_output, wpmctrl, 4)) < 0) {
 	    fprintf(stderr, "Problem writing to MIDI output: %s", snd_strerror(status));
 	}
+
+        if ((status = snd_rawmidi_write(cw_midi_output, paddleReverseCtl, 4)) < 0) {
+            fprintf(stderr, "Problem writing to MIDI output: %s", snd_strerror(status));
+        }
     } else {
 	fprintf(stderr, "MIDI device is not open yet\n");
     }
-- 
2.45.2