svn commit: r203799 - head/usr.bin/elf2aout
Author: ru Date: Fri Feb 12 15:07:24 2010 New Revision: 203799 URL: http://svn.freebsd.org/changeset/base/203799 Log: Make manpage's SYNOPSIS match program's usage(). Submitted by: Alexander Best (manpage) Modified: head/usr.bin/elf2aout/elf2aout.1 head/usr.bin/elf2aout/elf2aout.c Modified: head/usr.bin/elf2aout/elf2aout.1 == --- head/usr.bin/elf2aout/elf2aout.1Fri Feb 12 14:50:21 2010 (r203798) +++ head/usr.bin/elf2aout/elf2aout.1Fri Feb 12 15:07:24 2010 (r203799) @@ -32,7 +32,7 @@ .Nd "Convert ELF binary to a.out format" .Sh SYNOPSIS .Nm -.Op Fl o outfile +.Op Fl o Ar outfile .Ar infile .Sh DESCRIPTION The Modified: head/usr.bin/elf2aout/elf2aout.c == --- head/usr.bin/elf2aout/elf2aout.cFri Feb 12 14:50:21 2010 (r203798) +++ head/usr.bin/elf2aout/elf2aout.cFri Feb 12 15:07:24 2010 (r203799) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -155,5 +157,6 @@ static void usage(void) { - errx(1, "usage: elf2aout [-o outfile] infile"); + fprintf(stderr, "usage: elf2aout [-o outfile] infile\n"); + exit(1); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r203800 - in head/tools: regression/file/newfileops_on_fork regression/gaithrstress tools/mctest tools/netrate/http tools/netrate/httpd tools/netrate/juggle
Author: ru Date: Fri Feb 12 16:33:03 2010 New Revision: 203800 URL: http://svn.freebsd.org/changeset/base/203800 Log: Fixed error checking of pthread(3) functions. PR: 143807 Submitted by: pluknet (partly) Modified: head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c head/tools/regression/gaithrstress/gaithrstress.c head/tools/tools/mctest/mctest.cc head/tools/tools/netrate/http/http.c head/tools/tools/netrate/httpd/httpd.c head/tools/tools/netrate/juggle/juggle.c Modified: head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c == --- head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c Fri Feb 12 15:07:24 2010(r203799) +++ head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c Fri Feb 12 16:33:03 2010(r203800) @@ -113,7 +113,7 @@ main(__unused int argc, __unused char *a err(-1, "bind"); if (listen(listen_fd, -1) <0) err(-1, "listen"); - if (pthread_create(&accept_thread, NULL, do_accept, NULL) < 0) + if (pthread_create(&accept_thread, NULL, do_accept, NULL) != 0) err(-1, "pthread_create"); sleep(1); /* Easier than using a CV. */; do_fork(); Modified: head/tools/regression/gaithrstress/gaithrstress.c == --- head/tools/regression/gaithrstress/gaithrstress.c Fri Feb 12 15:07:24 2010(r203799) +++ head/tools/regression/gaithrstress/gaithrstress.c Fri Feb 12 16:33:03 2010(r203800) @@ -241,7 +241,7 @@ usage: fflush(stdout); for (i = 0; i < nworkers; i++) { if (pthread_create(&workers[i].w_thread, NULL, work, - &workers[i]) == -1) + &workers[i]) != 0) err(1, "creating worker %u", i); printf("%u%s", i, i == nworkers - 1 ? ".\n" : ", "); fflush(stdout); Modified: head/tools/tools/mctest/mctest.cc == --- head/tools/tools/mctest/mctest.cc Fri Feb 12 15:07:24 2010 (r203799) +++ head/tools/tools/mctest/mctest.cc Fri Feb 12 16:33:03 2010 (r203800) @@ -368,7 +368,7 @@ int source(char *interface, struct in_ad args[i].packets = received[i]; args[i].number = number / clients; args[i].client = base_port + i; - if (pthread_create(&thread[i], NULL, server, &args[i]) < 0) { + if (pthread_create(&thread[i], NULL, server, &args[i]) != 0) { perror("failed to create server thread"); return -1; } @@ -393,7 +393,7 @@ int source(char *interface, struct in_ad } for (int i = 0; i < clients; i++) { -if (pthread_join(thread[i], NULL) < 0) { +if (pthread_join(thread[i], NULL) != 0) { perror("failed to join thread"); return -1; } Modified: head/tools/tools/netrate/http/http.c == --- head/tools/tools/netrate/http/http.cFri Feb 12 15:07:24 2010 (r203799) +++ head/tools/tools/netrate/http/http.cFri Feb 12 16:33:03 2010 (r203800) @@ -300,15 +300,15 @@ main(int argc, char *argv[]) if (threaded) { if (pthread_barrier_init(&statep->start_barrier, NULL, - numthreads) < 0) - err(-1, "pthread_mutex_init"); + numthreads) != 0) + err(-1, "pthread_barrier_init"); } for (i = 0; i < numthreads; i++) { statep->hwd[i].hwd_count = 0; if (threaded) { if (pthread_create(&statep->hwd[i].hwd_thread, NULL, - http_worker, &statep->hwd[i]) < 0) + http_worker, &statep->hwd[i]) != 0) err(-1, "pthread_create"); } else { curthread = i; @@ -339,7 +339,7 @@ main(int argc, char *argv[]) for (i = 0; i < numthreads; i++) { if (threaded) { if (pthread_join(statep->hwd[i].hwd_thread, NULL) - < 0) + != 0) err(-1, "pthread_join"); } else { pid = waitpid(statep->hwd[i].hwd_pid, NULL, 0); Modified: head/tools/tools/netrate/httpd/httpd.c == --- head/tools/tools/netrate/httpd/httpd.c Fri Feb 12 15:07:24 2010 (r203799) +++ head/tools/tools/netrate/httpd/httpd.c Fri Feb 12 16:33:03 2010 (r203800) @@ -280,7 +280,7 @@ main(int argc, char *argv[]) for (i = 0; i < THREADS; i++) {
Re: svn commit: r203800 - in head/tools: regression/file/newfileops_on_fork regression/gaithrstress tools/mctest tools/netrate/http tools/netrate/httpd tools/netrate/juggle
On Fri, Feb 12, 2010 at 04:33:03PM +, Ruslan Ermilov wrote: > Author: ru > Date: Fri Feb 12 16:33:03 2010 > New Revision: 203800 > URL: http://svn.freebsd.org/changeset/base/203800 > > Log: > Fixed error checking of pthread(3) functions. > > PR: 143807 > Submitted by: pluknet (partly) > > Modified: > head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > head/tools/regression/gaithrstress/gaithrstress.c > head/tools/tools/mctest/mctest.cc > head/tools/tools/netrate/http/http.c > head/tools/tools/netrate/httpd/httpd.c > head/tools/tools/netrate/juggle/juggle.c > > Modified: head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > == > --- head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > Fri Feb 12 15:07:24 2010(r203799) > +++ head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > Fri Feb 12 16:33:03 2010(r203800) > @@ -113,7 +113,7 @@ main(__unused int argc, __unused char *a > err(-1, "bind"); > if (listen(listen_fd, -1) <0) > err(-1, "listen"); > - if (pthread_create(&accept_thread, NULL, do_accept, NULL) < 0) > + if (pthread_create(&accept_thread, NULL, do_accept, NULL) != 0) > err(-1, "pthread_create"); > sleep(1); /* Easier than using a CV. */; > do_fork(); err() uses errno, so this is still not quite right ? pgp6YxOtgyJO1.pgp Description: PGP signature
Re: svn commit: r203800 - in head/tools: regression/file/newfileops_on_fork regression/gaithrstress tools/mctest tools/netrate/http tools/netrate/httpd tools/netrate/juggle
On Fri, Feb 12, 2010 at 06:43:38PM +0200, Kostik Belousov wrote: > On Fri, Feb 12, 2010 at 04:33:03PM +, Ruslan Ermilov wrote: > > Author: ru > > Date: Fri Feb 12 16:33:03 2010 > > New Revision: 203800 > > URL: http://svn.freebsd.org/changeset/base/203800 > > > > Log: > > Fixed error checking of pthread(3) functions. > > > > PR: 143807 > > Submitted by: pluknet (partly) > > > > Modified: > > head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > > head/tools/regression/gaithrstress/gaithrstress.c > > head/tools/tools/mctest/mctest.cc > > head/tools/tools/netrate/http/http.c > > head/tools/tools/netrate/httpd/httpd.c > > head/tools/tools/netrate/juggle/juggle.c > > > > Modified: head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > > == > > --- head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > > Fri Feb 12 15:07:24 2010(r203799) > > +++ head/tools/regression/file/newfileops_on_fork/newfileops_on_fork.c > > Fri Feb 12 16:33:03 2010(r203800) > > @@ -113,7 +113,7 @@ main(__unused int argc, __unused char *a > > err(-1, "bind"); > > if (listen(listen_fd, -1) <0) > > err(-1, "listen"); > > - if (pthread_create(&accept_thread, NULL, do_accept, NULL) < 0) > > + if (pthread_create(&accept_thread, NULL, do_accept, NULL) != 0) > > err(-1, "pthread_create"); > > sleep(1); /* Easier than using a CV. */; > > do_fork(); > > err() uses errno, so this is still not quite right ? Yes, errc() would be in order here. "eval" of -1 in the err() call is also not quite correct, and is silently converted to 255. Cheers, -- Ruslan Ermilov r...@freebsd.org FreeBSD committer ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r203801 - head/sys/dev/aac
Author: emaste Date: Fri Feb 12 18:48:18 2010 New Revision: 203801 URL: http://svn.freebsd.org/changeset/base/203801 Log: Garbage collect Falcon/PPC support that has not been used in released products, based on discussion with Adaptec. Modified: head/sys/dev/aac/aac.c head/sys/dev/aac/aac_pci.c head/sys/dev/aac/aacreg.h head/sys/dev/aac/aacvar.h Modified: head/sys/dev/aac/aac.c == --- head/sys/dev/aac/aac.c Fri Feb 12 16:33:03 2010(r203800) +++ head/sys/dev/aac/aac.c Fri Feb 12 18:48:18 2010(r203801) @@ -107,28 +107,6 @@ static int aac_dequeue_fib(struct aac_so static int aac_enqueue_response(struct aac_softc *sc, int queue, struct aac_fib *fib); -/* Falcon/PPC interface */ -static int aac_fa_get_fwstatus(struct aac_softc *sc); -static voidaac_fa_qnotify(struct aac_softc *sc, int qbit); -static int aac_fa_get_istatus(struct aac_softc *sc); -static voidaac_fa_clear_istatus(struct aac_softc *sc, int mask); -static voidaac_fa_set_mailbox(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, - u_int32_t arg2, u_int32_t arg3); -static int aac_fa_get_mailbox(struct aac_softc *sc, int mb); -static voidaac_fa_set_interrupts(struct aac_softc *sc, int enable); - -struct aac_interface aac_fa_interface = { - aac_fa_get_fwstatus, - aac_fa_qnotify, - aac_fa_get_istatus, - aac_fa_clear_istatus, - aac_fa_set_mailbox, - aac_fa_get_mailbox, - aac_fa_set_interrupts, - NULL, NULL, NULL -}; - /* StrongARM interface */ static int aac_sa_get_fwstatus(struct aac_softc *sc); static voidaac_sa_qnotify(struct aac_softc *sc, int qbit); @@ -2417,17 +2395,6 @@ aac_rx_get_fwstatus(struct aac_softc *sc } static int -aac_fa_get_fwstatus(struct aac_softc *sc) -{ - int val; - - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - val = AAC_MEM0_GETREG4(sc, AAC_FA_FWSTATUS); - return (val); -} - -static int aac_rkt_get_fwstatus(struct aac_softc *sc) { fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -2457,15 +2424,6 @@ aac_rx_qnotify(struct aac_softc *sc, int } static void -aac_fa_qnotify(struct aac_softc *sc, int qbit) -{ - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL1, qbit); - AAC_FA_HACK(sc); -} - -static void aac_rkt_qnotify(struct aac_softc *sc, int qbit) { fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -2493,17 +2451,6 @@ aac_rx_get_istatus(struct aac_softc *sc) } static int -aac_fa_get_istatus(struct aac_softc *sc) -{ - int val; - - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - val = AAC_MEM0_GETREG2(sc, AAC_FA_DOORBELL0); - return (val); -} - -static int aac_rkt_get_istatus(struct aac_softc *sc) { fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -2531,15 +2478,6 @@ aac_rx_clear_istatus(struct aac_softc *s } static void -aac_fa_clear_istatus(struct aac_softc *sc, int mask) -{ - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask); - AAC_FA_HACK(sc); -} - -static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask) { fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -2577,24 +2515,6 @@ aac_rx_set_mailbox(struct aac_softc *sc, } static void -aac_fa_set_mailbox(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) -{ - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX, command); - AAC_FA_HACK(sc); - AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0); - AAC_FA_HACK(sc); - AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1); - AAC_FA_HACK(sc); - AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2); - AAC_FA_HACK(sc); - AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3); - AAC_FA_HACK(sc); -} - -static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) { @@ -2627,17 +2547,6 @@ aac_rx_get_mailbox(struct aac_softc *sc, } static int -aac_fa_get_mailbox(struct aac_softc *sc, int mb) -{ - int val; - - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - - val = AAC_MEM1_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4)); - return (val); -} - -static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb) { fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -2676,20 +2585,6 @@ aac_rx_set_interrupts(struct aac_softc * } static void -aac_fa_set_interrupts(struct aac_softc *sc, int enable) -{ - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enab
svn commit: r203802 - in head: bin/pkill tools/regression/usr.bin/pkill
Author: pjd Date: Fri Feb 12 18:52:24 2010 New Revision: 203802 URL: http://svn.freebsd.org/changeset/base/203802 Log: - Implement -q option for pgrep(1). - Add regression test to test -q option. Added: head/tools/regression/usr.bin/pkill/pgrep-q.t (contents, props changed) Modified: head/bin/pkill/pkill.1 head/bin/pkill/pkill.c Modified: head/bin/pkill/pkill.1 == --- head/bin/pkill/pkill.1 Fri Feb 12 18:48:18 2010(r203801) +++ head/bin/pkill/pkill.1 Fri Feb 12 18:52:24 2010(r203802) @@ -36,7 +36,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 16, 2009 +.Dd February 11, 2010 .Dt PKILL 1 .Os .Sh NAME @@ -44,7 +44,7 @@ .Nd find or signal processes by name .Sh SYNOPSIS .Nm pgrep -.Op Fl LSafilnovx +.Op Fl LSafilnoqvx .Op Fl F Ar pidfile .Op Fl G Ar gid .Op Fl M Ar core @@ -175,6 +175,8 @@ command. Select only the newest (most recently started) of the matching processes. .It Fl o Select only the oldest (least recently started) of the matching processes. +.It Fl q +Do not write anything to standard output. .It Fl s Ar sid Restrict matches to processes with a session ID in the comma-separated list Modified: head/bin/pkill/pkill.c == --- head/bin/pkill/pkill.c Fri Feb 12 18:48:18 2010(r203801) +++ head/bin/pkill/pkill.c Fri Feb 12 18:52:24 2010(r203802) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -110,6 +111,7 @@ static int matchargs; static int fullmatch; static int kthreads; static int cflags = REG_EXTENDED; +static int quiet; static kvm_t *kd; static pid_t mypid; @@ -180,10 +182,11 @@ main(int argc, char **argv) debug_opt = 0; pidfile = NULL; pidfilelock = 0; + quiet = 0; execf = NULL; coref = _PATH_DEVNULL; - while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnos:t:u:vx")) != -1) + while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnoqs:t:u:vx")) != -1) switch (ch) { case 'D': debug_opt++; @@ -258,6 +261,11 @@ main(int argc, char **argv) oldest = 1; criteria = 1; break; + case 'q': + if (!pgrep) + usage(); + quiet = 1; + break; case 's': makelist(&sidlist, LT_SID, optarg); criteria = 1; @@ -549,7 +557,7 @@ usage(void) const char *ustr; if (pgrep) - ustr = "[-LSfilnovx] [-d delim]"; + ustr = "[-LSfilnoqvx] [-d delim]"; else ustr = "[-signal] [-ILfinovx]"; @@ -567,6 +575,10 @@ show_process(const struct kinfo_proc *kp { char **argv; + if (quiet) { + assert(pgrep); + return; + } if ((longfmt || !pgrep) && matchargs && (argv = kvm_getargv(kd, kp, 0)) != NULL) { printf("%d ", (int)kp->ki_pid); @@ -623,7 +635,8 @@ grepact(const struct kinfo_proc *kp) { show_process(kp); - printf("%s", delim); + if (!quiet) + printf("%s", delim); return (1); } Added: head/tools/regression/usr.bin/pkill/pgrep-q.t == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/pkill/pgrep-q.t Fri Feb 12 18:52:24 2010(r203802) @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..4" + +name="pgrep -q" +sleep0=`mktemp /tmp/$base.XX` || exit 1 +sleep1=`mktemp /tmp/$base.XX` || exit 1 +ln -sf /bin/sleep $sleep0 +$sleep0 5 & +sleep 0.3 +pid=$! +out="`pgrep -q -f $sleep0 2>&1`" +if [ $? -eq 0 ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +if [ -z "${out}" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +out="`pgrep -q -f $sleep1 2>&1`" +if [ $? -ne 0 ]; then + echo "ok 3 - $name" +else + echo "not ok 3 - $name" +fi +if [ -z "${out}" ]; then + echo "ok 4 - $name" +else + echo "not ok 4 - $name" +fi +kill $pid +rm -f $sleep0 $sleep1 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r203804 - head/sys/ddb
Author: rpaulo Date: Fri Feb 12 19:52:51 2010 New Revision: 203804 URL: http://svn.freebsd.org/changeset/base/203804 Log: Add a space before printing 'thread pid ...' to match the space before ']'. Modified: head/sys/ddb/db_thread.c Modified: head/sys/ddb/db_thread.c == --- head/sys/ddb/db_thread.cFri Feb 12 19:36:37 2010(r203803) +++ head/sys/ddb/db_thread.cFri Feb 12 19:52:51 2010(r203804) @@ -48,7 +48,7 @@ db_print_thread(void) pid = -1; if (kdb_thread->td_proc != NULL) pid = kdb_thread->td_proc->p_pid; - db_printf("[thread pid %d tid %ld ]\n", pid, (long)kdb_thread->td_tid); + db_printf("[ thread pid %d tid %ld ]\n", pid, (long)kdb_thread->td_tid); } void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r203810 - head/sys/dev/acpica
Author: jkim Date: Sat Feb 13 02:24:23 2010 New Revision: 203810 URL: http://svn.freebsd.org/changeset/base/203810 Log: Implement LCD brightness control notify handler. Submitted by: Daniel Walter(d dot walter at 0x90 dot at) (intial version) Modified: head/sys/dev/acpica/acpi_video.c Modified: head/sys/dev/acpica/acpi_video.c == --- head/sys/dev/acpica/acpi_video.cSat Feb 13 00:39:46 2010 (r203809) +++ head/sys/dev/acpica/acpi_video.cSat Feb 13 02:24:23 2010 (r203810) @@ -83,6 +83,7 @@ static struct acpi_video_output *acpi_vi static voidacpi_video_vo_bind(struct acpi_video_output *, ACPI_HANDLE); static voidacpi_video_vo_destroy(struct acpi_video_output *); static int acpi_video_vo_check_level(struct acpi_video_output *, int); +static voidacpi_video_vo_notify_handler(ACPI_HANDLE, UINT32, void *); static int acpi_video_vo_active_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_video_vo_bright_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_video_vo_presets_sysctl(SYSCTL_HANDLER_ARGS); @@ -93,6 +94,7 @@ static void vid_set_switch_policy(ACPI_H static int vid_enum_outputs(ACPI_HANDLE, void(*)(ACPI_HANDLE, UINT32, void *), void *); static int vo_get_brightness_levels(ACPI_HANDLE, int **); +static int vo_get_brightness(ACPI_HANDLE); static voidvo_set_brightness(ACPI_HANDLE, int); static UINT32 vo_get_device_status(ACPI_HANDLE); static UINT32 vo_get_graphics_state(ACPI_HANDLE); @@ -101,6 +103,8 @@ static void vo_set_device_state(ACPI_HAN /* events */ #define VID_NOTIFY_SWITCHED0x80 #define VID_NOTIFY_REPROBE 0x81 +#defineVID_NOTIFY_INC_BRN 0x86 +#defineVID_NOTIFY_DEC_BRN 0x87 /* _DOS (Enable/Disable Output Switching) argument bits */ #define DOS_SWITCH_MASK3 @@ -577,6 +581,9 @@ acpi_video_vo_bind(struct acpi_video_out /* XXX - see above. */ vo->vo_economy = vo->vo_levels[BCL_ECONOMY]; } + if (vo->vo_levels != NULL) + AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY, + acpi_video_vo_notify_handler, vo); ACPI_SERIAL_END(video_output); } @@ -590,8 +597,11 @@ acpi_video_vo_destroy(struct acpi_video_ vo->vo_sysctl_tree = NULL; sysctl_ctx_free(&vo->vo_sysctl_ctx); } - if (vo->vo_levels != NULL) + if (vo->vo_levels != NULL) { + AcpiRemoveNotifyHandler(vo->handle, ACPI_DEVICE_NOTIFY, + acpi_video_vo_notify_handler); AcpiOsFree(vo->vo_levels); + } switch (vo->adr & DOD_DEVID_MASK) { case DOD_DEVID_MONITOR: @@ -627,6 +637,52 @@ acpi_video_vo_check_level(struct acpi_vi return (EINVAL); } +static void +acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context) +{ + struct acpi_video_output *vo; + int i, j, level, new_level; + + vo = context; + ACPI_SERIAL_BEGIN(video_output); + if (vo->handle == NULL) { + ACPI_SERIAL_END(video_output); + return; + } + + switch (notify) { + case VID_NOTIFY_INC_BRN: + case VID_NOTIFY_DEC_BRN: + if (vo->vo_levels == NULL) + break; + level = vo_get_brightness(vo->handle); + if (level < 0) + break; + new_level = level; + for (i = 0; i < vo->vo_numlevels; i++) { + j = vo->vo_levels[i]; + if (notify == VID_NOTIFY_INC_BRN) { + if (j > level && + (j < new_level || level == new_level)) + new_level = j; + } else { + if (j < level && + (j > new_level || level == new_level)) + new_level = j; + } + } + if (new_level != level) { + vo_set_brightness(vo->handle, new_level); + vo->vo_brightness = new_level; + } + break; + default: + printf("%s: unknown notify event 0x%x\n", + acpi_name(vo->handle), notify); + } + ACPI_SERIAL_END(video_output); +} + /* ARGSUSED */ static int acpi_video_vo_active_sysctl(SYSCTL_HANDLER_ARGS) @@ -900,6 +956,25 @@ out: return (num); } +static int +vo_get_brightness(ACPI_HANDLE handle) +{ + UINT32 level; + ACPI_STATUS status; + + ACPI_SERIAL_ASSERT(video_output); + status = acpi_GetInteger(handle, "_BQC", &level); + if (ACPI_FAILURE(status)) { + printf("can't evaluate %s._BQC - %s\n", acpi_name(handle), +
svn commit: r203811 - head/sys/dev/acpi_support
Author: jkim Date: Sat Feb 13 02:30:43 2010 New Revision: 203811 URL: http://svn.freebsd.org/changeset/base/203811 Log: Prefer correct and simpler backlight control methods for ASUS G2K laptop. Modified: head/sys/dev/acpi_support/acpi_asus.c Modified: head/sys/dev/acpi_support/acpi_asus.c == --- head/sys/dev/acpi_support/acpi_asus.c Sat Feb 13 02:24:23 2010 (r203810) +++ head/sys/dev/acpi_support/acpi_asus.c Sat Feb 13 02:30:43 2010 (r203811) @@ -270,8 +270,8 @@ static struct acpi_asus_model acpi_asus_ .wled_set = "WLED", .brn_get= "GPLV", .brn_set= "SPLV", - .lcd_get= "\\_SB.PCI0.SBRG.EC0.RPIN", - .lcd_set= "\\_SB.PCI0.SBRG.EC0._Q10", + .lcd_get= "GBTL", + .lcd_set= "SBTL", .disp_get = "\\_SB.PCI0.PCE2.VGA.GETD", .disp_set = "SDSP", }, @@ -1134,26 +1134,7 @@ acpi_asus_sysctl_init(struct acpi_asus_s return (FALSE); case ACPI_ASUS_METHOD_LCD: if (sc->model->lcd_get) { - if (strncmp(sc->model->name, "G2K", 3) == 0) { - ACPI_BUFFER Buf; - ACPI_OBJECT Arg, Obj; - ACPI_OBJECT_LISTArgs; - - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = 0x11; - Args.Count = 1; - Args.Pointer = &Arg; - Buf.Length = sizeof(Obj); - Buf.Pointer = &Obj; - - status = AcpiEvaluateObject(sc->handle, - sc->model->lcd_get, &Args, &Buf); - if (ACPI_SUCCESS(status) && - Obj.Type == ACPI_TYPE_INTEGER) { - sc->s_lcd = Obj.Integer.Value; - return (TRUE); - } - } else if (strncmp(sc->model->name, "L3H", 3) == 0) { + if (strncmp(sc->model->name, "L3H", 3) == 0) { ACPI_BUFFER Buf; ACPI_OBJECT Arg[2], Obj; ACPI_OBJECT_LISTArgs; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r203813 - head/sys/dev/acpica
Author: jkim Date: Sat Feb 13 05:38:21 2010 New Revision: 203813 URL: http://svn.freebsd.org/changeset/base/203813 Log: Make sanity check slightly more useful and tweak an error message. Modified: head/sys/dev/acpica/acpi_video.c Modified: head/sys/dev/acpica/acpi_video.c == --- head/sys/dev/acpica/acpi_video.cSat Feb 13 02:36:00 2010 (r203812) +++ head/sys/dev/acpica/acpi_video.cSat Feb 13 05:38:21 2010 (r203813) @@ -645,7 +645,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE vo = context; ACPI_SERIAL_BEGIN(video_output); - if (vo->handle == NULL) { + if (vo->handle != handle) { ACPI_SERIAL_END(video_output); return; } @@ -655,7 +655,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE case VID_NOTIFY_DEC_BRN: if (vo->vo_levels == NULL) break; - level = vo_get_brightness(vo->handle); + level = vo_get_brightness(handle); if (level < 0) break; new_level = level; @@ -672,13 +672,13 @@ acpi_video_vo_notify_handler(ACPI_HANDLE } } if (new_level != level) { - vo_set_brightness(vo->handle, new_level); + vo_set_brightness(handle, new_level); vo->vo_brightness = new_level; } break; default: - printf("%s: unknown notify event 0x%x\n", - acpi_name(vo->handle), notify); + printf("unknown notify event 0x%x from %s\n", + notify, acpi_name(handle)); } ACPI_SERIAL_END(video_output); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"