Posts Tagged ‘mac book pro’

Keyboard backlight brightness on Mac Book Pro 6,2 – Linux 3.10

julio 28, 2013

In the past I didn’t manage to make Keyboard backlight to work. It wasn’t turned on at all. When I updated to two or three months ago Debian Unstable the Keyboard backlight began to work at 100%. It was annoying but I didn’t want to waste my time in that.

Now I have invested some time on controlling that brightness. The article is mainly based on Ubuntu explanation on how to use Keyboard backlight without using pommed. Their zenity based script that let you choose the prefered brightness didn’t convince me.

So based on former screen brightness control script here there is a new one.

Its filename is:

/usr/local/bin/custom-keyboardlight-macbookpro

and its content is:

#!/bin/bash

# Adapted from http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/script-to-set-up-brightness-of-backlight-in-xfce-903704/
# Script for changing backlight brightness in /sys/class/backlight/acpi_video0/brightness
# can take values 0-15, in real (my notebook) works only values 2-15

#IMPORTANT: you must have writing rights to /sys/.../brightness (I must solute it with visudo or something like that...)
#IMPORTANT: for proper work after reboot must exist directory .bright in your home directory and file last_bright in .bright directory 

#reads content of brightness and save it into variable

BRIGHTNESS_FILE="/sys/class/leds/smc::kbd_backlight/brightness"
BRIGHT_CONF_DIR="$HOME/.keyboardbright"
LAST_BRIGHT_FILE="${BRIGHT_CONF_DIR}/last_bright"
BRIGHT=$(cat ${BRIGHTNESS_FILE})

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    #BRIGHT++
    BRIGHT=$(($BRIGHT+17))
    #protect mechanism (BRIGHT must be lower or equal to 15)
     if (($BRIGHT>255))
     then
        BRIGHT=$((255))
     fi
    ;;
   "m")
    #decrease brightness
    #BRIGHT--
    BRIGHT=$(($BRIGHT-17))
    #protect mechanism (BRIGHT must be bigger or equal to 2)
     if (($BRIGHT<0))
      then         BRIGHT=$((0))
      fi         ;; 
     "l")     echo "Loading last value of brightness."     #Load last value, saved in file last_bright     
     BRIGHT=$(cat ${LAST_BRIGHT_FILE})     
     echo "Last value of brightness was: $BRIGHT"     ;;    
     "h")      echo "Help: "      
               echo "-p    Increase brightness"      
               echo "-m    Decrease brightness"      
               echo "-l    Load last brightness value"      
               echo "-c N Set to custom value"      
               echo "-h    This help"      
               echo "Programmed by: ElectricZero"      
               echo "Improved by: adrian15"      
               exit 0;      ;;     
       "c")      BRIGHT=$2      
         if (($BRIGHT>255))
         then
           BRIGHT=$((255))
         fi

     if (($BRIGHT<0))      
     then         
       BRIGHT=$((0))      
     fi      ;;     
     "?")      echo "Unknown argument, try bright -h for help"      
               exit 1;      ;;     
     *)     # Should not occur     
      echo "Unknown error while processing options"     
      exit 2;     ;;   
      esac 
      done 
      echo "Brightness set on $BRIGHT" 
     #Save variable BRIGHT into file brightness 
     echo $BRIGHT > ${BRIGHTNESS_FILE}
     #Save variable BRIGHT into file last_bright
    if [ ! -d ${BRIGHT_CONF_DIR} ] ; then mkdir ${BRIGHT_CONF_DIR} ; fi
    echo $BRIGHT > ${LAST_BRIGHT_FILE}

as you might see there are some changes. Now I don’t mind having a 0 value because I actually want the keyboard not to bright at all. That’s different from an screen when you don’t want to miss it as a turned off one or non working one.

I have modified the script as always so that with only 15 types I can go from turned off to turned on at maximum brightness.

Then we need sudo so that we can run it as normal user.

So we edit sudo with the command:

sudoedit /etc/sudoers

so that we add:

normaluser ALL= NOPASSWD:/usr/local/bin/custom-keyboardlight-macbookpro

to it.

Now in my case as I use KDE I needed to setup its shortcuts to use it.

  • Preferences
  • Shortcuts and gestures
  • Custom Shortcuts

 

Then:

  • Right click and select New group which we will name: Keyboard brightness

Now we are going to setup the Increase Keyboard brightness shortcut.

  • Right click on Keyboard brightness
  • New
  • Global shortcut
  • Order / Url

so that we inform:

  • Name of the shorcut: Increase Keyboard brightness
  • Launcher tab: Short cut. I click on None and then I type “Increase keyboard brightness” button.
  • Action tab. Order / Url: sudo /usr/local/bin/custom-keyboardlight-macbookpro -p

