1 /***************************************************************************
3 * hal-system-lcd-get-brightness-sunos.c : Get LCD brightness
5 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
6 * Use is subject to license terms.
8 * Licensed under the Academic Free License version 2.1
10 **************************************************************************/
12 #pragma ident "%Z%%M% %I% %E% SMI"
24 #include <sys/ioctl.h>
27 #include "../../hald/util.h"
28 #include <sys/acpi_drv.h>
31 main(int argc
, char *argv
[])
33 struct acpi_drv_output_status status
;
36 char device_file
[HAL_PATH_MAX
] = "/devices";
39 if ((udi
= getenv("UDI")) == NULL
) {
42 if ((devfs_path
= getenv("HAL_PROP_SOLARIS_DEVFS_PATH")) == NULL
) {
46 strlcat(device_file
, devfs_path
, HAL_PATH_MAX
);
47 fprintf(stderr
, "Getting brightness on %s (udi=%s)",
49 if ((fd
= open(device_file
, O_RDONLY
| O_NONBLOCK
)) < 0) {
50 fprintf(stderr
, "Cannot open %s: %s", device_file
,
55 bzero(&status
, sizeof (status
));
56 if (ioctl(fd
, ACPI_DRV_IOC_STATUS
, &status
) < 0) {
61 return (status
.cur_level_index
);