Pawel Suchanecki
2013-12-19 11:23:36 UTC
Dear list,
I run Linux 3.7.1 built with ptxdist 2012.12.0 on mini2440.
I have the /dev/input/beeper device ready:
***@xxx:~ dmesg | grep pwm
s3c24xx-pwm s3c24xx-pwm.0: tin at 25312500, tdiv at 25312500, tin=divclk, base 0
input: pwm-beeper as /devices/platform/s3c24xx-pwm.0/pwm-beeper/input/input1
The ring-bell tool is producing sound, however the beeper fails to
mute (turn off the beeping sound) very often, like every other time (a
few per 10 runs).
What the be the root cause of this?
Is there any known solution?
I also created a simple code tone-uni.c (should have based it on
ring-bell.c) that looks like:
#include<fcntl.h>
#include<stdio.h>
#include<linux/input.h>
int main(int argc, char *argv[])
{
int fd, version, ret;
struct input_event event;
if (argc < 3) {
printf ("usage: <device> <tone value>");
return 1;
}
if ((fd = open(argv[1], O_RDWR)) < 0) {
perror("beep test");
return 1;
}
event.type = EV_SND;
event.code = SND_TONE;
event.value = atoi(argv[2]);
ret = write(fd, &event, sizeof(struct input_event));
close(fd);
return 0;
}
And I set two variables ON and OFF like this:
ON=./tone-uni /dev/input/beeper 333
OFF=./tone-uni /dev/input/beeper 0
The beeper turning off works "quite reliably" only using one-liner of
form (double call to $ON is needed to make it work):
while [ 1 ] ; do $ON; $ON && $OFF && for i in `seq 1 5` ; do $OFF;
done ; sleep 2; done
but also occasionally (1 per hundreds of while loops) it beeps longer
than normally, basically up to next loop.
How can I get this working? I need this for my project (the device is
going to be sent tomorrow to the client).
Thank you in advance,
Pawel.
I run Linux 3.7.1 built with ptxdist 2012.12.0 on mini2440.
I have the /dev/input/beeper device ready:
***@xxx:~ dmesg | grep pwm
s3c24xx-pwm s3c24xx-pwm.0: tin at 25312500, tdiv at 25312500, tin=divclk, base 0
input: pwm-beeper as /devices/platform/s3c24xx-pwm.0/pwm-beeper/input/input1
The ring-bell tool is producing sound, however the beeper fails to
mute (turn off the beeping sound) very often, like every other time (a
few per 10 runs).
What the be the root cause of this?
Is there any known solution?
I also created a simple code tone-uni.c (should have based it on
ring-bell.c) that looks like:
#include<fcntl.h>
#include<stdio.h>
#include<linux/input.h>
int main(int argc, char *argv[])
{
int fd, version, ret;
struct input_event event;
if (argc < 3) {
printf ("usage: <device> <tone value>");
return 1;
}
if ((fd = open(argv[1], O_RDWR)) < 0) {
perror("beep test");
return 1;
}
event.type = EV_SND;
event.code = SND_TONE;
event.value = atoi(argv[2]);
ret = write(fd, &event, sizeof(struct input_event));
close(fd);
return 0;
}
And I set two variables ON and OFF like this:
ON=./tone-uni /dev/input/beeper 333
OFF=./tone-uni /dev/input/beeper 0
The beeper turning off works "quite reliably" only using one-liner of
form (double call to $ON is needed to make it work):
while [ 1 ] ; do $ON; $ON && $OFF && for i in `seq 1 5` ; do $OFF;
done ; sleep 2; done
but also occasionally (1 per hundreds of while loops) it beeps longer
than normally, basically up to next loop.
How can I get this working? I need this for my project (the device is
going to be sent tomorrow to the client).
Thank you in advance,
Pawel.