> Hello,
> 
> I'm using an Thumper and want to switch off drives if
> there're idle for an configured time. That's not a
> problem using the powerd of Solaris. But if I want to
> find out the status of a drive like "idle time" or
> "power status" there is no shell command available.
> The only thing I found was the man page of the
> powermanagment of Solaris which gives me the
> following infos:
> 
> bash-3.00# man pm
> 
> DESCRIPTION
> The Power Management ( pm) driver provides an
> interface for
> applications to configure devices within the system
> for
> Power Management. The interface is provided through
> ioctl(2)
> commands. The pm driver may be accessed using
> /dev/pm.
> 
> .
> .
> Using the commands below, an application may take
> control of
> the Power Management of a device from the Power
> Management
> framework driver and manage the transition of device
> power
> levels directly.
> 
> For this set of ioctl commands, arg (see ioctl(2))
> points to
> a structure of type pm_req defined in <sys/pm.h>:
> 
> typedef struct pm_req {
> char *physpath;     /* physical path of device
>  to configure */
> /* see
> libdevinfo(3LIB) */
> int  component;     /* the component of the
>  device */
> int  value;         /* power level, threshold
>  value, or count */
> void *data;         /* command-dependent
>  variable sized data */
>      size_t  datasize;   /* size of data buffer */
> req_t;
> 
> 
> PM_GET_TIME_IDLE
> 
> PM_GET_TIME_IDLE returns the number of seconds that
> com-
> ponent component of the device named by physpath has
> been idle. If the device is not idle, then 0 is
> returned.
> 
> 
> My problem is that I have got only small knowledge of
> C-programming and I need help to understand how to
> get access to the /dev/pm and request an information.


It would be nice to have utilities that would do two things:

* create output in the form of power.conf that described how
  power management was currently configured (as running, not simply the
  file contents)

* display selected or all devices (and applicable power management
  components) current power level, maximum power level, and idle time.

I gather one would need to use libdevinfo to traverse the device tree;
some of its functions can do that, and for a node can return the
physical device path that pm(7d) wants.  Unfortunately most of the
examples (like prtconf) are perhaps a bit more complicated than one
might like to start out using libdevinfo.  And my quick read of pm(7d)
doesn't tell me how to discover the  number N  of power-manageable components 
(numbered 0 through N-1) of a given device (there does
appear to be such an ioctl, but it isn't in the man page, although looking
at the source does find one example using it:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvd.c#1734
).  So it's not yet quite obvious to me how to write either of those.  Maybe
someone for whom that is obvious could chime in; or maybe I'll get bored
and/or curious enough to play around with it a bit, but I've got enough on
my plate for the moment that it probably will be at least a few weeks if
at all.
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to