Now we are going to setup the Decrease Keyboard brightness shortcut.

  • Right click on Keyboard brightness
  • New
  • Global shortcut
  • Order / Url

so that we inform:

  • Name of the shorcut: Decrease Keyboard brightness
  • Launcher tab: Short cut. I click on None and then I type “Decrease keyboard brightness” button.
  • Action tab. Order / Url: sudo /usr/local/bin/custom-keyboardlight-macbookpro -m

 

Now we just nee to make sure they are activated so that both of these shortcuts have ticks on them.

 

And that’s it you can control Keyboard brightness from your keyboard.

I think that I might even run: /usr/local/bin/custom-keyboardlight-macbookpro -p at kde start so that old keyboard value persists. Why? Because the default value is the backlight being on 100% while I prefer it to be turned off.

Control screen brightness when booting in EFI Mode with Linux 3.10 in MBP 6,2

julio 28, 2013

Making Screen brightness to work in Linux 3.10

As you might know I’m trying to make work my Mac Book Pro 6,2 with Linux 3.10. One thing that didn’t work was screen brightness. I had already dealt with this settings when booting using Nvidia only and when booting with Intel in the Linux 3.2 days.

However the:

/sys/class/backlight/acpi_video0/

path was not changing the brightness. Something wrong was going here.

Well, finally, it seems that the Linux 3.10 handles pretty well the apple backlight even discerning if it has to deal with the Nvidia Graphics card or with the Intel Graphics card. I was put on the trail thanks to this apple_bl.c source code. At the end the module alias is:

mbp_nvidia_bl

So I decided to modprobe it but an error happened. This was the same error I had seen in dmesg around apple_bl line.

apple_bl: `1' invalid for parameter `use_gmux'

So what I needed to do was to remove that use_gmux parametre. You can find it explained in one of my former articles: Usar tarjeta intel integrada en Debian Unstable para MacBook Pro 6,2 .

I just edited the file:

/etc/modprobe.d/apple_bl.conf

and commented the line just in case I wanted to enable back screen brightness control when booting from 3.2 kernel. The optimal thing would be to add this extra parameter or not depending on Linux Kernel version but I think it’s not worth it.

Not after rebooting I was able to make the screen brightness to work.

Changing brightness manually

You only need to echo some value to:

/sys/class/backlight/gmux_backlight/brightness

which it’s a new path different from the two scripts that I have. Its maximum value is: 110400 which it’s also different from former values.

Script for changing gmux backlight brightness

We will just reuse some code from older scripts and adapt it the new max brightness. The filename is going to be:

/usr/local/bin/custom-backlight-macbookpro_gmux

and its contents will be:

#!/bin/bash

# Adapted from http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/script-to-set-up-brightness-of-backlight-in-xfce-903704/
# Script for changing backlight brightness in /sys/class/backlight/acpi_video0/brightness
# can take values 0-15, in real (my notebook) works only values 2-15

#IMPORTANT: you must have writing rights to /sys/.../brightness (I must solute it with visudo or something like that...)
#IMPORTANT: for proper work after reboot must exist directory .bright in your home directory and file last_bright in .bright directory 

#reads content of brightness and save it into variable

BRIGHTNESS_FILE="/sys/class/backlight/gmux_backlight/brightness"
BRIGHT_CONF_DIR="$HOME/.brightgmux"
LAST_BRIGHT_FILE="${BRIGHT_CONF_DIR}/last_bright"
BRIGHT=$(cat ${BRIGHTNESS_FILE})

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    #BRIGHT++
    BRIGHT=$(($BRIGHT+7360))
    #protect mechanism (BRIGHT must be lower or equal to 15)
     if (($BRIGHT>110400))
     then
        BRIGHT=$((110400))
     fi
    ;;
   "m")
    #decrease brightness
    #BRIGHT--
    BRIGHT=$(($BRIGHT-7360))
    #protect mechanism (BRIGHT must be bigger or equal to 2)
     if (($BRIGHT<14720))
     then
        BRIGHT=$((14720))
     fi    
    ;;
   "l")
    echo "Loading last value of brightness."
    #Load last value, saved in file last_bright
    BRIGHT=$(cat ${LAST_BRIGHT_FILE})
    echo "Last value of brightness was: $BRIGHT"
    ;;
   "h")
     echo "Help: "
     echo "-p    Increase brightness"
     echo "-m    Decrease brightness"
     echo "-l    Load last brightness value"
     echo "-c N Set to custom value"
     echo "-h    This help"
     echo "Programmed by: ElectricZero"
     echo "Improved by: adrian15"
     exit 0;
     ;;
    "c")
     BRIGHT=$2
     if (($BRIGHT>110400))
     then
        BRIGHT=$((110400))
     fi

     if (($BRIGHT<14720))
     then
        BRIGHT=$((14720))
     fi
     ;;
    "?")
     echo "Unknown argument, try bright -h for help"
     exit 1;
     ;;
    *)
    # Should not occur
    echo "Unknown error while processing options"
    exit 2;
    ;;
  esac
