Your message dated Sun, 19 Feb 2006 10:58:39 -0800
with message-id <[EMAIL PROTECTED]>
and subject line Bug#350214: fixed in beep 1.2.2-17
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: beep
Severity: wishlist
Tags: patch

Here's a patch from Alessandro Zummo which adds a few features, e.g.
being able to specify the device to use and support for the new
evdev types in the kernel.  It would be great if you could add
this patch.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-- 
Martin Michlmayr
http://www.cyrius.com/
--- beep.c      2005-10-04 02:54:04.000000000 +0200
+++ beep.c.new  2005-10-04 02:54:22.000000000 +0200
@@ -26,6 +26,7 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <linux/kd.h>
+#include <linux/input.h>
 
 /* I don't know where this number comes from, I admit that freely.  A 
    wonderful human named Raine M. Ekman used it in a program that played
@@ -86,18 +87,28 @@
   struct beep_parms_t *next;  /* in case -n/--new is used. */
 } beep_parms_t;
 
+enum { BEEP_TYPE_CONSOLE, BEEP_TYPE_EVDEV };
+
 /* Momma taught me never to use globals, but we need something the signal 
    handlers can get at.*/
 int console_fd = -1;
+int console_type = BEEP_TYPE_CONSOLE;
+char *console_device = NULL;
+
+void do_beep(int freq);
 
 /* If we get interrupted, it would be nice to not leave the speaker beeping in
    perpetuity. */
 void handle_signal(int signum) {
+  
+  if(console_device)
+    free(console_device);
+    
   switch(signum) {
   case SIGINT:
     if(console_fd >= 0) {
       /* Kill the sound, quit gracefully */
-      ioctl(console_fd, KIOCSOUND, 0);
+      do_beep(0);
       close(console_fd);
       exit(signum);
     } else {
@@ -110,7 +121,7 @@
 /* print usage and exit */
 void usage_bail(const char *executable_name) {
   printf("Usage:\n%s [-f freq] [-l length] [-r reps] [-d delay] "
-        "[-D delay] [-s] [-c]\n",
+        "[-D delay] [-s] [-c] [-e device]\n",
         executable_name);
   printf("%s [Options...] [-n] [--new] [Options...] ... \n", executable_name);
   printf("%s [-h] [--help]\n", executable_name);
@@ -141,11 +152,12 @@
 void parse_command_line(int argc, char **argv, beep_parms_t *result) {
   int c;
 
-  struct option opt_list[4] = {{"help", 0, NULL, 'h'},
+  struct option opt_list[] = {{"help", 0, NULL, 'h'},
                               {"version", 0, NULL, 'V'},
                               {"new", 0, NULL, 'n'},
+                              {"device", 1, NULL, 'e'},
                               {0,0,0,0}};
-  while((c = getopt_long(argc, argv, "f:l:r:d:D:schvVn", opt_list, NULL))
+  while((c = getopt_long(argc, argv, "f:l:r:d:D:schvVne:", opt_list, NULL))
        != EOF) {
     int argval = -1;    /* handle parsed numbers for various arguments */
     float argfreq = -1; 
@@ -207,6 +219,9 @@
       result->next->next       = NULL;
       result = result->next; /* yes, I meant to do that. */
       break;
+    case 'e' : /* also --device */
+      console_device = strdup(optarg);
+      break;
     case 'h' : /* notice that this is also --help */
     default :
       usage_bail(argv[0]);
@@ -214,28 +229,61 @@
   }
 }  
 
+void do_beep(int freq)
+{
+  if (console_type == BEEP_TYPE_CONSOLE)
+  {
+    if(ioctl(console_fd, KIOCSOUND, freq != 0
+      ? (int)(CLOCK_TICK_RATE/freq)
+      : freq) < 0) {
+      printf("\a");  /* Output the only beep we can, in an effort to fall back 
on usefulness */
+      perror("ioctl");
+    }
+  }
+  else
+  {
+     /* BEEP_TYPE_EVDEV */
+     struct input_event e;
+ 
+     e.type = EV_SND;
+     e.code = SND_TONE;
+     e.value = freq;
+  
+     write(console_fd, &e, sizeof(struct input_event));
+  }
+}
+
 void play_beep(beep_parms_t parms) {
   int i; /* loop counter */
 
   /* try to snag the console */
-  if((console_fd = open("/dev/tty0", O_WRONLY)) == -1) {
-    if((console_fd = open("/dev/vc/0", O_WRONLY)) == -1) {
-      fprintf(stderr, "Could not open /dev/tty0 or /dev/vc/0 for writing.\n");
-      printf("\a");  /* Output the only beep we can, in an effort to fall back 
on usefulness */
-      perror("open");
-      exit(1);
-    }
+
+  if(console_device)
+    console_fd = open(console_device, O_WRONLY);
+  else
+    if((console_fd = open("/dev/input/event0", O_WRONLY)) == -1)
+      if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
+        console_fd = open("/dev/vc/0", O_WRONLY);
+      
+  if(console_fd == -1) {
+    fprintf(stderr, "Could not open %s for writing\n",
+      console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0");
+    printf("\a");  /* Output the only beep we can, in an effort to fall back 
on usefulness */
+    perror("open");
+    exit(1);
   }
   
+  if (ioctl(console_fd, EVIOCGSND(0)) != -1)
+    console_type = BEEP_TYPE_EVDEV;
+  else
+    console_type = BEEP_TYPE_CONSOLE;
+  
   /* Beep */
   for (i = 0; i < parms.reps; i++) {                    /* start beep */
-    if(ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)) < 0) {
-      printf("\a");  /* Output the only beep we can, in an effort to fall back 
on usefulness */
-      perror("ioctl");
-    }
+    do_beep(parms.freq);
     /* Look ma, I'm not ansi C compatible! */
     usleep(1000*parms.length);                          /* wait...    */
-    ioctl(console_fd, KIOCSOUND, 0);                    /* stop beep  */
+    do_beep(0);
     if(parms.end_delay || (i+1 < parms.reps))
        usleep(1000*parms.delay);                        /* wait...    */
   }                                                     /* repeat.    */
@@ -297,5 +345,8 @@
     parms = next;
   }
 
+  if(console_device)
+    free(console_device);
+    
   return EXIT_SUCCESS;
 }

--- End Message ---
--- Begin Message ---
Source: beep
Source-Version: 1.2.2-17

We believe that the bug you reported is fixed in the latest version of
beep, which is due to be installed in the Debian FTP archive:

beep-udeb_1.2.2-17_i386.udeb
  to pool/main/b/beep/beep-udeb_1.2.2-17_i386.udeb
beep_1.2.2-17.diff.gz
  to pool/main/b/beep/beep_1.2.2-17.diff.gz
beep_1.2.2-17.dsc
  to pool/main/b/beep/beep_1.2.2-17.dsc
beep_1.2.2-17_i386.deb
  to pool/main/b/beep/beep_1.2.2-17_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Gerfried Fuchs <[EMAIL PROTECTED]> (supplier of updated beep package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 14 Feb 2006 01:27:06 +0100
Source: beep
Binary: beep beep-udeb
Architecture: source i386
Version: 1.2.2-17
Distribution: unstable
Urgency: low
Maintainer: Gerfried Fuchs <[EMAIL PROTECTED]>
Changed-By: Gerfried Fuchs <[EMAIL PROTECTED]>
Description: 
 beep       - advanced pc-speaker beeper
 beep-udeb  - advanced pc-speaker beeper (udeb)
Closes: 335027 343851 344676 350214 350220
Changes: 
 beep (1.2.2-17) unstable; urgency=low
 .
   * Added additional debconf translations:
     - Portuguese by Miguel Figueiredo (closes: #344676)
   * Updated debconf translation:
     - Vietnamese by Clytie Siddall (closes: #343851)
   * Fixed breakage raised with --verbose patch (closes: #335027)
   * Added udev generation (closes: #350220)
   * Applied patch from Alessandro Zummo for evdev and general device node
     support (closes: #350214)
Files: 
 8cc116d7d13724675b26e1d4293fa682 559 sound optional beep_1.2.2-17.dsc
 acd6753c7248a3ad9546a20a4b844a63 15838 sound optional beep_1.2.2-17.diff.gz
 7c618d9a1ad19c8fcc5d5198322c6e40 21456 sound optional beep_1.2.2-17_i386.deb
 1bb6f3985e584b815d14c50738541239 4630 debian-installer optional 
beep-udeb_1.2.2-17_i386.udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD8YXHELuA/Ba9d8YRAiqnAKD22RCX7HiM7SNnsc/cEUKTBXlI8QCeLpjp
Nin2TRY6aeKCkx7IqgJ0Qd4=
=WpgT
-----END PGP SIGNATURE-----


--- End Message ---

Reply via email to