diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-19 08:32:49 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-19 08:32:49 +0000 |
commit | 35a5dd67e089a801cb2462e71cddeb00caf86f80 (patch) | |
tree | c5e9192362d11ccb5e94a33a5ec62a11fae138fb | |
parent | 87239ae6b56c9bdac3676c2e7c11bc5aedb9855d (diff) | |
download | aports-35a5dd67e089a801cb2462e71cddeb00caf86f80.tar.bz2 aports-35a5dd67e089a801cb2462e71cddeb00caf86f80.tar.xz |
main/busybox: backport of beep applet
-rw-r--r-- | main/busybox/0001-add-simple-beep-applet.patch | 155 | ||||
-rw-r--r-- | main/busybox/APKBUILD | 6 | ||||
-rw-r--r-- | main/busybox/busyboxconfig | 7 |
3 files changed, 163 insertions, 5 deletions
diff --git a/main/busybox/0001-add-simple-beep-applet.patch b/main/busybox/0001-add-simple-beep-applet.patch new file mode 100644 index 0000000000..004d607919 --- /dev/null +++ b/main/busybox/0001-add-simple-beep-applet.patch @@ -0,0 +1,155 @@ +From 23c387cd9d1c833679bee898ef49738be8c64727 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> +Date: Tue, 18 Aug 2009 22:28:09 +0200 +Subject: [PATCH] add simple beep applet + +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> +--- + include/applets.h | 1 + + include/usage.h | 9 ++++++ + miscutils/Config.in | 6 ++++ + miscutils/Kbuild | 1 + + miscutils/beep.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 87 insertions(+), 0 deletions(-) + create mode 100644 miscutils/beep.c + +diff --git a/include/applets.h b/include/applets.h +index 32c596d..5ddbfe4 100644 +--- a/include/applets.h ++++ b/include/applets.h +@@ -80,6 +80,7 @@ USE_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk)) + USE_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename)) + USE_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER)) ++USE_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + //USE_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_NEVER)) + USE_BRCTL(APPLET(brctl, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) +diff --git a/include/usage.h b/include/usage.h +index bfacc56..ac8669c 100644 +--- a/include/usage.h ++++ b/include/usage.h +@@ -142,6 +142,15 @@ + "$ basename /foo/bar.txt .txt\n" \ + "bar" + ++#define beep_trivial_usage \ ++ "-f freq -l length -d delay -r repetitions" ++#define beep_full_usage "\n\n" \ ++ "Options:\n" \ ++ "\n -f Frequency in Hz" \ ++ "\n -l Length in ms" \ ++ "\n -d Delay in ms" \ ++ "\n -r Repetitions" \ ++ + #define fbsplash_trivial_usage \ + "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" + #define fbsplash_full_usage "\n\n" \ +diff --git a/miscutils/Config.in b/miscutils/Config.in +index 7feaf4a..e56a3fc 100644 +--- a/miscutils/Config.in ++++ b/miscutils/Config.in +@@ -19,6 +19,12 @@ config BBCONFIG + The bbconfig applet will print the config file with which + busybox was built. + ++config BEEP ++ bool "beep" ++ default n ++ help ++ The beep applets beeps in a given freq/Hz. ++ + config CHAT + bool "chat" + default n +diff --git a/miscutils/Kbuild b/miscutils/Kbuild +index 23d7d8d..8cf3406 100644 +--- a/miscutils/Kbuild ++++ b/miscutils/Kbuild +@@ -7,6 +7,7 @@ + lib-y:= + lib-$(CONFIG_ADJTIMEX) += adjtimex.o + lib-$(CONFIG_BBCONFIG) += bbconfig.o ++lib-$(CONFIG_BEEP) += beep.o + lib-$(CONFIG_CHAT) += chat.o + lib-$(CONFIG_CHRT) += chrt.o + lib-$(CONFIG_CROND) += crond.o +diff --git a/miscutils/beep.c b/miscutils/beep.c +new file mode 100644 +index 0000000..4c25454 +--- /dev/null ++++ b/miscutils/beep.c +@@ -0,0 +1,70 @@ ++/* vi: set sw=4 ts=4: */ ++/* ++ * beep implementation for busybox ++ * ++ * Copyright (C) 2009 Bernhard Reutner-Fischer ++ * ++ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. ++ * ++ */ ++ ++#include "libbb.h" ++ ++#include <linux/kd.h> ++#ifndef CLOCK_TICK_RATE ++#define CLOCK_TICK_RATE 1193180 ++#endif ++ ++#define OPT_f (1<<0) ++#define OPT_l (1<<1) ++#define OPT_d (1<<2) ++#define OPT_r (1<<3) ++/* defaults */ ++#define FREQ (4440) ++#define LENGTH (50) ++#define DELAY (0) ++#define REPETITIONS (1) ++int beep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; ++int beep_main(int argc UNUSED_PARAM, char **argv) ++{ ++ int speaker = get_console_fd_or_die(); ++ llist_t *_freq = NULL, *_length = NULL, *_delay = NULL, *_rep = NULL; ++ unsigned freq, length, delay, rep; ++ unsigned long ioctl_arg; ++ unsigned opt; ++ ++ opt_complementary = "f::l::d::r::"; ++ opt = getopt32(argv, "f:l:d:r:n", &_freq, &_length, &_delay, &_rep); ++ ++ do { ++ if (opt & OPT_f && _freq) ++ freq = xatoul((char*)(llist_pop(&_freq))); ++ else ++ freq = FREQ; ++ if (opt & OPT_l && _length) ++ length = xatoul((char*)(llist_pop(&_length))); ++ else ++ length = LENGTH; ++ if (opt & OPT_d && _delay) ++ delay = xatoul((char*)(llist_pop(&_delay))); ++ else ++ delay = DELAY; ++ if (opt & OPT_r && _rep) ++ rep = xatoul((char*)(llist_pop(&_rep))); ++ else ++ rep = REPETITIONS; ++ ++ while (rep) { ++//bb_info_msg("rep[%d] freq=%d, length=%d, delay=%d\n", rep, freq, length, delay); ++ ioctl_arg = (int)(CLOCK_TICK_RATE/freq); ++ xioctl(speaker, KIOCSOUND, (void*)ioctl_arg); ++ usleep(1000 * length); ++ ioctl(speaker, KIOCSOUND, 0); ++ if (rep--) ++ usleep(delay); ++ } ++ } while (_freq || _length || _delay || _rep); ++ if (ENABLE_FEATURE_CLEAN_UP) ++ close(speaker); ++ return EXIT_SUCCESS; ++} +-- +1.6.4 + diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 7fb318c1bd..dc3cee4884 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox pkgver=1.14.3 -pkgrel=4 +pkgrel=5 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net license="GPL-2" @@ -11,6 +11,7 @@ triggers="busybox.trigger:/bin /usr/bin /sbin /usr/sbin /lib/modules/*" source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 $pkgname-1.11.1-bb.patch 0001-install-compat-fix-for-mode-of-created-files.patch + 0001-add-simple-beep-applet.patch bb-tar-numeric-owner.patch busybox-sed-3.patch busyboxconfig" @@ -48,6 +49,7 @@ build() { md5sums="d170bf5f97a41aec3a505eab690d5699 busybox-1.14.3.tar.bz2 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch 73d39c57483084298c7e46bdbbbea8d1 0001-install-compat-fix-for-mode-of-created-files.patch +ba66abc89c56df842c9b81759c78d890 0001-add-simple-beep-applet.patch 0b5b2d7db201f90cd08f4a3164ee29a1 bb-tar-numeric-owner.patch b75c3f419f8392dfdadd92aa24fdba8c busybox-sed-3.patch -0be49dc673a849b5bf5e670db8c8c7b6 busyboxconfig" +3ece68eb92d97f3362dab7d838074d10 busyboxconfig" diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig index 38f0a19f4c..fd46cfe779 100644 --- a/main/busybox/busyboxconfig +++ b/main/busybox/busyboxconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.14.2 -# Wed Jul 15 18:07:16 2009 +# Busybox version: 1.14.3 +# Wed Aug 19 08:31:14 2009 # CONFIG_HAVE_DOT_CONFIG=y @@ -71,7 +71,7 @@ CONFIG_INSTALL_APPLET_DONT=y # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set -CONFIG_PREFIX="/home/ncopa/aports/core/busybox/pkg/busybox" +CONFIG_PREFIX="/home/ncopa/aports/main/busybox/pkg/busybox" # # Busybox Library Tuning @@ -550,6 +550,7 @@ CONFIG_FEATURE_MOUNT_LOOP=y # CONFIG_ADJTIMEX=y CONFIG_BBCONFIG=y +CONFIG_BEEP=y # CONFIG_CHAT is not set # CONFIG_FEATURE_CHAT_NOFAIL is not set # CONFIG_FEATURE_CHAT_TTY_HIFI is not set |