Date: 19 Feb 2001 12:40:43 -0000 From: amorita@meadow.scphys.kyoto-u.ac.jp To: FreeBSD-gnats-submit@freebsd.org Subject: kern/25201: pccard event and syscons beep duration depend on HZ Message-ID: <20010219124043.57665.qmail@misao.kuicr.kyoto-u.ac.jp>
next in thread | raw e-mail | index | archive | help
>Number: 25201 >Category: kern >Synopsis: pccard event and syscons beep duration depend on HZ >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 19 04:50:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Akio Morita >Release: FreeBSD 4.2-STABLE i386 >Organization: NSRF, ICR, Kyoto Univ. >Environment: FreeBSD sasami.jyurai 4.2-STABLE FreeBSD 4.2-STABLE #0: Sat Feb 17 23:26:18 JST 2001 amorita@sasami.jyurai:/usr/SRC/src/sys/compile/SASAMI i386 >Description: The beep duration of pccard event and syscons is changed on the kernel compiled with ``options HZ=1000'' option. Checking code using sysbeep, I found hz depend coding in sys/pccard/pccard_beep.c, sys/i386/isa/pcvt/pcvt_kbd.c, sys/dev/syscons/syscons.h, sys/pc98/pc98/sc_machdep.h. These four codes have hard coded duration of sysbeep function, but the unit of sysbeep's duration argument is 1/hz second. Thus, the duration scaling of hz is needed. Furthermore, sc_bell's duration is loaded from escape sequence in sys/dev/syscons/scterm-sc.c, sys/pc98/pc98/scterm-sck.c. From kbdcontrol manual and usr.sbin/kbdcontrol/kbdcontrol.c coding, the unit of duration value in escape sequence is 10msec. Thus hz scaling is needed in the case hz != 100. The codes calling timeout with hard coded ticks would cause the same problem. >How-To-Repeat: Add ``options HZ=1000'' and install new kernel. Hear pccard beep/syscons beep. >Fix: o sys/pccard/pccard_beep.c Add hz scaling code to pccard_beep_sub and pccard_beep_start. o sys/i386/isa/pcvt/pcvt_kbd.c Add hz scaling to PLING and PLONG macros. o sys/dev/syscons/syscons.h, sys/pc98/pc98/sc_machdep.h Add hz scaling to BELL_DURATION macro. o sys/dev/syscons/scterm-sc.c, sys/pc98/pc98/scterm-sck.c Add hz scaling code to ``set bell pitch and duration'' escape sequence. ---- Index: sys/pc98/pc98/sc_machdep.h =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/pc98/pc98/sc_machdep.h,v retrieving revision 1.4 diff -d -u -r1.4 sc_machdep.h --- sys/pc98/pc98/sc_machdep.h 2000/01/20 15:16:26 1.4 +++ sys/pc98/pc98/sc_machdep.h 2001/02/18 09:19:49 @@ -44,7 +44,7 @@ #define KANJI 1 -#define BELL_DURATION 5 +#define BELL_DURATION ((5 * hz + 99) / 100) #define BELL_PITCH_8M 1339 #define BELL_PITCH_5M 1678 Index: sys/pc98/pc98/scterm-sck.c =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/pc98/pc98/scterm-sck.c,v retrieving revision 1.2.2.5 diff -d -u -r1.2.2.5 scterm-sck.c --- sys/pc98/pc98/scterm-sck.c 2000/07/30 08:12:41 1.2.2.5 +++ sys/pc98/pc98/scterm-sck.c 2001/02/18 09:19:49 @@ -628,7 +628,7 @@ case 'B': /* set bell pitch and duration */ if (tcp->num_param == 2) { scp->bell_pitch = tcp->param[0]; - scp->bell_duration = tcp->param[1]; + scp->bell_duration = (tcp->param[1] * hz + 99) / 100; } break; Index: sys/dev/syscons/scterm-sc.c =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/dev/syscons/scterm-sc.c,v retrieving revision 1.4.2.7 diff -d -u -r1.4.2.7 scterm-sc.c --- sys/dev/syscons/scterm-sc.c 2000/07/27 20:31:14 1.4.2.7 +++ sys/dev/syscons/scterm-sc.c 2001/02/18 09:19:49 @@ -545,7 +545,7 @@ case 'B': /* set bell pitch and duration */ if (tcp->num_param == 2) { scp->bell_pitch = tcp->param[0]; - scp->bell_duration = tcp->param[1]; + scp->bell_duration = (tcp->param[1] * hz + 99) / 100; } break; Index: sys/dev/syscons/syscons.h =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/dev/syscons/syscons.h,v retrieving revision 1.60.2.1 diff -d -u -r1.60.2.1 syscons.h --- sys/dev/syscons/syscons.h 2000/04/03 13:03:32 1.60.2.1 +++ sys/dev/syscons/syscons.h 2001/02/18 09:19:49 @@ -120,7 +120,7 @@ #define PCBURST 128 #ifndef BELL_DURATION -#define BELL_DURATION 5 +#define BELL_DURATION ((5 * hz + 99) / 100) #define BELL_PITCH 800 #endif Index: sys/i386/isa/pcvt/pcvt_kbd.c =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/i386/isa/pcvt/pcvt_kbd.c,v retrieving revision 1.32.2.1 diff -d -u -r1.32.2.1 pcvt_kbd.c --- sys/i386/isa/pcvt/pcvt_kbd.c 2000/10/29 16:59:06 1.32.2.1 +++ sys/i386/isa/pcvt/pcvt_kbd.c 2001/02/18 09:19:49 @@ -1342,8 +1342,8 @@ * pulates the spl mask - jw */ -# define PLING sysbeep(PCVT_SYSBEEPF / 1500, 2) -# define PLONG sysbeep(PCVT_SYSBEEPF / 1200, 2) +# define PLING sysbeep(PCVT_SYSBEEPF / 1500, (2 * hz + 99) / 100) +# define PLONG sysbeep(PCVT_SYSBEEPF / 1200, (2 * hz + 99) / 100) if(mousedef.stickybuttons) { Index: sys/pccard/pccard_beep.c =================================================================== RCS file: /CVSrepository/FreeBSD/src/sys/pccard/pccard_beep.c,v retrieving revision 1.3.2.1 diff -d -u -r1.3.2.1 pccard_beep.c --- sys/pccard/pccard_beep.c 2000/12/02 12:49:34 1.3.2.1 +++ sys/pccard/pccard_beep.c 2001/02/18 09:19:49 @@ -74,8 +74,8 @@ melody = (struct tone *)arg; if (melody->pitch != NULL) { - sysbeep(melody->pitch, melody->duration); - timeout(pccard_beep_sub, ++melody, melody->duration); + sysbeep(melody->pitch, (melody->duration * hz + 99) / 100); + timeout(pccard_beep_sub, ++melody, (melody->duration * hz + 99) / 100); } else allow_beep = BEEP_ON; } @@ -88,8 +88,8 @@ if (allow_beep == BEEP_ON && melody->pitch != NULL) { allow_beep = BEEP_OFF; - sysbeep(melody->pitch, melody->duration); - timeout(pccard_beep_sub, ++melody, melody->duration); + sysbeep(melody->pitch, (melody->duration * hz + 99) / 100); + timeout(pccard_beep_sub, ++melody, (melody->duration * hz + 99) / 100); } } ---- >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?20010219124043.57665.qmail>