done
echo "Brightness set on $BRIGHT"
#Save variable BRIGHT into file brightness
echo $BRIGHT > ${BRIGHTNESS_FILE}
#Save variable BRIGHT into file last_bright
if [ ! -d ${BRIGHT_CONF_DIR} ] ; then mkdir ${BRIGHT_CONF_DIR} ; fi
echo $BRIGHT > ${LAST_BRIGHT_FILE}

As I already did I also had to modify my main screen brightness script to use the three of the scripts I now have for screen brightness control.

Screen brightness control wrapper script

 

So the file:

custom-backlight-macbookpro_both

now has:

#!/bin/bash

NVIDIA_BL_BINARY="/usr/local/bin/custom-backlight-macbookpro_nvidia"
INTEL_BL_BINARY="/usr/local/bin/custom-backlight-macbookpro_intel"
GMUX_BL_BINARY="/usr/local/bin/custom-backlight-macbookpro_gmux"

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    ${NVIDIA_BL_BINARY} -p
    ${INTEL_BL_BINARY} -p
    ${GMUX_BL_BINARY} -p
    ;;
   "m")
    #decrease brightness
    ${NVIDIA_BL_BINARY} -m
    ${INTEL_BL_BINARY} -m
    ${GMUX_BL_BINARY} -m
    ;;
   "l")
    echo "Loading last value of brightness."
    ${NVIDIA_BL_BINARY} -l
    ${INTEL_BL_BINARY} -l
    ${GMUX_BL_BINARY} -l
    ;;
   "h")
     echo "Help: "
     echo "-p    Increase brightness"
     echo "-m    Decrease brightness"
     echo "-l    Load last brightness value"
     echo "-c N Set to custom value"
     echo "-h    This help"
     echo "Programmed by: ElectricZero"
     echo "Improved by: adrian15"
     exit 0;
     ;;
    "c")
     BRIGHT=$2
     if (($BRIGHT>15))
     then
        BRIGHT=$((15))
     fi

     if (($BRIGHT<2))
     then
        BRIGHT=$((2))
     fi
    let INTELBRIGHT=${BRIGHT}*8800
    let GMUXBRIGHT=${BRIGHT}*7360
    ${NVIDIA_BL_BINARY} -c ${BRIGHT} 
    ${INTEL_BL_BINARY} -c ${INTELBRIGHT}
    ${GMUX_BL_BINARY} -c ${GMUXBRIGHT}
     ;;
    "?")
     echo "Unknown argument, try bright -h for help"
     exit 1;
     ;;
    *)
    # Should not occur
    echo "Unknown error while processing options"
    exit 2;
    ;;
  esac
done

So that’s it. Now screen brightness control should work as before. My former kde key bindings should now work as before.

BCM5974 trackpad with Linux Kernel 3.10

julio 27, 2013

As you might know I was using a patched Linux Kernel 3.2 so that my integrated Intel card was used as default. So, here’s the strange thing, although I’m not setting up BCM5974 through xorg.conf (because there’s no xorg.conf file) it seems that booting into the system by Linux Kernel 3.2 or Linux Kernel 3.10 has different behaviour.

When using Linux Kernel 3.10 if I want to right-click I need to tap with two fingers but these two fingers need to be very close one from another. The same thing happens when you want to paste some text, that is middle click. You need to tap with three fingers and these three fingers need to be very close.

Integrated Intel card in Mac Book Pro 6,2 in Linux Kernel 3.10

julio 27, 2013

As I already explained I finally managed to make work my Integrated intel card in my Debian when using kernel 3.2. I needed to patch the kernel and use some boot parametres to make it work.

But, as expected, Linux Kernel 3.10 without any special patch was not working. But it had to. Why? Because I had asked Seth Forsee about this.

It was not until today that I found the answer in an gentoo forum post: Intel graphics not working on Macbook Pro in EFI mode .

In my old setup I had the kernel parametres:

pcie_aspm=force video=efifb i915.lvds_channel=2
i915.modeset=1 i915.lvds_use_ssc=0
drm.debug=0x14 log_buf_len=16M

among other options which I haven’t modified. I had to modify i915.lvds_channel to be i915.lvds_channel_mode which seems it’s the final name for that option.

So now the default kernel parametres are:

pcie_aspm=force video=efifb i915.lvds_channel_mode=2
i915.modeset=1 i915.lvds_use_ssc=0
drm.debug=0x14 log_buf_len=16M

.

Apart from having to tap with three-finger to get the right-click instead of only two-finger tap everything seems to be ok.

Debian Unstable with Kernel 3.8 – MBP 6,2

