public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Patch: Num/Caps_lock state - ioctl flags mixed up
@ 2002-04-12 10:28 Rok Papež
  0 siblings, 0 replies; only message in thread
From: Rok Papež @ 2002-04-12 10:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: alan

Hello.

It look like the flags for setting the state of caps lock and num lock in kd.h
are mixed up. For setting just the LEDs (but not the state) they work OK.

-------------------- patch --------------------------------

--- 2.4.18/include/linux/kd.h	Thu Nov 22 20:47:07 2001
+++ 2.4.18-k_fix/include/linux/kd.h	Fri Apr 12 11:47:44 2002
@@ -26,8 +26,8 @@
 #define KDGETLED	0x4B31	/* return current led state */
 #define KDSETLED	0x4B32	/* set led state [lights, not flags] */
 #define 	LED_SCR		0x01	/* scroll lock led */
-#define 	LED_CAP		0x04	/* caps lock led */
 #define 	LED_NUM		0x02	/* num lock led */
+#define 	LED_CAP		0x04	/* caps lock led */
 
 #define KDGKBTYPE	0x4B33	/* get keyboard type */
 #define 	KB_84		0x01
@@ -89,8 +89,8 @@
 #define KDSKBMETA	0x4B63	/* sets meta key handling mode */
 
 #define		K_SCROLLLOCK	0x01
-#define		K_CAPSLOCK	0x02
-#define		K_NUMLOCK	0x04
+#define		K_NUMLOCK	0x02
+#define		K_CAPSLOCK	0x04
 #define	KDGKBLED	0x4B64	/* get led flags (not lights) */
 #define KDSKBLED	0x4B65	/* set led flags (not lights) */

-------------------- test app --------------------------------

#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/kd.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  int param = 0;
  int rc;

  if(argc>1)
    param = atoi(argv[1]);

  switch(param) {
  case 1:
      param = K_CAPSLOCK;
      break;

  case 2:
      param = K_NUMLOCK;
      break;

  default:
      printf("parameter should be:\n\t- 1 for K_CAPSLOCK\n\t- 2 for K_NUMLOCK\n");
      return -1;
  } //~switch

  rc = ioctl(STDIN_FILENO, KDSKBLED, param);
  if(rc)
    printf("%s\n", strerror(errno));

  return 0;
}

-- 
best regards,
Rok Papež.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-12 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-12 10:28 Patch: Num/Caps_lock state - ioctl flags mixed up Rok Papež

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox