rtprio.diff 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. diff -Naur lsmi/lsmi-joystick.c lsmi.patched//lsmi-joystick.c
  2. --- lsmi/lsmi-joystick.c 2012-05-14 20:08:19.000000000 -0400
  3. +++ lsmi.patched//lsmi-joystick.c 2012-05-14 20:15:16.000000000 -0400
  4. @@ -46,6 +46,7 @@
  5. #include <sys/time.h>
  6. #include <signal.h>
  7. #include <getopt.h>
  8. +#include <sched.h>
  9. #include "seq.h"
  10. #include "sig.h"
  11. @@ -99,6 +100,7 @@
  12. "Options:\n\n"
  13. " -h | --help Show this message\n"
  14. " -d | --device specialfile Event device to use (instead of js0)\n"
  15. + " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
  16. " -v | --verbose Be verbose (show note events)\n"
  17. " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
  18. " -n | --no-hold Send controller data even when no joystick button is held\n" );
  19. @@ -121,6 +123,7 @@
  20. { "verbose", no_argument, NULL, 'v' },
  21. { "device", required_argument, NULL, 'd' },
  22. { "no-hold", no_argument, NULL, 'n' },
  23. + { "realtime", required_argument, NULL, 'R' },
  24. { "daemon", no_argument, NULL, 'z' },
  25. { NULL, 0, NULL, 0 }
  26. };
  27. @@ -164,6 +167,23 @@
  28. case 'z':
  29. daemonize = 1;
  30. break;
  31. + case 'R':
  32. + {
  33. + struct sched_param sp;
  34. +
  35. + sp.sched_priority = atoi( optarg );
  36. +
  37. + if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
  38. + {
  39. + perror( "sched_setscheduler()" );
  40. + fprintf( stderr, "Failed to get realtime priority!\n" );
  41. + exit( 1 );
  42. + }
  43. +
  44. + fprintf( stderr, "Using realtime priority %i.\n",
  45. + sp.sched_priority );
  46. + }
  47. + break;
  48. }
  49. }
  50. diff -Naur lsmi/lsmi-keyhack.c lsmi.patched//lsmi-keyhack.c
  51. --- lsmi/lsmi-keyhack.c 2012-05-14 20:08:19.000000000 -0400
  52. +++ lsmi.patched//lsmi-keyhack.c 2012-05-14 20:14:07.000000000 -0400
  53. @@ -111,6 +111,7 @@
  54. #include <getopt.h>
  55. #include <linux/input.h>
  56. +#include <sched.h>
  57. #include <stdint.h>
  58. #include "seq.h"
  59. @@ -261,6 +262,7 @@
  60. " -h | --help Show this message\n"
  61. " -d | --device specialfile Event device to use (instead of event0)\n"
  62. " -v | --verbose Be verbose (show note events)\n"
  63. + " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
  64. " -c | --channel n Initial MIDI channel\n"
  65. " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
  66. " -k | --keydata file Name file to read/write key mappings (instead of ~/.keydb)\n"
  67. @@ -281,6 +283,7 @@
  68. { "channel", required_argument, NULL, 'c' },
  69. { "device", required_argument, NULL, 'd' },
  70. { "keydata", required_argument, NULL, 'k' },
  71. + { "realtime", required_argument, NULL, 'R' },
  72. { "verbose", no_argument, NULL, 'v' },
  73. { NULL, 0, NULL, 0 }
  74. };
  75. @@ -320,6 +323,23 @@
  76. case 'v':
  77. verbose = 1;
  78. break;
  79. + case 'R':
  80. + {
  81. + struct sched_param sp;
  82. +
  83. + sp.sched_priority = atoi( optarg );
  84. +
  85. + if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
  86. + {
  87. + perror( "sched_setscheduler()" );
  88. + fprintf( stderr, "Failed to get realtime priority!\n" );
  89. + exit( 1 );
  90. + }
  91. +
  92. + fprintf( stderr, "Using realtime priority %i.\n",
  93. + sp.sched_priority );
  94. + }
  95. + break;
  96. }
  97. }
  98. diff -Naur lsmi/lsmi-mouse.c lsmi.patched//lsmi-mouse.c
  99. --- lsmi/lsmi-mouse.c 2012-05-14 20:08:19.000000000 -0400
  100. +++ lsmi.patched//lsmi-mouse.c 2012-05-14 20:11:08.000000000 -0400
  101. @@ -55,6 +55,7 @@
  102. #include <sys/ioctl.h>
  103. #include <sys/time.h>
  104. +#include <sched.h>
  105. #include <stdint.h>
  106. #include <getopt.h>
  107. @@ -144,6 +145,7 @@
  108. " -h | --help Show this message\n"
  109. " -d | --device specialfile Event device to use (instead of event0)\n"
  110. " -v | --verbose Be verbose (show note events)\n"
  111. + " -R | --realtime rtprio Use realtime priority 'rtprio' (requires privs)\n"
  112. " -p | --port client:port Connect to ALSA Sequencer client on startup\n"
  113. " -1 | --button-one 'c'|'n':n:n Button mapping\n"
  114. @@ -169,6 +171,7 @@
  115. { "button-one", required_argument, NULL, '1' },
  116. { "button-two", required_argument, NULL, '2' },
  117. { "button-three", required_argument, NULL, '3' },
  118. + { "realtime", required_argument, NULL, 'R' },
  119. { "daemon", no_argument, NULL, 'z' },
  120. { NULL, 0, NULL, 0 }
  121. };
  122. @@ -202,6 +205,23 @@
  123. case '3':
  124. parse_map( 2, optarg );
  125. break;
  126. + case 'R':
  127. + {
  128. + struct sched_param sp;
  129. +
  130. + sp.sched_priority = atoi( optarg );
  131. +
  132. + if ( sched_setscheduler( 0, SCHED_FIFO, &sp ) < 0 )
  133. + {
  134. + perror( "sched_setscheduler()" );
  135. + fprintf( stderr, "Failed to get realtime priority!\n" );
  136. + exit( 1 );
  137. + }
  138. +
  139. + fprintf( stderr, "Using realtime priority %i.\n",
  140. + sp.sched_priority );
  141. + }
  142. + break;
  143. case 'z':
  144. daemonize = 1;
  145. break;