"Where's the Beep?" (PCMCIA/vt_ioctl-s)

B. D. Elliott (bde@nwlink.com)
Tue, 15 Jul 2003 00:48:26 -0700


On my old DELL LM laptop the -2.5 series no longer issues any beeps when
a card is inserted. The problem is in the kernel, as the test program
below (extracted from cardmgr) beeps on -2.4, but not on -2.5.

===========================================================
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

#define BEEP_TIME 150
#define BEEP_OK 1000
#define BEEP_WARN 2000
#define BEEP_ERR 4000

#include <sys/kd.h>

static void beep(unsigned int, unsigned int);

int
main(int argc, char **argv)
{
beep(500, 1000);
beep(500, 2000);
beep(500, 4000);
return 0;
}

static
void beep(unsigned int ms, unsigned int freq)
{
int fd, arg;

fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
return;
arg = (ms << 16) | freq;
ioctl(fd, KDMKTONE, arg);
close(fd);
usleep(ms*1000);
}
===========================================================

-- 
B. D. Elliott   bde@nwlink.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/