Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Dec 1999 12:33:35 +0100 (CET)
From:      kas@kas.no (Knut A. Syed)
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/15480: Change-request for /usr/src/usr.sbin/cdcontrol/
Message-ID:  <199912141133.MAA24537@escudo.nhh.no>

next in thread | raw e-mail | index | archive | help

>Number:         15480
>Category:       misc
>Synopsis:       Change-request for /usr/src/usr.sbin/cdcontrol/
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 14 03:40:02 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Knut A. Syed
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
>Environment:
>Description:

Attached is a patch to make cdcontrol(1) a bit easier to use.  The
volume-command is modified.  If used with only one parameter it sets
both channels.  If used without parameters it will print volume-info.

~kas

>How-To-Repeat:
>Fix:
diff -crN cdcontrol.orig/cdcontrol.1 cdcontrol/cdcontrol.1
*** cdcontrol.orig/cdcontrol.1	Mon Dec 13 21:56:21 1999
--- cdcontrol/cdcontrol.1	Mon Dec 13 21:32:26 1999
***************
*** 104,109 ****
--- 104,119 ----
  .It Cm close
  Inject the disc.
  
+ .It Cm volume
+ Same as
+ .Em status volume
+ command.
+ 
+ .It Cm volume Ar level
+ Set the volume of both channels to 
+ .Ar level .
+ Allowed values are in the range 0-255. 
+ 
  .It Cm volume Ar left_channel Ar right_channel
  Set the volume of left channel to 
  .Ar left_channel
diff -crN cdcontrol.orig/cdcontrol.c cdcontrol/cdcontrol.c
*** cdcontrol.orig/cdcontrol.c	Mon Dec 13 21:56:21 1999
--- cdcontrol/cdcontrol.c	Mon Dec 13 21:47:11 1999
***************
*** 16,21 ****
--- 16,27 ----
   * 11-Oct-1995: Serge V.Vakulenko <vak@cronyx.ru>
   *              New eject algorithm.
   *              Some code style reformatting.
+  *
+  * 1999-12-13:  Knut A. Syed <kas@kas.no>
+  *              Version 2.0.1.
+  *              Volume-command modified.  If used with only one
+  *              parameter it now sets both channels.  If used without
+  *              parameters it will print volume-info.
   */
  
  #ifndef lint
***************
*** 34,40 ****
  #include <sys/cdio.h>
  #include <sys/ioctl.h>
  
! #define VERSION "2.0"
  
  #define ASTS_INVALID    0x00  /* Audio status byte not valid */
  #define ASTS_PLAYING    0x11  /* Audio play operation in progress */
--- 40,46 ----
  #include <sys/cdio.h>
  #include <sys/ioctl.h>
  
! #define VERSION "2.0.1"
  
  #define ASTS_INVALID    0x00  /* Audio status byte not valid */
  #define ASTS_PLAYING    0x11  /* Audio play operation in progress */
***************
*** 92,98 ****
  { CMD_SET,      "set",          2, "msf | lba" },
  { CMD_STATUS,   "status",       1, "[audio | media | volume]" },
  { CMD_STOP,     "stop",         3, "" },
! { CMD_VOLUME,   "volume",       1, "<l> <r> | left | right | mute | mono | stereo" },
  { 0, }
  };
  
--- 98,104 ----
  { CMD_SET,      "set",          2, "msf | lba" },
  { CMD_STATUS,   "status",       1, "[audio | media | volume]" },
  { CMD_STOP,     "stop",         3, "" },
! { CMD_VOLUME,   "volume",       1, "<l&r> | <l> <r> | left | right | mute | mono | stereo" },
  { 0, }
  };
  
***************
*** 239,245 ****
  
  int run (int cmd, char *arg)
  {
! 	int l, r, rc;
  
  	switch (cmd) {
  
--- 245,251 ----
  
  int run (int cmd, char *arg)
  {
! 	int l, r, rc, count;
  
  	switch (cmd) {
  
***************
*** 349,354 ****
--- 355,363 ----
  		if (fd < 0 && !open_cd ())
  			return (0);
  
+ 		if (strlen(arg) == 0)
+ 			return pstatus ("volume");
+ 
  		if (! strncasecmp (arg, "left", strlen(arg)))
  			return ioctl (fd, CDIOCSETLEFT);
  
***************
*** 364,375 ****
  		if (! strncasecmp (arg, "mute", strlen(arg)))
  			return ioctl (fd, CDIOCSETMUTE);
  
! 		if (2 != sscanf (arg, "%d %d", &l, &r)) {
  			warnx("invalid command arguments");
  			return (0);
  		}
- 
- 		return setvol (l, r);
  
  	default:
  	case CMD_HELP:
--- 373,387 ----
  		if (! strncasecmp (arg, "mute", strlen(arg)))
  			return ioctl (fd, CDIOCSETMUTE);
  
! 		count = sscanf (arg, "%d %d", &l, &r);
! 		if (count == 1)
! 			return setvol (l, l);
! 		if (count == 2) 
! 			return setvol (l, r);
! 		else {
  			warnx("invalid command arguments");
  			return (0);
  		}
  
  	default:
  	case CMD_HELP:


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912141133.MAA24537>