aboutsummaryrefslogtreecommitdiff
path: root/audio/lsmi/rtprio.diff
diff options
context:
space:
mode:
Diffstat (limited to 'audio/lsmi/rtprio.diff')
-rw-r--r--audio/lsmi/rtprio.diff153
1 files changed, 153 insertions, 0 deletions
diff --git a/audio/lsmi/rtprio.diff b/audio/lsmi/rtprio.diff
new file mode 100644
index 0000000000000..4322314f9ae19
--- /dev/null
+++ b/audio/lsmi/rtprio.diff
@@ -0,0 +1,153 @@
+diff -Naur lsmi/lsmi-joystick.c lsmi.patched//lsmi-joystick.c
+--- lsmi/lsmi-joystick.c 2012-05-14 20:08:19.000000000 -0400
++++ lsmi.patched//lsmi-joystick.c 2012-05-14 20:15:16.000000000 -0400
+@@ -46,6 +46,7 @@
+ #include <sys/time.h>
+ #include <signal.h>
+ #include <getopt.h>
++#include <sched.h>
+
+ #include "seq.h"
+ #include "sig.h"
+@@ -99,6 +100,7 @@
+ "Options:\n\n"
+ " -h | --help Show this message\n"
+ " -d | --device specialfile Event device to use (instead of js0)\n"
++ " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
+ " -v | --verbose Be verbose (show note events)\n"
+ " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
+ " -n | --no-hold Send controller data even when no joystick button is held\n" );
+@@ -121,6 +123,7 @@
+ { "verbose", no_argument, NULL, 'v' },
+ { "device", required_argument, NULL, 'd' },
+ { "no-hold", no_argument, NULL, 'n' },
++ { "realtime", required_argument, NULL, 'R' },
+ { "daemon", no_argument, NULL, 'z' },
+ { NULL, 0, NULL, 0 }
+ };
+@@ -164,6 +167,23 @@
+ case 'z':
+ daemonize = 1;
+ break;
++ case 'R':
++ {
++ struct sched_param sp;
++
++ sp.sched_priority = atoi( optarg );
++
++ if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
++ {
++ perror( "sched_setscheduler()" );
++ fprintf( stderr, "Failed to get realtime priority!\n" );
++ exit( 1 );
++ }
++
++ fprintf( stderr, "Using realtime priority %i.\n",
++ sp.sched_priority );
++ }
++ break;
+ }
+
+ }
+diff -Naur lsmi/lsmi-keyhack.c lsmi.patched//lsmi-keyhack.c
+--- lsmi/lsmi-keyhack.c 2012-05-14 20:08:19.000000000 -0400
++++ lsmi.patched//lsmi-keyhack.c 2012-05-14 20:14:07.000000000 -0400
+@@ -111,6 +111,7 @@
+ #include <getopt.h>
+
+ #include <linux/input.h>
++#include <sched.h>
+ #include <stdint.h>
+
+ #include "seq.h"
+@@ -261,6 +262,7 @@
+ " -h | --help Show this message\n"
+ " -d | --device specialfile Event device to use (instead of event0)\n"
+ " -v | --verbose Be verbose (show note events)\n"
++ " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
+ " -c | --channel n Initial MIDI channel\n"
+ " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
+ " -k | --keydata file Name file to read/write key mappings (instead of ~/.keydb)\n"
+@@ -281,6 +283,7 @@
+ { "channel", required_argument, NULL, 'c' },
+ { "device", required_argument, NULL, 'd' },
+ { "keydata", required_argument, NULL, 'k' },
++ { "realtime", required_argument, NULL, 'R' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
+ };
+@@ -320,6 +323,23 @@
+ case 'v':
+ verbose = 1;
+ break;
++ case 'R':
++ {
++ struct sched_param sp;
++
++ sp.sched_priority = atoi( optarg );
++
++ if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
++ {
++ perror( "sched_setscheduler()" );
++ fprintf( stderr, "Failed to get realtime priority!\n" );
++ exit( 1 );
++ }
++
++ fprintf( stderr, "Using realtime priority %i.\n",
++ sp.sched_priority );
++ }
++ break;
+ }
+
+ }
+diff -Naur lsmi/lsmi-mouse.c lsmi.patched//lsmi-mouse.c
+--- lsmi/lsmi-mouse.c 2012-05-14 20:08:19.000000000 -0400
++++ lsmi.patched//lsmi-mouse.c 2012-05-14 20:11:08.000000000 -0400
+@@ -55,6 +55,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/time.h>
+
++#include <sched.h>
+ #include <stdint.h>
+
+ #include <getopt.h>
+@@ -144,6 +145,7 @@
+ " -h | --help Show this message\n"
+ " -d | --device specialfile Event device to use (instead of event0)\n"
+ " -v | --verbose Be verbose (show note events)\n"
++ " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
+ " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
+
+ " -1 | --button-one 'c'|'n':n:n Button mapping\n"
+@@ -169,6 +171,7 @@
+ { "button-one", required_argument, NULL, '1' },
+ { "button-two", required_argument, NULL, '2' },
+ { "button-three", required_argument, NULL, '3' },
++ { "realtime", required_argument, NULL, 'R' },
+ { "daemon", no_argument, NULL, 'z' },
+ { NULL, 0, NULL, 0 }
+ };
+@@ -202,6 +205,23 @@
+ case '3':
+ parse_map( 2, optarg );
+ break;
++ case 'R':
++ {
++ struct sched_param sp;
++
++ sp.sched_priority = atoi( optarg );
++
++ if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
++ {
++ perror( "sched_setscheduler()" );
++ fprintf( stderr, "Failed to get realtime priority!\n" );
++ exit( 1 );
++ }
++
++ fprintf( stderr, "Using realtime priority %i.\n",
++ sp.sched_priority );
++ }
++ break;
+ case 'z':
+ daemonize = 1;
+ break;