7 releases

0.3.2 Aug 26, 2023
0.3.1 Aug 26, 2023
0.2.0 Aug 17, 2023
0.1.2 Jul 5, 2023

#653 in Hardware support

Download history 109/week @ 2024-07-27 2/week @ 2024-08-03 6/week @ 2024-09-21 1/week @ 2024-09-28

52 downloads per month

MIT license

8KB
94 lines

beep-evdev

Beep the PC speaker using evdev.

Prerequisites

The current user must be allowed to r/w to the speaker device:

$ cat /etc/udev/rules.d/70-pcspkr-beep.rules
ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", GROUP="beep", MODE="0660"

Examples:

extern crate beep_evdev;

use beep_evdev::beep;
use std::{thread, time};

fn main() {
    beep(440).expect("could not beep");
    thread::sleep(time::Duration::from_millis(500));
    beep(880).expect("could not beep");
    thread::sleep(time::Duration::from_millis(500));
    beep(0).expect("could not beep");
}

Dependencies

~3.5MB
~80K SLoC