diff options
Diffstat (limited to 'md/writeup/linux_pc_speaker.md')
-rw-r--r-- | md/writeup/linux_pc_speaker.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/md/writeup/linux_pc_speaker.md b/md/writeup/linux_pc_speaker.md new file mode 100644 index 0000000..1462c1c --- /dev/null +++ b/md/writeup/linux_pc_speaker.md @@ -0,0 +1,42 @@ +title:Linux PC speaker +keywords:pc,linux,speaker,c + +# Linux PC speaker +PC speaker can make sound you whant. Here is small PC speaker player. +Set notes , set time delay and you on. You should run this code under +root if nothing happens. + +```c +int main() +{ + int rc,i; + note *curent_song; + curent_song = song; + struct timespec t1; + rc = syscall(SYS_open,"/dev/console",O_WRONLY,7*8*64+7*8+7); //open cosole + if (rc == 0) + rc = 1; + + ioctl( rc, KIOCSOUND , 0 ); + ioctl( rc , KDSETLED , 7 ); + + i = 0; + while ( curent_song[i].n != 0 ) + { + ioctl( rc , KIOCSOUND , curent_song[i].n ); + msleep( (curent_song[i].t) ); + ioctl( rc , KDSETLED , i&0x0007 ); + i++; + } + ioctl( rc , KDSETLED , 0 ); + ioctl( rc, KIOCSOUND , 0 ); + + return 0; +} +``` + + +## Downloads +linux_pc_speaker.zip - +5KiB - http://archive.main.lv/files/writeup/linux_pc_speaker/linux_pc_speaker.zip + |