marzo 28, 2013

Introduction

I’m going to describe how to install Kernel 3.8 from Debian experimental repositories into a Debian Unstable from March 2013 (which it’s current kernel version is 3.2).

What I want to test is if I can use my MacBookPro 6,2 integrated Intel Graphics card without having to apply any patch to the kernel as I had already done.

System update

First of all what I have done is updated my system with:

apt-get update
apt-get dist-upgrade

Pinning setup

So, once updated the system we need to setup pinning. As explained in Debian Wiki – How To Upgrade kernel we add some lines to preferences file so that experimental packages aren’t used as default.

cat >> /etc/apt/preferences << EOF
Package: *
Pin: release o=Debian,a=experimental
Pin-Priority: 102
EOF

Now we are going to add the experimental repository to sources list with just:

echo "deb http://ftp.de.debian.org/debian experimental main" >> /etc/apt/sources.list

and we apply changes with:

apt-get update

Kernel installation

In my case I want to install the latest amd64 kernel so I need to issue:

apt-get -t experimental install linux-image-3.8-trunk-amd64

You can check latest versions at  packages debian experimental linux-image .

Once rebooted (and connected via cable) I’m going to install linux-headers so that I can install wl module so that wireless works too:

sudo apt-get install -t experimental linux-headers-3.8
m-a prepare

After some tests I realised that I needed to uninstall virtualbox before doing m-a prepare with:

apt-get remove virtualbox

.

Then I realised that I needed a fixed version of module-assistant which can be downloaded from this bug: 697360 because kernel version was not being detected ok.

Wireless install

m-a a-i broadcom-sta

But, even then, the build failed.

