Created
July 17, 2017 15:15
-
-
Save benpicco/e24ddf674e31fec994df448d37dfbb02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/ioctl.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <linux/kd.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
int main(int argc, char* argv[]) { | |
int fd = open("/dev/console", O_WRONLY); | |
if (fd < 0) { | |
printf("can't open console\n"); | |
return fd; | |
} | |
if (geteuid()) { | |
printf("use:\n\tsudo %s\n", argv[0]); | |
return -1; | |
} | |
for (int t=0;;t++) { | |
int val = (t*(((t>>12)|(t>>8))&(63&(t>>4)))); | |
printf("%d\n", val); | |
ioctl(fd, KIOCSOUND, val); | |
usleep(25000); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment