Klemens Nanni([email protected]) on 2021.03.25 19:45:04 +0100:
> On Sat, Mar 20, 2021 at 07:46:38PM +0100, Klemens Nanni wrote:
> > Otherwise there is no way other than reading driver code to determine
> > why running zzz(8) for example does not do anything on certain machines.
> > 
> > apm(4/arm64) for one currently does not implement suspend and resume,
> > i.e. it yields ENOSUPP which gets lost in userland.
> > 
> > This still does not make `zzz' or `apm -z' report the informative
> > warning, but syslog now has it:
> > 
> >     $ zzz
> >     Suspending system...
> >     $ tail -n3 /var/log/messages
> >     Mar 20 19:16:57 pine64 apmd: system suspending
> >     Mar 20 19:16:57 pine64 apmd: battery status: unknown. external power 
> > status: not known. estimated battery life 0%
> >     Mar 20 19:16:58 pine64 apmd: suspend: Operation not supported
> > 
> > 
> > Feedback? OK?
> Anyone?
> 
> This is a trivial but helpful change, just like the ones in
> these other mails on tech@:
>       "apm/macppc: Mark unsupported ioctl as such, merge cases"
>       "apm/arm64: fix errno, merge ioctl cases"

reads ok and yeah, it might be useful to know if this doesnt work.

ok benno@

> 
> 
> Index: apmd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v
> retrieving revision 1.101
> diff -u -p -r1.101 apmd.c
> --- apmd.c    16 Mar 2021 09:00:43 -0000      1.101
> +++ apmd.c    20 Mar 2021 18:47:13 -0000
> @@ -329,7 +329,8 @@ suspend(int ctl_fd)
>       do_etc_file(_PATH_APM_ETC_SUSPEND);
>       sync();
>       sleep(1);
> -     ioctl(ctl_fd, APM_IOC_SUSPEND, 0);
> +     if (ioctl(ctl_fd, APM_IOC_SUSPEND, 0) == -1)
> +             logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
>  }
>  
>  void
> @@ -340,7 +341,8 @@ stand_by(int ctl_fd)
>       do_etc_file(_PATH_APM_ETC_STANDBY);
>       sync();
>       sleep(1);
> -     ioctl(ctl_fd, APM_IOC_STANDBY, 0);
> +     if (ioctl(ctl_fd, APM_IOC_STANDBY, 0) == -1)
> +             logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
>  }
>  
>  void
> @@ -351,7 +353,8 @@ hibernate(int ctl_fd)
>       do_etc_file(_PATH_APM_ETC_HIBERNATE);
>       sync();
>       sleep(1);
> -     ioctl(ctl_fd, APM_IOC_HIBERNATE, 0);
> +     if (ioctl(ctl_fd, APM_IOC_HIBERNATE, 0) == -1)
> +             logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
>  }
>  
>  void
> 

Reply via email to