Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 May 2000 22:51:00 -0500
From:      Alex Kosorukoff <alex@3form.com>
To:        freebsd-stable@freebsd.org
Subject:   Console ioctl in FBSD
Message-ID:  <391CD124.C8EAAEBD@3form.com>

next in thread | raw e-mail | index | archive | help
I try to control keyboard LEDs with ioctl calls but they don't work.
Despite ioctl returns success, LEDs will not turn on/off. The same code
works fine on Linux (with a change of <machine/console.h> to
<linux/kd.h>. Is it a bug or feature of FBSD? How to make it work?

The code is following:

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <machine/console.h>

main(int argc, char *argv[]) {
  char leds;

  if ( ioctl( 0, KDGETLED, &leds ) ) {
      fprintf(stderr,"Can't get leds\n");
      exit(1);
  }
  if ( ioctl( 0, KDSETLED, leds | LED_CAP ) ) {
      fprintf(stderr,"Can't set leds\n");
      exit(1);
  }
  printf("Caps lock should glow\n");
  getchar();
  ioctl( 0, KDSETLED, leds );
  exit(0);
}

Sincerely,
Alex



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?391CD124.C8EAAEBD>