> Date: Mon, 26 Jan 2015 22:30:02 +0000
> From: Stuart Henderson <[email protected]>
>
> On 2015/01/26 23:18, Mark Kettenis wrote:
> > > Date: Mon, 26 Jan 2015 21:17:33 +0000
> > > From: Stuart Henderson <[email protected]>
> > >
> > > This machine (server-ish hw used as a desktop) used to suspend and
> > > resume nicely, but following the lidsuspend change no longer resumes
> > > (machine powers up, screen stays black).
> > >
> > > It works correctly if machdep.lidsuspend is set to 0. I can run like
> > > that without a problem but it would be nicer to fix it, does anyone have
> > > ideas where to poke?
> > >
> > > Note: it has a LID0 device (unsure what it's connected to; there is a
> > > chassis intrusion switch but operating that doesn't change the state
> > > of acpibtn1.indicator0). It does not have a _LID method in the dsdt.
Can you try the diff below?
Index: acpibtn.c
===================================================================
RCS file: /home/cvs/src/sys/dev/acpi/acpibtn.c,v
retrieving revision 1.40
diff -u -p -r1.40 acpibtn.c
--- acpibtn.c 24 Nov 2014 03:54:06 -0000 1.40
+++ acpibtn.c 26 Jan 2015 23:09:53 -0000
@@ -55,7 +55,6 @@ struct acpibtn_softc {
#define ACPIBTN_SLEEP 3
};
-int acpibtn_getsta(struct acpibtn_softc *);
int acpibtn_setpsw(struct acpibtn_softc *, int);
struct acpi_lid {
@@ -157,10 +156,19 @@ acpibtn_attach(struct device *parent, st
struct acpi_attach_args *aa = aux;
struct acpi_lid *lid;
int64_t lid_open;
+ int64_t st;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_devnode = aa->aaa_node;
+ printf(": %s\n", sc->sc_devnode->name);
+
+ if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &st))
+ st = STA_PRESENT | STA_ENABLED | STA_DEV_OK;
+ if ((st & (STA_PRESENT | STA_ENABLED | STA_DEV_OK)) !=
+ (STA_PRESENT | STA_ENABLED | STA_DEV_OK))
+ return;
+
if (!strcmp(aa->aaa_dev, ACPI_DEV_LD)) {
sc->sc_btn_type = ACPIBTN_LID;
@@ -174,10 +182,6 @@ acpibtn_attach(struct device *parent, st
else if (!strcmp(aa->aaa_dev, ACPI_DEV_SBD))
sc->sc_btn_type = ACPIBTN_SLEEP;
- acpibtn_getsta(sc);
-
- printf(": %s\n", sc->sc_devnode->name);
-
if (sc->sc_btn_type == ACPIBTN_LID) {
strlcpy(sc->sc_sensdev.xname, DEVNAME(sc),
sizeof(sc->sc_sensdev.xname));
@@ -194,17 +198,6 @@ acpibtn_attach(struct device *parent, st
aml_register_notify(sc->sc_devnode, aa->aaa_dev, acpibtn_notify,
sc, ACPIDEV_NOPOLL);
-}
-
-int
-acpibtn_getsta(struct acpibtn_softc *sc)
-{
- if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, NULL) !=
0) {
- dnprintf(20, "%s: no _STA\n", DEVNAME(sc));
- /* XXX not all buttons have _STA so FALLTROUGH */
- }
-
- return (0);
}
int