summaryrefslogtreecommitdiffstats
path: root/main/busybox
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-08-21 14:10:17 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-08-21 14:10:17 +0000
commit49215dddb6eb715823be0e4b21bba37a8fd55ad3 (patch)
tree13e4ac2131400d03a673aac9d5f475bae6829198 /main/busybox
parent4f53083405e28b13463689bc983289d477b0ea35 (diff)
downloadaports-49215dddb6eb715823be0e4b21bba37a8fd55ad3.tar.bz2
aports-49215dddb6eb715823be0e4b21bba37a8fd55ad3.tar.xz
busybox: backport the beep applet from git
Diffstat (limited to 'main/busybox')
-rw-r--r--main/busybox/0001-add-simple-beep-applet.patch (renamed from main/busybox/0001-add-simple-beep-applet-second-version.patch)127
-rw-r--r--main/busybox/0002-add-config-knob-for-default-freq-and-length.patch79
-rw-r--r--main/busybox/APKBUILD10
-rw-r--r--main/busybox/busyboxconfig4
4 files changed, 161 insertions, 59 deletions
diff --git a/main/busybox/0001-add-simple-beep-applet-second-version.patch b/main/busybox/0001-add-simple-beep-applet.patch
index 834026fa..050f229b 100644
--- a/main/busybox/0001-add-simple-beep-applet-second-version.patch
+++ b/main/busybox/0001-add-simple-beep-applet.patch
@@ -1,16 +1,16 @@
-From b36908b21def4916b10c62ae3e28cacb9073556e Mon Sep 17 00:00:00 2001
+From f1ca52c6dacbec39246fca696a597f5dbeca321f 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, second version
+Date: Fri, 21 Aug 2009 13:18:31 +0200
+Subject: [PATCH 1/2] add simple beep applet
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
include/applets.h | 1 +
- include/usage.h | 9 +++++
+ include/usage.h | 10 ++++
miscutils/Config.in | 6 +++
miscutils/Kbuild | 1 +
- miscutils/beep.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 5 files changed, 118 insertions(+), 0 deletions(-)
+ miscutils/beep.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 137 insertions(+), 0 deletions(-)
create mode 100644 miscutils/beep.c
diff --git a/include/applets.h b/include/applets.h
@@ -26,21 +26,22 @@ index 32c596d..5ddbfe4 100644
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
+index bfacc56..f51b848 100644
--- a/include/usage.h
+++ b/include/usage.h
-@@ -142,6 +142,15 @@
+@@ -142,6 +142,16 @@
"$ basename /foo/bar.txt .txt\n" \
"bar"
+#define beep_trivial_usage \
-+ "-f freq -l length -d delay -r repetitions"
++ "-f freq -l length -d delay -r repetitions -n"
+#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" \
++ "\n -n Start new tone" \
+
#define fbsplash_trivial_usage \
"-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]"
@@ -76,10 +77,10 @@ index 23d7d8d..8cf3406 100644
lib-$(CONFIG_CROND) += crond.o
diff --git a/miscutils/beep.c b/miscutils/beep.c
new file mode 100644
-index 0000000..81755d8
+index 0000000..d5c3531
--- /dev/null
+++ b/miscutils/beep.c
-@@ -0,0 +1,101 @@
+@@ -0,0 +1,119 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * beep implementation for busybox
@@ -89,7 +90,6 @@ index 0000000..81755d8
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ *
+ */
-+
+#include "libbb.h"
+
+#include <linux/kd.h>
@@ -106,21 +106,8 @@ index 0000000..81755d8
+#define LENGTH (50)
+#define DELAY (0)
+#define REPETITIONS (1)
-+#if 0
-+typedef struct beep {
-+ struct beep *next;
-+ unsigned freq, length, delay, rep;
-+} beep_t;
-+static beep_t* new_beep(void) {
-+ beep_t *beep = (beep_t*)xzalloc(sizeof(beep_t));
-+ beep->freq = FREQ;
-+ beep->length = LENGTH;
-+ beep->delay = DELAY;
-+ beep->rep = REPETITIONS;
-+ return beep;
-+}
-+#endif
-+#define GET_ARG do { if (!*++opt) opt = *++argv; } while (0)
++
++#define GET_ARG do { if (!*++opt) opt = *++argv; if (opt == NULL) bb_show_usage();} while (0)
+#define NEW_BEEP() { \
+ freq = FREQ; \
+ length = LENGTH; \
@@ -134,37 +121,40 @@ index 0000000..81755d8
+ int speaker = get_console_fd_or_die();
+ unsigned freq, length, delay, rep;
+ unsigned long ioctl_arg;
++ char *opt = NULL;
++ bool do_parse = true;
+
+ NEW_BEEP()
-+ while (*++argv) {
-+ char *opt = *argv;
++ while (*argv && *++argv) {
++ opt = *argv;
+
+ while (*opt == '-')
+ ++opt;
-+
-+ switch (*opt) {
-+ case 'f':
-+ GET_ARG;
-+ freq = xatoul(opt);
-+ continue;
-+ case 'l':
-+ GET_ARG;
-+ length = xatoul(opt);
-+ continue;
-+ case 'd':
-+ GET_ARG;
-+ delay = xatoul(opt);
-+ continue;
-+ case 'r':
-+ GET_ARG;
-+ freq = xatoul(opt);
-+ continue;
-+ case 'n':
-+ break;
-+ default:
-+ bb_show_usage();
-+ break;
-+ }
++ if (do_parse)
++ switch (*opt) {
++ case 'f':
++ GET_ARG;
++ freq = xatoul(opt);
++ continue;
++ case 'l':
++ GET_ARG;
++ length = xatoul(opt);
++ continue;
++ case 'd':
++ GET_ARG;
++ delay = xatoul(opt);
++ continue;
++ case 'r':
++ GET_ARG;
++ rep = xatoul(opt);
++ continue;
++ case 'n':
++ break;
++ default:
++ bb_show_usage();
++ break;
++ }
++ again:
+ while (rep) {
+//bb_info_msg("rep[%d] freq=%d, length=%d, delay=%d", rep, freq, length, delay);
+ ioctl_arg = (int)(CLOCK_TICK_RATE/freq);
@@ -175,12 +165,41 @@ index 0000000..81755d8
+ usleep(delay);
+ }
+ if (opt && *opt == 'n')
-+ NEW_BEEP()
++ NEW_BEEP()
++ if (!do_parse && *argv == NULL)
++ goto out;
+ }
++ do_parse = false;
++ goto again;
++ out:
+ if (ENABLE_FEATURE_CLEAN_UP)
+ close(speaker);
+ return EXIT_SUCCESS;
+}
++/*
++ * so, e.g. Beethoven's 9th symphony "Ode an die Freude" would be
++ * something like:
++a=$((220*3))
++b=$((247*3))
++c=$((262*3))
++d=$((294*3))
++e=$((329*3))
++f=$((349*3))
++g=$((392*3))
++#./beep -f$d -l200 -r2 -n -f$e -l100 -d 10 -n -f$c -l400 -f$g -l200
++./beep -f$e -l200 -r2 \
++ -n -d 100 -f$f -l200 \
++ -n -f$g -l200 -r2 \
++ -n -f$f -l200 \
++ -n -f$e -l200 \
++ -n -f$d -l200 \
++ -n -f$c -l200 -r2 \
++ -n -f$d -l200 \
++ -n -f$e -l200 \
++ -n -f$e -l400 \
++ -n -f$d -l100 \
++ -n -f$d -l200 \
++*/
--
1.6.4
diff --git a/main/busybox/0002-add-config-knob-for-default-freq-and-length.patch b/main/busybox/0002-add-config-knob-for-default-freq-and-length.patch
new file mode 100644
index 00000000..5055ae87
--- /dev/null
+++ b/main/busybox/0002-add-config-knob-for-default-freq-and-length.patch
@@ -0,0 +1,79 @@
+From b2e8817293648eac825ef64be4604af505b65d65 Mon Sep 17 00:00:00 2001
+From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+Date: Fri, 21 Aug 2009 14:40:29 +0200
+Subject: [PATCH 2/2] add config knob for default freq and length
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ miscutils/Config.in | 16 ++++++++++++++++
+ miscutils/beep.c | 12 ++++++++++--
+ scripts/defconfig | 3 +++
+ 3 files changed, 29 insertions(+), 2 deletions(-)
+
+diff --git a/miscutils/Config.in b/miscutils/Config.in
+index e56a3fc..f2104bb 100644
+--- a/miscutils/Config.in
++++ b/miscutils/Config.in
+@@ -25,6 +25,22 @@ config BEEP
+ help
+ The beep applets beeps in a given freq/Hz.
+
++config FEATURE_BEEP_FREQ
++ int "default frequency"
++ range 0 2147483647
++ default 4000
++ depends on BEEP
++ help
++ Frequency for default beep.
++
++config FEATURE_BEEP_LENGTH
++ int "default length"
++ range 0 2147483647
++ default 30
++ depends on BEEP
++ help
++ Length in ms for default beep.
++
+ config CHAT
+ bool "chat"
+ default n
+diff --git a/miscutils/beep.c b/miscutils/beep.c
+index d5c3531..79e7547 100644
+--- a/miscutils/beep.c
++++ b/miscutils/beep.c
+@@ -19,8 +19,16 @@
+ #define OPT_d (1<<2)
+ #define OPT_r (1<<3)
+ /* defaults */
+-#define FREQ (4440)
+-#define LENGTH (50)
++#ifndef CONFIG_FEATURE_BEEP_FREQ
++# define FREQ (4000)
++#else
++# define FREQ (CONFIG_FEATURE_BEEP_FREQ)
++#endif
++#ifndef CONFIG_FEATURE_BEEP_LENGTH
++# define LENGTH (30)
++#else
++# define LENGTH (CONFIG_FEATURE_BEEP_LENGTH)
++#endif
+ #define DELAY (0)
+ #define REPETITIONS (1)
+
+diff --git a/scripts/defconfig b/scripts/defconfig
+index f991363..d7cef7c 100644
+--- a/scripts/defconfig
++++ b/scripts/defconfig
+@@ -554,6 +554,9 @@ CONFIG_FEATURE_MOUNT_LOOP=y
+ #
+ CONFIG_ADJTIMEX=y
+ # CONFIG_BBCONFIG is not set
++CONFIG_BEEP=y
++CONFIG_FEATURE_BEEP_FREQ=4000
++CONFIG_FEATURE_BEEP_LENGTH=30
+ CONFIG_CHAT=y
+ CONFIG_FEATURE_CHAT_NOFAIL=y
+ # CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+--
+1.6.4
+
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index 0bf896cc..9d89ef43 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=6
+pkgrel=7
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
license="GPL-2"
@@ -11,7 +11,8 @@ 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-second-version.patch
+ 0001-add-simple-beep-applet.patch
+ 0002-add-config-knob-for-default-freq-and-length.patch
bb-tar-numeric-owner.patch
busybox-sed-3.patch
busyboxconfig"
@@ -49,7 +50,8 @@ 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
-3ba0529f64aadae6ce95c683e6182988 0001-add-simple-beep-applet-second-version.patch
+aa6869db437e11af86b5bf6c7d44b0a5 0001-add-simple-beep-applet.patch
+e55b64d4510aebb83661dac3271e12d3 0002-add-config-knob-for-default-freq-and-length.patch
0b5b2d7db201f90cd08f4a3164ee29a1 bb-tar-numeric-owner.patch
b75c3f419f8392dfdadd92aa24fdba8c busybox-sed-3.patch
-3ece68eb92d97f3362dab7d838074d10 busyboxconfig"
+59d9b2e920505abce869de7a3abac050 busyboxconfig"
diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig
index fd46cfe7..4c250ac7 100644
--- a/main/busybox/busyboxconfig
+++ b/main/busybox/busyboxconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.14.3
-# Wed Aug 19 08:31:14 2009
+# Fri Aug 21 13:55:23 2009
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -551,6 +551,8 @@ CONFIG_FEATURE_MOUNT_LOOP=y
CONFIG_ADJTIMEX=y
CONFIG_BBCONFIG=y
CONFIG_BEEP=y
+CONFIG_FEATURE_BEEP_FREQ=440
+CONFIG_FEATURE_BEEP_LENGTH=200
# CONFIG_CHAT is not set
# CONFIG_FEATURE_CHAT_NOFAIL is not set
# CONFIG_FEATURE_CHAT_TTY_HIFI is not set