1 /***************************************************************************
3 * hal-system-lcd-set-brightness-sunos.c : Set 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 <sys/acpi_drv.h>
28 #include "../../hald/util.h"
31 main(int argc
, char *argv
[])
37 char device_file
[HAL_PATH_MAX
] = "/devices";
40 if ((udi
= getenv("UDI")) == NULL
) {
43 if ((devfs_path
= getenv("HAL_PROP_SOLARIS_DEVFS_PATH")) == NULL
) {
46 strlcat(device_file
, devfs_path
, HAL_PATH_MAX
);
47 fprintf(stderr
, "Setting brightness on %s (udi=%s)",
50 if ((fd
= open(device_file
, O_RDONLY
| O_NONBLOCK
)) < 0) {
51 fprintf(stderr
, "Cannot open %s: %s", device_file
,
55 if (fgets(arg
, sizeof (arg
), stdin
)) {
58 if (ioctl(fd
, ACPI_DRV_IOC_SET_BRIGHTNESS
, &level
) < 0) {