for templ in ; do \
    cp $templ `echo $templ \
| sed -e 's/_KVERS_/3.8-trunk-amd64/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup \
|| cp ${templ%.modules.in} \
${templ%.modules.in}.backup 2>/dev/null \
|| true; \
    sed -e 's/##KVERS##/3.8-trunk-amd64/g \
;s/#KVERS#/3.8-trunk-amd64/g \
; s/_KVERS_/3.8-trunk-amd64/g \
; s/##KDREV##/3.8.3-1~experimental.1/g \
; s/#KDREV#/3.8.3-1~experimental.1/g \
; s/_KDREV_/3.8.3-1~experimental.1/g  \
'  ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean KBUILD=/lib/modules/3.8-trunk-amd64/build KVERS=3.8-trunk-amd64
make[1]: se ingresa al directorio `/usr/src/modules/broadcom-sta'
KBUILD_NOPEDANTIC=1 make -C /lib/modules/3.8-trunk-amd64/build M=/usr/src/modules/broadcom-sta clean
make[2]: se ingresa al directorio `/usr/src/linux-headers-3.8-trunk-amd64'
CFG80211 API is prefered for this kernel version
  CLEAN   /usr/src/modules/broadcom-sta/.tmp_versions
make[2]: se sale del directorio `/usr/src/linux-headers-3.8-trunk-amd64'
make[1]: se sale del directorio `/usr/src/modules/broadcom-sta'
 debian/rules \
KVERS=3.8-trunk-amd64 \
KSRC=/lib/modules/3.8-trunk-amd64/build \
KDREV=3.8.3-1~experimental.1 kdist_image
/usr/bin/make  -f debian/rules kdist_clean kdist_config binary-modules
make[1]: se ingresa al directorio `/usr/src/modules/broadcom-sta'
for templ in ; do \
    cp $templ `echo $templ \
| sed -e 's/_KVERS_/3.8-trunk-amd64/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup \
|| cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/3.8-trunk-amd64/g ;\
s/#KVERS#/3.8-trunk-amd64/g ;\
 s/_KVERS_/3.8-trunk-amd64/g ;\
 s/##KDREV##/3.8.3-1~experimental.1/g ;\
 s/#KDREV#/3.8.3-1~experimental.1/g ;\
 s/_KDREV_/3.8.3-1~experimental.1/g  \
'  ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean KBUILD=/lib/modules/3.8-trunk-amd64/build KVERS=3.8-trunk-amd64
make[2]: se ingresa al directorio `/usr/src/modules/broadcom-sta'
KBUILD_NOPEDANTIC=1 make -C /lib/modules/3.8-trunk-amd64/build M=/usr/src/modules/broadcom-sta clean
make[3]: se ingresa al directorio `/usr/src/linux-headers-3.8-trunk-amd64'
CFG80211 API is prefered for this kernel version
/usr/src/modules/broadcom-sta/Makefile:80: Neither CFG80211 nor Wireless Extension is enabled in kernel
make[3]: se sale del directorio `/usr/src/linux-headers-3.8-trunk-amd64'
make[2]: se sale del directorio `/usr/src/modules/broadcom-sta'
make[1]: No se hace nada para `kdist_config'.
dh_testdir
dh_testroot
dh_prep
# Build and install the module
make -C /lib/modules/3.8-trunk-amd64/build M=/usr/src/modules/broadcom-sta
make[2]: se ingresa al directorio `/usr/src/linux-headers-3.8-trunk-amd64'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
Kernel architecture is X86_64
  LD      /usr/src/modules/broadcom-sta/built-in.o
  CC [M]  /usr/src/modules/broadcom-sta/src/shared/linux_osl.o
  CC [M]  /usr/src/modules/broadcom-sta/src/wl/sys/wl_linux.o
  CC [M]  /usr/src/modules/broadcom-sta/src/wl/sys/wl_iw.o
  CC [M]  /usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.o
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c: In function ‘wl_cfg80211_join_ibss’:
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
757:26: error: ‘struct cfg80211_ibss_params’ has no member named ‘channel’
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
 At top level:
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
1664:2: warning: initialization from incompatible pointer type [enabled by default]
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
1664:2: warning: (near initialization for ‘wl_cfg80211_ops.set_tx_power’) [enabled by default]
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
1665:2: warning: initialization from incompatible pointer type [enabled by default]
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
1665:2: warning: (near initialization for ‘wl_cfg80211_ops.get_tx_power’) [enabled by default]
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
 In function ‘wl_update_bss_info’:
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
2092:11: error: ‘struct cfg80211_bss’ has no member named ‘information_elements’
/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.c:\
2093:15: error: ‘struct cfg80211_bss’ has no member named ‘len_information_elements’
make[5]: *** [/usr/src/modules/broadcom-sta/src/wl/sys/wl_cfg80211.o] Error 1
make[4]: *** [_module_/usr/src/modules/broadcom-sta] Error 2
make[3]: *** [sub-make] Error 2
make[2]: *** [all] Error 2
make[2]: se sale del directorio `/usr/src/linux-headers-3.8-trunk-amd64'
make[1]: *** [binary-modules] Error 2
make[1]: se sale del directorio `/usr/src/modules/broadcom-sta'
make: *** [kdist_build] Error 2

Even trying to force broadcom-sta-source from experimental branch did not work because I had already the last package version.

In the official broadcom sta site: http://www.broadcom.com/support/802.11/linux_sta.php the last version is from 2011 :(. There’s an email for making questions.

I’ll probably ask there if they plan to release versions adapted to 3.8 or not.

So I’m going to revert to my former 3.2.21 custom kernel for the moment.

About Intel i915

As far as I’ve tried the Intel thing did not work

If I remove the four outb lines from the grub boot online editing and I boot then nouveau driver was used instead of intel. In the logs I notice:

'2' invalid for lvds_channel

If the four outb lines remain then I get a blank screen of no use.

A vueltas con el brillo de la pantalla del mac book pro

julio 8, 2012

Yo ya conseguí poder modular el brillo de la pantalla del mac book pro usando las teclas tal y como expliqué en: Modular brillo pantalla en Mac Book Pro. Pero si recordáis bien esto es cuando se está usando la tarjeta nvidia. Y conseguí, por defecto, usar la tarjeta intel como expliqué en: Usar tarjeta intel integrada en Debian Unstable para MacBook Pro 6,2 .

Con esta última configuración el slider del monitor de batería ya me dejaba cambiar el brillo. Pero la modulación via teclas no me funcionaba. ¿Por qué? Pues porque yo ya la había programado manualmente para usar el script de nvidia.

Hasta ahora no había tocado este tema porque no me había hecho falta. El otro día me dí cuenta de que la opción de bloquear la pantalla no me funcionaba. Simplemente le das a bloquear pantalla y la pantalla sigue bloqueada. No podía ser esto.

 

Así es que para solventar este problema he instaldo el paquete xlock. Me he hecho un lanzador que lo ejecute y voila ya tienes la pantalla protegida cuando quieras.

 

No obstante esto tiene un inconveniente, al cabo de, digamos unos 20 minutos, el brillo de la pantalla baja a mínimos. Tan a mínimos que parece que está apagada. Y entonces es cuándo no me van las teclas por lo que he comentado más arriba. Si estoy conectado a otro monitor puedo desbloquear con la contraseña y ver el escritorio arriba dónde en un mi kde añado un widget de batería y ahí puedo modular el brillo.

 

Pero no quiero ir andando haciendo esto. Así que quiero hacerlo con las teclas, pero, claro, que me pueda servir también arranque en el modo nvidia, o consiga poder hacer switch en el momento.

Para ello por un lado el script para nvidia que ya tenía se renombra a:

custom-backlight-macbookpro_nvidia

. Y por otro lado creo un script muy parecido pero para Intel que copio y pego a continuación:

#!/bin/bash

# Adapted from http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/script-to-set-up-brightness-of-backlight-in-xfce-903704/
# Script for changing backlight brightness in /sys/class/backlight/acpi_video0/brightness
# can take values 0-15, in real (my notebook) works only values 2-15

#IMPORTANT: you must have writing rights to /sys/.../brightness (I must solute it with visudo or something like that...)
#IMPORTANT: for proper work after reboot must exist directory .bright in your home directory and file last_bright in .bright directory 

#reads content of brightness and save it into variable

BRIGHTNESS_FILE="/sys/devices/virtual/backlight/acpi_video0/brightness"
BRIGHT_CONF_DIR="$HOME/.brightintel"
LAST_BRIGHT_FILE="${BRIGHT_CONF_DIR}/last_bright"
BRIGHT=$(cat ${BRIGHTNESS_FILE})

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    #BRIGHT++
    BRIGHT=$(($BRIGHT+8800))
    #protect mechanism (BRIGHT must be lower or equal to 15)
     if (($BRIGHT>132000))
     then
        BRIGHT=$((132000))
     fi
    ;;
   "m")
    #decrease brightness
    #BRIGHT--
    BRIGHT=$(($BRIGHT-8800))
    #protect mechanism (BRIGHT must be bigger or equal to 2)
     if (($BRIGHT<17600))
     then
        BRIGHT=$((17600))
     fi    
    ;;
   "l")
    echo "Loading last value of brightness."
    #Load last value, saved in file last_bright
    BRIGHT=$(cat ${LAST_BRIGHT_FILE})
    echo "Last value of brightness was: $BRIGHT"
    ;;
   "h")
     echo "Help: "
     echo "-p    Increase brightness"
     echo "-m    Decrease brightness"
     echo "-l    Load last brightness value"
     echo "-c N Set to custom value"
     echo "-h    This help"
     echo "Programmed by: ElectricZero"
     echo "Improved by: adrian15"
     exit 0;
     ;;
    "c")
     BRIGHT=$2
     if (($BRIGHT>132000))
     then
        BRIGHT=$((132000))
     fi

     if (($BRIGHT<17600))
     then
        BRIGHT=$((17600))
     fi
     ;;
    "?")
     echo "Unknown argument, try bright -h for help"
     exit 1;
     ;;
    *)
    # Should not occur
    echo "Unknown error while processing options"
    exit 2;
    ;;
  esac
done
echo "Brightness set on $BRIGHT"
#Save variable BRIGHT into file brightness
echo $BRIGHT > ${BRIGHTNESS_FILE}
#Save variable BRIGHT into file last_bright
if [ ! -d ${BRIGHT_CONF_DIR} ] ; then mkdir ${BRIGHT_CONF_DIR} ; fi
echo $BRIGHT > ${LAST_BRIGHT_FILE}

Y he hecho un wrapper que me llama a los dos scripts para sólo tener que interactuar con uno. No comprueba qué script ha de ejecutar pero me da igual. A este script lo he llamado:

custom-backlight-macbookpro_both

y aquí os pongo el código:

#!/bin/bash


NVIDIA_BL_BINARY="/usr/local/bin/custom-backlight-macbookpro_nvidia"
INTEL_BL_BINARY="/usr/local/bin/custom-backlight-macbookpro_intel"

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    ${NVIDIA_BL_BINARY} -p
    ${INTEL_BL_BINARY} -p
    ;;
   "m")
    #decrease brightness
    ${NVIDIA_BL_BINARY} -m
    ${INTEL_BL_BINARY} -m
    ;;
   "l")
    echo "Loading last value of brightness."
    ${NVIDIA_BL_BINARY} -l
    ${INTEL_BL_BINARY} -l
    ;;
   "h")
     echo "Help: "
     echo "-p    Increase brightness"
     echo "-m    Decrease brightness"
     echo "-l    Load last brightness value"
     echo "-c N Set to custom value"
     echo "-h    This help"
     echo "Programmed by: ElectricZero"
     echo "Improved by: adrian15"
     exit 0;
     ;;
    "c")
     BRIGHT=$2
     if (($BRIGHT>15))
     then
        BRIGHT=$((15))
     fi

     if (($BRIGHT<2))
     then
        BRIGHT=$((2))
     fi
    let INTELBRIGHT=${BRIGHT}*8800
    ${NVIDIA_BL_BINARY} -c ${BRIGHT} 
    ${INTEL_BL_BINARY} -c ${INTELBRIGHT}
     ;;
    "?")
     echo "Unknown argument, try bright -h for help"
     exit 1;
     ;;
    *)
    # Should not occur
    echo "Unknown error while processing options"
    exit 2;
    ;;
  esac
done

 

Pues básicamente es eso. Sólo falta editar el archivo /etc/sudoers para habilitar el script que termina en both en lugar del antiguo (miraros el artículo del brillo de la nvidia) y ya lo tenemos.

Y ahora voy a ver si me funciona o no el suspender en modo tarjeta intel que igual en todo este tiempo lo que ha pasado es que volvía a la vida pero con el brillo mínimo y aparentaba no funcionar.

Grub efi arrancando por defecto en REFIT

mayo 27, 2012

Desde Mac OS X editamos el fichero:

sudo nano /efi/refit/refit.conf

y modificamos para que aparezca:

default_selection 3

puesto que el arranque de BOOTX64 (Grub Efi 64 bit) a mi me aparecía en tercer lugar.

Guardamos el fichero y al reiniciar ya tendremos esa entrada por defecto.

Modular brillo pantalla en Mac Book Pro

marzo 19, 2012

Realmente el artículo es para quién a parte de tener un Mac Book Pro tenga por un lado KDE puesto que las teclas rápidas las configuro en base a él y puede que quién tenga un Debian Unstable. No sé qué soporte hay de esto en Ubuntu, quizás ya venga de serie. Y, bueno, de facto, es para todo el mundo que tenga un Mac Book Pro. Se mira el script y listo. En mi caso el Mac Book Pro es un 6,2.

 

Lo primero es crear el fichero:

/usr/local/bin/custom-backlight-macbookpro

que he adaptado de: Script to set-up brightness of backlight in XFCE

Su contenido será

#!/bin/bash

# Adapted from http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/script-to-set-up-brightness-of-backlight-in-xfce-903704/
# Script for changing backlight brightness in /sys/class/backlight/acpi_video0/brightness
# can take values 0-15, in real (my notebook) works only values 2-15

#IMPORTANT: you must have writing rights to /sys/.../brightness (I must solute it with visudo or something like that...)
#IMPORTANT: for proper work after reboot must exist directory .bright in your home directory and file last_bright in .bright directory 

#reads content of brightness and save it into variable

BRIGHTNESS_FILE="/sys/devices/virtual/backlight/apple_backlight/brightness"
BRIGHT_CONF_DIR="$HOME/.bright"
LAST_BRIGHT_FILE="${BRIGHT_CONF_DIR}/last_bright"
BRIGHT=$(cat ${BRIGHTNESS_FILE})

while getopts "pmlhc" optname
 do
  case "$optname" in
   "p")
    #Add more brightness
    #BRIGHT++
    BRIGHT=$(($BRIGHT+1))
    #protect mechanism (BRIGHT must be lower or equal to 15)
     if (($BRIGHT>15))
     then
        BRIGHT=$((15))
     fi
    ;;
   "m")
    #decrease brightness
    #BRIGHT--
    BRIGHT=$(($BRIGHT-1))
    #protect mechanism (BRIGHT must be bigger or equal to 2)
     if (($BRIGHT<2))
     then
        BRIGHT=$((2))
     fi    
    ;;
   "l")
    echo "Loading last value of brightness."
    #Load last value, saved in file last_bright
    BRIGHT=$(cat ${LAST_BRIGHT_FILE})
    echo "Last value of brightness was: $BRIGHT"
    ;;
   "h")
     echo "Help: "
     echo "-p    Increase brightness"
     echo "-m    Decrease brightness"
     echo "-l    Load last brightness value"
     echo "-c N Set to custom value"
     echo "-h    This help"
     echo "Programmed by: ElectricZero"
     echo "Improved by: adrian15"
     exit 0;
     ;;
    "c")
     BRIGHT=$2
     if (($BRIGHT>15))
     then
        BRIGHT=$((15))
     fi

     if (($BRIGHT<2))
     then
        BRIGHT=$((2))
     fi
     ;;
    "?")
     echo "Unknown argument, try bright -h for help"
     exit 1;
     ;;
    *)
    # Should not occur
    echo "Unknown error while processing options"
    exit 2;
    ;;
  esac
done
echo "Brightness set on $BRIGHT"
#Save variable BRIGHT into file brightness
echo $BRIGHT > ${BRIGHTNESS_FILE}
#Save variable BRIGHT into file last_bright
if [ ! -d ${BRIGHT_CONF_DIR} ] ; then mkdir ${BRIGHT_CONF_DIR} ; fi
echo $BRIGHT > ${LAST_BRIGHT_FILE}

Ahora le daremos permisos de ejecución con

chmod +x /usr/local/bin/custom-backlight-macbookpro

y para que esto pueda funcionar sin hacer muchas comedias vamos a autorizar a nuestro usuario a ejecutar el script como root. Para ello editaremos el fichero sudoers:

sudoedit /etc/sudoers

añadiendo una linea tal que:

usuario ALL= NOPASSWD:/usr/local/bin/custom-backlight-macbookpro

.

Hasta aquí sería la parte no gráfica. Ahora pasaremos a lo aburrido.

Nos vamos a Preferencias Generales (Es una aplicación exclusiva de KDE). Acceso rápidos y gestos. Accesos rápidos personalizados.

En estos he creado un nuevo grupo (botón derecho en espacio blanco), y dentro de él dos Nuevos acceso rápidos globales basados en orden/Url.

El acceso rápido aumentar brillo como disparador tiene la tecla “Aumentar brillo” del mac. Como orden/URL tiene:

sudo /usr/local/bin/custom-backlight-macbookpro -p

De forma análoga el acceso rápido disminuir brillo como disparador tiene la tecla “Disminuir brillo” del mac. Como orden/URL tiene:

sudo /usr/local/bin/custom-backlight-macbookpro -m

Marcamos el tick para que todo el grupo esté activo y aplicamos.

En principio desde ahora cuando pulsemos las teclas “disminuir brillo” y “aumentar brillo” harán lo que se nombre indica en el rango 2-15 aunque el permitido fuera 0-15.

Si habéis consultado el enlace del script original veréis que no tenía una opción custom (para poner el valor de brillo que uno quiera) y este sí. Esto es así porque lo usaré en el cambio de modos de ahorro energía de KDE. Pero esto ya será para otro post.

Actualizando a Kde 4.7 en Debian Unstable

marzo 18, 2012

No sé hace cuánto que habrá llegado a Debian Unstable pero ya está aquí y ya estoy actualizando con un:

apt-get update
apt-get dist-upgrade

a partir de mi mirror local en el portátil.

Por fin Kde 4.7 dónde podré emplear la opción para activar rastegraphics de forma global por fin.

Básicamente en mi caso es añadir la linea:

QT_GRAPHICSSYSTEM="raster"

en el fichero:

.profile

del home.

¿Qué dentro de poco vendrá Kde 4.8 con nuevas mejoras? Ya no me importa tanto. Yo con los escritorios virtuales que puedo asociar cada uno a una actividad (no recuerdo ahora como se llama la opción ahora para activar esto). El excelente control de ventanas con Kwin (Las ventanas de correo todas se me abren en el escritorio virtual de correo).  Con eso me conformo.

Ahora desde el punto de vista de mi Mac Book Pro 6,2 sólo me falta poder gestionar el brillo de la pantalla, poder usar la tarjeta intel en lugar de la tarjeta nvidia (para poder tener esas 9 horas de autonomía en lugar de las 4, yo ahora tengo como unas 3).

Poder hibernar sin problemas. Y que no se cuelgue el sistema después de ponerlo a dormir al cabo, no sé, de 1 hora.

Ya os iré informando qué tal todo. De hecho no sé si la actualización funcionará bien… ya he hecho un backup en la otra partición / que tengo para el Debian unstable.

Por cierto me he actualizado de ext3 a ext4, creo que eso también lo notaré.

Tiene su cosa esto. He probado un Ubuntu 11.10 live cuando estaba pasando de ext3 a ext4 y te puedes creer que las teclas del mac se reconocen y modulan por ejemplo la luz del teclado (Sí, ya ves, los Mac book pro retroiluminan el teclado). La del brillo también la detecta pero de facto no modifica en nada el brillo de la pantalla. Así que por la retroiluminación del teclado no me compensa pasarme a Ubuntu.

Sonido sólo por altavoz derecho

octubre 15, 2011

Ayer actualicé Debian Unstable a su última versión. Sólo tuve que reinstalar el modulo de la tarjeta de red para que todo me funcionase. Tampoco fue un gran cambio. Pasé de KDE 4.6.4 a KDE 4.6.5. A mi me interesa la versión 4.7 para poder definir de forma global el sistema gráfico raster (exceptuando openoffice que lo tengo con la mejora de qt).

Al probar el audio me di cuenta de que sólo me iba el altavoz derecho del portátil o bien el izquierdo se oía muy flojo. En el control de volumen sólo puedo controlar master y no el balanceo de izquierda a derecha a la hora de reproducir.

Al final para oir bien las cosas tuve que ejecutar:

sudo alsamixer

elegir la tarjeta de sonido de intel y subir el surround a tope (configuración que tenía antes de la actualización) y ya lo oigo como normal. Aunque, la verdad, creo que el altavoz izquierdo se oye menos pero, claro, todo este tiempo no me había dado cuenta. De todas maneras se oye bien.

Creo que tengo pendiente editar algún fichero para que en los controles de volumen me aparezcan todos los volumenes (micros, auriculares, hdmi, etc.) en lugar de un solo control. Vaya de eso no tengo escrito nada. Otra vez será.

Nada más. Creo que probaré a ver si por fin puedo hibernar (y sobre todo deshibernar) el mac book pro porque eso sí sería una mejora que aportaría la actualización.