Opened 14 years ago

Closed 14 years ago

#23 closed defect (fixed)

Arithmetic error in volume-down

Reported by: jhamrick Owned by:
Priority: critical Component: remctl
Keywords: Cc:

Description

According to kaduk:

athena% athrun remctl remctl zsr v down
/usr/lib/gutenbach/remctl/volume-down: 3: arithmetic expression:
expecting EOF: " 25 [81%] [3.00dB] - 1 "

Change History (2)

comment:1 Changed 14 years ago by adehnert

I blame 04a6a6614c90df2a961a.

I suspect this should fix that, though I'm too lazy to figure out how to test or commit...:

alex@kronborg gutenbach [17:26] $ git diff --cached
diff --git a/remctl/lib/gutenbach/volume-down b/remctl/lib/gutenbach/volume-down
index 7dd8e24..bd562e5 100755
--- a/remctl/lib/gutenbach/volume-down
+++ b/remctl/lib/gutenbach/volume-down
@@ -1,3 +1,3 @@
 #!/bin/sh
 PATH="$(dirname $0):$PATH"
-volume-set . $(( $(volume-get .) - 1 ))
+volume-set . $(( $(volume-get-numeric .) - 1 ))
diff --git a/remctl/lib/gutenbach/volume-get-numeric b/remctl/lib/gutenbach/volume-get-numeric
new file mode 100755
index 0000000..cfb0219
--- /dev/null
+++ b/remctl/lib/gutenbach/volume-get-numeric
@@ -0,0 +1,8 @@
+#!/bin/sh
+PATH="$(dirname $0):$PATH"
+
+mixer=$(/usr/lib/gutenbach/gutenbach-get-config mixer)
+channel=$(/usr/lib/gutenbach/gutenbach-get-config channel)
+
+amixer get $mixer | grep "$channel" \
+ | perl -lne 'print $1 if (/: Playback ([0-9]+)/)'
diff --git a/remctl/lib/gutenbach/volume-up b/remctl/lib/gutenbach/volume-up
index a330773..30d9c84 100755
--- a/remctl/lib/gutenbach/volume-up
+++ b/remctl/lib/gutenbach/volume-up
@@ -1,3 +1,3 @@
 #!/bin/sh
 PATH="$(dirname $0):$PATH"
-volume-set . $(( $(volume-get .) + 1 ))
+volume-set . $(( $(volume-get-numeric .) + 1 ))

comment:2 Changed 14 years ago by mats_a

  • Resolution set to fixed
  • Status changed from new to closed

fixed by new patch by mats_a:

added remctl helper file called volume-helper.py
this script smoothly moves volume up/down over 3sec (large step)

made volume-up and volume-down call it (volume-helper.py +/-)

this commit also contains a bugfix by quentin: previously
"amixer set PCM -3dB" would recognize -3dB as "option 3dB",
fixed by means of using "--" in the calling convention
Note: See TracTickets for help on using tickets.