Re: Only default to cd with cd in drivehghyh Wrd
Patch to check for a cd in the drive before defaulting to cd. Nope, that has some bad consequences. There are some potential lock-up situations, where a bad disc in the drive can spin, spin, spin, and there is no easy obvious way to get out of the loop.
Only default to cd with cd in drivehghyh Wrd
Patch to check for a cd in the drive before defaulting to cd. Doesn't quite get me another enter during install/upgrade, but I don't know how to distinguish between install.* and the other media that don't have the sets. Index: src/distrib/miniroot/install.sub === RCS file: /cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.809 diff -u -p -u -r1.809 install.sub --- src/distrib/miniroot/install.sub12 Jan 2015 16:33:31 - 1.809 +++ src/distrib/miniroot/install.sub29 Jan 2015 18:44:00 - @@ -1605,7 +1605,9 @@ install_sets() { _d=$CGI_METHOD ifconfig netboot /dev/null 21 : ${_d:=http} - [[ -n $(get_cddevs) ]] { _locs=cd $_locs; : ${_d:=cd}; } + [[ -n $(get_cddevs) ]] { _locs=cd $_locs; for _cd in $(get_cddevs); do + disklabel -n ${_cd} /dev/null 21 : ${_d:=cd} break; + done; } [[ -x /sbin/mount_nfs ]] _locs=$_locs nfs : ${_d:=http} -Matthew Martin
Re: elantech-v4 clickpad support
Probably I was too sceptical about synaptics.c. The bug I observed with the ALPS touchpad seems to be due to a kind of mismatch between the ALPS code in pms and the event handling in wsconscomm. The patch below contains the initial change as well as what was necessary to fix this. diff --git a/wsconscomm.c b/wsconscomm.c index df3512d..9c5afe7 100644 --- a/wsconscomm.c +++ b/wsconscomm.c @@ -132,12 +132,6 @@ WSConsReadHwState(InputInfoPtr pInfo, struct wscons_event event; Bool v; -/* Reset cumulative values if buttons were not previously pressed */ -if (!hw-left !hw-right !hw-middle) { -hw-cumulative_dx = hw-x; -hw-cumulative_dy = hw-y; -} - while (WSConsReadEvent(pInfo, event)) { switch (event.type) { case WSCONS_EVENT_MOUSE_UP: @@ -187,9 +181,11 @@ WSConsReadHwState(InputInfoPtr pInfo, break; case WSCONS_EVENT_MOUSE_ABSOLUTE_X: hw-x = event.value; +hw-cumulative_dx = hw-x; break; case WSCONS_EVENT_MOUSE_ABSOLUTE_Y: hw-y = priv-maxy - event.value + priv-miny; +hw-cumulative_dy = hw-y; break; case WSCONS_EVENT_MOUSE_ABSOLUTE_Z: hw-z = event.value; @@ -204,8 +200,14 @@ WSConsReadHwState(InputInfoPtr pInfo, /* XXX magic number mapping which is mirrored in pms driver */ switch (event.value) { case 0: -hw-fingerWidth = 5; -hw-numFingers = 2; +if (priv-model != MODEL_ALPS) { +hw-fingerWidth = 5; +hw-numFingers = 2; +} else { +/* For ALPS models pms reports that w is 0 if (z = 0)? */ +hw-fingerWidth = 0; +hw-numFingers = 0; +} break; case 1: hw-fingerWidth = 5;
Re: Allow resuming with closed lid
On Fri, Jan 30, 2015 at 12:42:04AM +0100, Max Fillinger wrote: Currently, there's code in acpi.c that sends the system back to sleep when resuming with closed lid and machdep.lidsuspend=1. I often use my laptop in a docking station with an external monitor and keep the lid closed, and I'd like to be able to resume just by pushing the power button on the docking station. (Also, I first thought something was broken when pushing the button only made the suspend-indicator light blink for a moment.) If checking for open lids is necessary in some cases, then I can certainly live with lidsuspend=0, but otherwise I'd prefer if it was possible to resume with a closed lid. I removed the check and didn't notice any problems. The diff below removes the check and also the function acpibtn_numopenlids which is not used anywhere else. This was put in for a reason. I would suggest you go read the commit logs and understand why, before proposing reverting functionality you obviously have not researched. -ml Index: sys/dev/acpi/acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.281 diff -u -p -r1.281 acpi.c --- sys/dev/acpi/acpi.c 17 Jan 2015 04:18:49 - 1.281 +++ sys/dev/acpi/acpi.c 29 Jan 2015 22:53:42 - @@ -2161,7 +2161,6 @@ int acpi_sleep_state(struct acpi_softc *sc, int state) { extern int perflevel; - extern int lid_suspend; int error = ENXIO; int s; @@ -2305,10 +2304,6 @@ fail_alloc: acpi_record_event(sc, APM_NORMAL_RESUME); acpi_indicator(sc, ACPI_SST_WORKING); - - /* If we woke up but all the lids are closed, go back to sleep */ - if (acpibtn_numopenlids() == 0 lid_suspend != 0) - acpi_addtask(sc, acpi_sleep_task, sc, state); fail_tts: return (error); Index: sys/dev/acpi/acpibtn.c === RCS file: /cvs/src/sys/dev/acpi/acpibtn.c,v retrieving revision 1.41 diff -u -p -r1.41 acpibtn.c --- sys/dev/acpi/acpibtn.c27 Jan 2015 19:40:14 - 1.41 +++ sys/dev/acpi/acpibtn.c29 Jan 2015 22:53:42 - @@ -74,37 +74,6 @@ struct cfdriver acpibtn_cd = { const char *acpibtn_hids[] = { ACPI_DEV_LD, ACPI_DEV_PBD, ACPI_DEV_SBD, 0 }; -/* - * acpibtn_numopenlids - * - * Return the number of _LID devices that are in the open state. - * Used to determine if we should go back to sleep/hibernate if we - * woke up with the all the lids still closed for some reason. If - * the machine has no lids, returns -1. - */ -int -acpibtn_numopenlids(void) -{ - struct acpi_lid *lid; - int64_t val; - int ct = 0; - - /* If we have no lids ... */ - if (SLIST_EMPTY(acpibtn_lids)) - return (-1); - - /* - * Determine how many lids are open. Assumes _LID evals to - * non-0 or 0, for on / off (which is what the spec says). - */ - SLIST_FOREACH(lid, acpibtn_lids, abl_link) - if (!aml_evalinteger(lid-abl_softc-sc_acpi, - lid-abl_softc-sc_devnode, _LID, 0, NULL, val) - val != 0) - ct++; - return (ct); -} - int acpibtn_setpsw(struct acpibtn_softc *sc, int psw) { Index: sys/dev/acpi/acpidev.h === RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v retrieving revision 1.36 diff -u -p -r1.36 acpidev.h --- sys/dev/acpi/acpidev.h23 Nov 2014 20:33:47 - 1.36 +++ sys/dev/acpi/acpidev.h29 Jan 2015 22:53:42 - @@ -337,5 +337,4 @@ struct acpiec_softc { void acpibtn_disable_psw(void); void acpibtn_enable_psw(void); -int acpibtn_numopenlids(void); #endif /* __DEV_ACPI_ACPIDEV_H__ */
Allow resuming with closed lid
Currently, there's code in acpi.c that sends the system back to sleep when resuming with closed lid and machdep.lidsuspend=1. I often use my laptop in a docking station with an external monitor and keep the lid closed, and I'd like to be able to resume just by pushing the power button on the docking station. (Also, I first thought something was broken when pushing the button only made the suspend-indicator light blink for a moment.) If checking for open lids is necessary in some cases, then I can certainly live with lidsuspend=0, but otherwise I'd prefer if it was possible to resume with a closed lid. I removed the check and didn't notice any problems. The diff below removes the check and also the function acpibtn_numopenlids which is not used anywhere else. Index: sys/dev/acpi/acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.281 diff -u -p -r1.281 acpi.c --- sys/dev/acpi/acpi.c 17 Jan 2015 04:18:49 - 1.281 +++ sys/dev/acpi/acpi.c 29 Jan 2015 22:53:42 - @@ -2161,7 +2161,6 @@ int acpi_sleep_state(struct acpi_softc *sc, int state) { extern int perflevel; - extern int lid_suspend; int error = ENXIO; int s; @@ -2305,10 +2304,6 @@ fail_alloc: acpi_record_event(sc, APM_NORMAL_RESUME); acpi_indicator(sc, ACPI_SST_WORKING); - - /* If we woke up but all the lids are closed, go back to sleep */ - if (acpibtn_numopenlids() == 0 lid_suspend != 0) - acpi_addtask(sc, acpi_sleep_task, sc, state); fail_tts: return (error); Index: sys/dev/acpi/acpibtn.c === RCS file: /cvs/src/sys/dev/acpi/acpibtn.c,v retrieving revision 1.41 diff -u -p -r1.41 acpibtn.c --- sys/dev/acpi/acpibtn.c 27 Jan 2015 19:40:14 - 1.41 +++ sys/dev/acpi/acpibtn.c 29 Jan 2015 22:53:42 - @@ -74,37 +74,6 @@ struct cfdriver acpibtn_cd = { const char *acpibtn_hids[] = { ACPI_DEV_LD, ACPI_DEV_PBD, ACPI_DEV_SBD, 0 }; -/* - * acpibtn_numopenlids - * - * Return the number of _LID devices that are in the open state. - * Used to determine if we should go back to sleep/hibernate if we - * woke up with the all the lids still closed for some reason. If - * the machine has no lids, returns -1. - */ -int -acpibtn_numopenlids(void) -{ - struct acpi_lid *lid; - int64_t val; - int ct = 0; - - /* If we have no lids ... */ - if (SLIST_EMPTY(acpibtn_lids)) - return (-1); - - /* -* Determine how many lids are open. Assumes _LID evals to -* non-0 or 0, for on / off (which is what the spec says). -*/ - SLIST_FOREACH(lid, acpibtn_lids, abl_link) - if (!aml_evalinteger(lid-abl_softc-sc_acpi, - lid-abl_softc-sc_devnode, _LID, 0, NULL, val) - val != 0) - ct++; - return (ct); -} - int acpibtn_setpsw(struct acpibtn_softc *sc, int psw) { Index: sys/dev/acpi/acpidev.h === RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v retrieving revision 1.36 diff -u -p -r1.36 acpidev.h --- sys/dev/acpi/acpidev.h 23 Nov 2014 20:33:47 - 1.36 +++ sys/dev/acpi/acpidev.h 29 Jan 2015 22:53:42 - @@ -337,5 +337,4 @@ struct acpiec_softc { void acpibtn_disable_psw(void); void acpibtn_enable_psw(void); -intacpibtn_numopenlids(void); #endif /* __DEV_ACPI_ACPIDEV_H__ */
vmstat arg parsing
Often, when I want to type systat vmstat I get confused and type vmstat systat. To my surprise, this actually works. Two things to fix. First, if a drive name is not found, stop and print an error. Don't ignore it. Second, finish converting atoi to strtonum. Index: vmstat.c === RCS file: /cvs/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.136 diff -u -p -r1.136 vmstat.c --- vmstat.c16 Jan 2015 06:40:14 - 1.136 +++ vmstat.c30 Jan 2015 05:05:32 - @@ -136,7 +136,9 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, c:fiM:mN:stw:vz)) != -1) { switch (c) { case 'c': - reps = atoi(optarg); + reps = strtonum(optarg, 0, INT_MAX, errstr); + if (errstr) + errx(1, -c %s: %s, optarg, errstr); break; case 'f': todo |= FORKSTAT; @@ -222,10 +224,13 @@ main(int argc, char *argv[]) if (*argv) { interval = (u_int)strtonum(*argv, 0, 1000, errstr); if (errstr) - errx(1, %s: %s, *argv, errstr); + errx(1, interval %s: %s, *argv, errstr); - if (*++argv) - reps = atoi(*argv); + if (*++argv) { + reps = strtonum(*argv, 0, INT_MAX, errstr); + if (errstr) + errx(1, reps %s: %s, *argv, errstr); + } } #endif @@ -276,6 +281,8 @@ choosedrives(char **argv) ++ndrives; break; } + if (i == dk_ndrive) + errx(1, invalid interval or drive name: %s, *argv); } for (i = 0; i dk_ndrive ndrives 2; i++) { if (dk_select[i])
Re: elantech-v4 clickpad support
On 30/01/15(Fri) 01:25, Ulf Brosziewski wrote: Probably I was too sceptical about synaptics.c. The bug I observed with the ALPS touchpad seems to be due to a kind of mismatch between the ALPS code in pms and the event handling in wsconscomm. The patch below contains the initial change as well as what was necessary to fix this. Do you think it is possible to fix the pms(4) driver instead of adding another quirk? diff --git a/wsconscomm.c b/wsconscomm.c index df3512d..9c5afe7 100644 --- a/wsconscomm.c +++ b/wsconscomm.c @@ -132,12 +132,6 @@ WSConsReadHwState(InputInfoPtr pInfo, struct wscons_event event; Bool v; -/* Reset cumulative values if buttons were not previously pressed */ -if (!hw-left !hw-right !hw-middle) { -hw-cumulative_dx = hw-x; -hw-cumulative_dy = hw-y; -} - while (WSConsReadEvent(pInfo, event)) { switch (event.type) { case WSCONS_EVENT_MOUSE_UP: @@ -187,9 +181,11 @@ WSConsReadHwState(InputInfoPtr pInfo, break; case WSCONS_EVENT_MOUSE_ABSOLUTE_X: hw-x = event.value; +hw-cumulative_dx = hw-x; break; case WSCONS_EVENT_MOUSE_ABSOLUTE_Y: hw-y = priv-maxy - event.value + priv-miny; +hw-cumulative_dy = hw-y; break; case WSCONS_EVENT_MOUSE_ABSOLUTE_Z: hw-z = event.value; @@ -204,8 +200,14 @@ WSConsReadHwState(InputInfoPtr pInfo, /* XXX magic number mapping which is mirrored in pms driver */ switch (event.value) { case 0: -hw-fingerWidth = 5; -hw-numFingers = 2; +if (priv-model != MODEL_ALPS) { +hw-fingerWidth = 5; +hw-numFingers = 2; +} else { +/* For ALPS models pms reports that w is 0 if (z = 0)? */ +hw-fingerWidth = 0; +hw-numFingers = 0; +} break; case 1: hw-fingerWidth = 5;