1b164
![]() |
|
|
|
|
|||||||
| Mobile Computing This forum discusses issues related to running FreeBSD on notebooks, laptops, and other mobile equipment. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to change my laptop brightness (Toshiba l505). Fn keys don't work, but I don't mind. xbacklight doesn't work, and I can't seem to get sysctl to work. I've loaded acpi_video, but whenever I do:
Code:
sudo sysctl hw.acpi.video.<device>.active I've tried: Code:
sudo sysctl hw.acpi.toshiba.lcd_brightness=0 ![]() Any help is appreciated. Last edited by Draucia; April 23rd, 2012 at 20:37. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
|
#2
|
|||
|
|||
|
Just type sysctl hw.acpi to enumerate all recognized variables under hw.acpi
|
|
#3
|
||||
|
||||
|
I found that my laptop (not a Toshiba) does respond to the brightness Fn keys when in the BIOS. Try that.
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Administrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
| The Following User Says Thank You to DutchDaemon For This Useful Post: | ||
zeissoctopus (April 23rd, 2012) | ||
|
#4
|
|||
|
|||
|
Quote:
Code:
hw.acpi.supported_sleep_state: S3 S4 S5 hw.acpi.power_button_state: S5 hw.acpi.sleep_button_state: S3 hw.acpi.lid_switch_state: NONE hw.acpi.standby_state: NONE hw.acpi.suspend_state: S3 hw.acpi.sleep_delay: 1 hw.acpi.s4bios: 0 hw.acpi.verbose: 0 hw.acpi.disable_on_reboot: 0 hw.acpi.handle_reboot: 1 hw.acpi.reset_video: 0 hw.acpi.cpu.cx_lowest: C1 hw.acpi.acline: 1 hw.acpi.battery.life: 100 hw.acpi.battery.time: -1 hw.acpi.battery.state: 0 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.thermal.min_runtime: 0 hw.acpi.thermal.polling_rate: 10 hw.acpi.thermal.user_override: 0 hw.acpi.thermal.tz0.temperature: 47.0C hw.acpi.thermal.tz0.active: -1 hw.acpi.thermal.tz0.passive_cooling: 1 hw.acpi.thermal.tz0.thermal_flags: 0 hw.acpi.thermal.tz0._PSV: 104.0C hw.acpi.thermal.tz0._HOT: -1 hw.acpi.thermal.tz0._CRT: 104.0C hw.acpi.thermal.tz0._ACx: 70.0C -1 -1 -1 -1 -1 -1 -1 -1 -1 hw.acpi.thermal.tz0._TC1: 2 hw.acpi.thermal.tz0._TC2: 5 hw.acpi.thermal.tz0._TSP: 300 Code:
kldload acpi_toshiba Tried it, doesn't work. |
|
#5
|
|||
|
|||
|
I still haven't been able to solve this issue. Is it just not possible on my laptop because hw.acpi.video doesn't support it?
Last edited by DutchDaemon; April 22nd, 2012 at 17:11. |
|
#6
|
|||
|
|||
|
I have the same laptop with the same problem, the only work around I found was installing the package xbrightness, download that, then in X type "xbrightness 22000" - I find that number to be a good setting, of course you can adjust the number to whatever you want.
You can also then leave X and the brightness setting will remain until you next reboot. Last edited by DutchDaemon; April 23rd, 2012 at 23:57. |
| The Following User Says Thank You to JonathanBSD For This Useful Post: | ||
Draucia (April 23rd, 2012) | ||
|
#7
|
|||
|
|||
|
Quote:
|
|
#8
|
|||
|
|||
|
No problem. Also, since we have the same laptop, I wonder did you manage to get your RTL819 wireless card working with NDIS? I haven't managed to do it and I'm stuck with wired for now!
Last edited by DutchDaemon; April 23rd, 2012 at 23:57. |
|
#9
|
|||
|
|||
|
Quote:
I have the Intel Wifi Link 5100AGN. I didn't have to do anything special to get this it work. My whole laptop model is L505 - S6959. You might have a model that's slightly different.
|
|
#10
|
|||
|
|||
|
excuse me cuz i'm noob
im trying PCBSD for the first time, using 9.1RC1, have the same problem with brightness fn keys. I've followed this workarounds, and tried to install xbrightness, but don't know how. App cafe doesn't contain it, and /usr/ports/ doesn't exist in my 9.1RC1 installation, Would somebody be kind and give me some cable?. Thanx |
|
#11
|
|||
|
|||
|
Hi Rul,
1) First `su` to root su -2) and then add the binary package for xbrightness: pkg_add -r xbrightness3) After you've installed the package, run the command: xbrightness 9000 or something. ![]() Be careful what you install, though, as some ports/packages can interfere with the base system that PC-BSD uses. For more information about ports & packages, check out the FreeBSD handbook here: http://www.freebsd.org/doc/en_US.ISO...ook/ports.html. Also, take a look at the PC-BSD handbook (here: http://wiki.pcbsd.org/index.php/PC-BSD_Users_Handbook) &, if you haven't, drop by the PC-BSD forums. Cheers! |
|
#12
|
|||
|
|||
|
SOLVED! (not exactly), 9.1RC1 Toshiba brightness Fn keys don't work, but..
sudo portsnap fetch sudo portsnap extract cd /usr/ports/x11/xbrightness sudo make install clean sudo xbrightness 33000 1.3 http://disjunkt.com/xbrightness/ Now i'm comfortable for rebuilding the whole code of this pretty OS, XDD |
|
#13
|
|||
|
|||
|
I was able to produce the following working solution :
Quote:
1)First, configure the system to bring all the necessary modules needed to have the sysctl sub-system logically "maps" the available hardware as correctly as possible. In my case, I'm using a Lenovo ThinkPad R61i. The modules to access apci video variables are acpi_ibm and acpi_video. Check the available documentation to see which ones would be relevant for your particular hardware (generic acpi_<oem>) These modules need to be available and loaded. They could either be included in the built-in kernel, or be brought in at boot time thru via loader by adding the following lines in /boot/loader.conf : Code:
# ACPI for IBM ThinkPad acpi_ibm_load="YES" acpi_video_load="YES" For my R61i, the brightness-up (resp. brightnes-down) button is Fn-16 (resp. Fn-17) that are propagated to the devd sub-system as ACPI event :Notify=0x10 (resp. Notify=0x11). Devd configuration I use to respond to these events and trigger the user-space code /usr/local/bin/acpi_ibm_exec.sh NOTIFY_EVENT OEM_NAME, where OEM name is "ibm" in my case (depends one the acpi_<oem> module loaded : /etc/devd.conf Code:
# ACPI Brightness up/down trap for IBM Thinkpad
notify 5 {
match "system" "ACPI";
action "/usr/local/bin/acpi_generic_exec.sh $notify ibm";
};
3) Third, provide the user-space software. /usr/local/bin/acpi_ibm_exec.sh is a (Bash) shell script which I put in /usr/local/bin for convenience. This shell script in turn calls the binary /usr/local/bin/xgradbrightness(1). This "compilation" was inspired by acpi_ibm(4) and xbrightness(1) : /usr/local/bin/acpi_ibm_exec.sh Code:
#!/usr/local/bin/bash
#
# acpi_ibm_exec.sh
# Usage: $0 event oem_name
#
# Copyright (C) 2012 Franck Porcher,Ph.D. <franck.porcher@franckys.com>
export PATH="/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
if [ -z "$1" -o -z "$2" ]
then
echo "usage: $0 acpi_event oem_name"
exit 1
fi
NOTIFY=$(echo $1)
case ${NOTIFY} in
0x10) #(Fn-10) BRIGHTNESS UP
possible_levels_asc=( $( sysctl -n hw.acpi.video.lcd0.levels \
| while read -d ' ' x; do echo "$x"; done \
| sort -nu
))
actual_level=$(sysctl -n hw.acpi.video.lcd0.brightness)
i=0
max_i=${#possible_levels_asc[@]}
while (( i < max_i ))
do
if (( actual_level == ${possible_levels_asc[i]} ))
then
if (( i == (max_i - 1) ))
then
xgradbrightness max
else
actual_level=${possible_levels_asc[i + 1]}
if xgradbrightness $((65535 * actual_level / 100))
then
sysctl hw.acpi.video.lcd0.brightness=$actual_level
fi
fi
break
else
(( i++ ))
fi
done
;;
0x11) #(Fn-11) BRIGHTNESS DOWN
possible_levels_desc=( $( sysctl -n hw.acpi.video.lcd0.levels \
| while read -d ' ' x; do echo "$x"; done \
| sort -rnu
))
actual_level=$(sysctl -n hw.acpi.video.lcd0.brightness)
i=0
max_i=${#possible_levels_desc[@]}
while (( i < max_i ))
do
if (( actual_level == ${possible_levels_desc[i]} ))
then
if (( i == (max_i - 1) ))
then
xgradbrightness min
else
actual_level=${possible_levels_desc[i + 1]}
if xgradbrightness $((65535 * actual_level / 100))
then
sysctl hw.acpi.video.lcd0.brightness=$actual_level
fi
fi
break
else
(( i++ ))
fi
done
;;
*)
;;
esac
Code:
/*
* LICENCE TYPE : BSD
*
* Copyright 2012 Franck Porcher, Ph.D <franck.porcher@franckys.com>
* Inspired by x11/xbrightness (see x11/xbrightness/work/AUTHORS)
*/
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/xf86vmode.h>
#include <math.h>
#define BRIGHTNESS_MAX 65535
#define BRIGHTNESS_MIN 0
#define BRIGHTNESS_DEFAULT 65535
#define STEPS_DEFAULT 5000
#define DISPLAY_DEFAULT ":0"
/*
* Usage
*/
static void usage(char *arg) {
fprintf (stderr, "%s builds a brightness ramp for X11.\n\n", arg);
fprintf (stderr, "Usage: %s [-h] [BRIGHTNESS] [STEP] [DISPLAY] \n", arg);
fprintf (stderr, "Where :\n");
fprintf (stderr, " - BRIGHTNESS is the requested brightness. It can be a number from 0 to 65535, the word 'max' or the word 'min' (de
faults to max)\n");
fprintf (stderr, " - STEPS is the number of steps (>= 1) to step-by-step progressively adjust the screen to the requested bright
ness (defaults to 5000)\n");
fprintf (stderr, " - DISPLAY is the name of the X11 display to use (defaults to :0)\n\n");
fprintf (stderr, "Copyright(C) Franck Porcher, Ph.D <franck.porcher@franckys.com>.\n");
exit(0);
}
/*
* Main
*/
int main(int argc, char *argv[]) {
Display *dpy;
int i,j;
int screen, ramp_size;
unsigned short *ramp;
double level, delta_level;
double brightness, delta_step;
/**** Defaults ****/
unsigned short brightness_requested = BRIGHTNESS_MAX;
unsigned short steps = STEPS_DEFAULT;
char *display = DISPLAY_DEFAULT;
/**** Parameters ****/
if (argc >= 2) {
if (! strcmp(argv[1], "-h")) {
usage(argv[0]);
}
if (! strcmp(argv[1], "max")) {
brightness_requested = BRIGHTNESS_MAX;
}
else if (! strcmp(argv[1], "min")) {
brightness_requested = BRIGHTNESS_MIN;
}
else {
brightness_requested = atoi(argv[1]);
}
}
if (argc >= 3) {
steps = atoi(argv[2]);
}
if (argc >= 4) {
display = argv[3];
}
/**** Setup ****/
if ( (dpy = XOpenDisplay(display)) == NULL) {
fprintf (stderr, "%s: unable to open default display '%s'.\n", argv[0], display);
exit(1);
}
screen = DefaultScreen(dpy);
/**** main portion ****/
if ( XF86VidModeGetGammaRampSize(dpy, screen, &ramp_size )
&& (ramp = (unsigned short *) malloc(ramp_size * sizeof(unsigned short)))
&& XF86VidModeGetGammaRamp(dpy, screen, ramp_size, ramp, ramp, ramp)
) {
/* "steps" steps by step progressive monitor's screen brightness adjustment.
* from "actual brightness", given by ramp[ramp_size-1],
* to "requested brightness", given by 1st argument
*/
brightness = (double)ramp[ramp_size-1];
delta_step = ((double)brightness_requested - brightness)/steps;
for (j=0; j<steps; j++) {
brightness += delta_step; /* progressive goal */
delta_level = brightness/(ramp_size-1);
level = 0.0;
/* ramp[0] is always 0 whatever brightness,
* so we start modifying ramp at index 1,
* saving tiny fractions of precious time
*/
for (i=1; i<ramp_size; i++) {
level += delta_level;
ramp[i] = (unsigned short)level;
}
XF86VidModeSetGammaRamp(dpy, screen, ramp_size, ramp, ramp, ramp);
}
}
XCloseDisplay(dpy);
exit(0);
}
Code:
DEPLIBS = $(DEPXXF86VMLIB) XawClientDepLibs
SYS_LIBRARIES = MathLibrary
LOCAL_LIBRARIES = $(XXF86VMLIB) XawClientLibs
SRCS = xgradbrightness.c
OBJS = xgradbrightness.o
ComplexProgramTarget(xgradbrightness)
Code:
xmkmf && make && make install This could become a tiny package on its own. FP. |
|
#14
|
|||
|
|||
|
Forgot to mention that the script being called by sys daemons, you'll have to give them the right to access your X display, that is (though you will remember that when you push your brighten-up/down buttons and see nothing happening...�e ):
Code:
# Log into your CLI, then [~user]$ xhost + Cheers --FP. |
![]() |
| Tags |
| acpi brightness |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] /etc/rc.d/sysctl: WARNING: sysctl current does not exist. | ccc | General | 7 | March 8th, 2012 06:10 |
| desktop brightness not working on laptop | fluca1978 | Mobile Computing | 16 | February 15th, 2012 15:34 |
| brightness control | TCE | Mobile Computing | 10 | May 10th, 2010 03:34 |
| Fn Brightness keys don'twork, Script+Bindkeys | ikbendeman | Userland Programming & Scripting | 6 | March 14th, 2010 22:38 |
| How to adjust BRIGHTNESS SCREEN ? | setti | Mobile Computing | 4 | August 11th, 2009 17:38 |