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 -0000      1.281
> +++ sys/dev/acpi/acpi.c       29 Jan 2015 22:53:42 -0000
> @@ -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 -0000      1.41
> +++ sys/dev/acpi/acpibtn.c    29 Jan 2015 22:53:42 -0000
> @@ -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 -0000      1.36
> +++ sys/dev/acpi/acpidev.h    29 Jan 2015 22:53:42 -0000
> @@ -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__ */
> 

Reply via email to