Archive for the ‘gentoo’ Category

Sony Vaio VGN-NR21Z/S experience 02: lcd backlight

Thursday, April 9th, 2009

Now it works with Fn+F5/F6

echo "media-video/nvclock ~x86" >> /etc/portage/package.keywords"
emerge acpid nvclock

cat /etc/acpi/events/sony-brightness-up

event=sony/hotkey SNC 00000001 00000011
action=/usr/bin/nvclock -S +10

cat /etc/acpi/events/sony-brightness-down

event=sony/hotkey SNC 00000001 00000010
action=/usr/bin/nvclock -S -10
/etc/init.d/acpid start
rc-update add acpid default

xorg-server-1.5.3-r5 + hal + evdev

Thursday, April 9th, 2009

cat /etc/hal/fdi/policy/10-x11-input.fdi

< ?xml version="1.0" encoding="utf-8"?>
<deviceinfo version="0.2">
   <match key="info.capabilities" contains="input.keys">
      <!-- Option "XkbModel" "pc101" -->
      <merge key="input.xkb.model" type="string">evdev</merge>
      <merge key="input.xkb.layout" type="string">it</merge>
      <append key="input.xkb.options" type="string">compose:lwin</append>
   </match>
</deviceinfo>

cat /etc/hal/fdi/policy/11-x11-synaptics.fdi

< ?xml version="1.0" encoding="utf-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.touchpad">
      <!--
      <match key="info.product" contains="Synaptics TouchPad">
      -->
      </match><match key="info.product" contains="AlpsPS/2 ALPS GlidePoint"> 
        <merge key="input.x11_driver" type="string">synaptics</merge>
        <merge key="input.x11_options.SHMConfig" type="string">On</merge>
        <!-- Tapping -->
        <merge key="input.x11_options.TapButton1" type="string">1</merge>
        <merge key="input.x11_options.TapButton2" type="string">2</merge>
        <merge key="input.x11_options.TapButton3" type="string">3</merge>
        <!-- Scrolling up/down -->
        <merge key="input.x11_options.VertEdgeScroll" type="string">1</merge>
        <merge key="input.x11_options.HorizEdgeScroll" type="string">1</merge>
        <!-- Corner clicks -->
        <merge key="input.x11_options.RBCornerButton" type="string">2</merge>
        <merge key="input.x11_options.RTCornerButton" type="string">3</merge>
	<!-- Other stuff -->
 	<merge key="input.x11_options.MaxTapMove" type="string">2000</merge>
 	<merge key="input.x11_options.VertEdgeScroll" type="string">True</merge>
 	<merge key="input.x11_options.VertTwoFingerScroll" type="string">True</merge>
 	<merge key="input.x11_options.HorizTwoFingerScroll" type="string">True</merge>
 	<merge key="input.x11_options.CircularScrolling" type="string">True</merge>
      </match>
 
  </device>
</deviceinfo>

Script flac to mp3

Wednesday, February 4th, 2009

…riporto un semplice script per convertire file in formato flac a file in formato mp3… requisiti:

emerge media-sound/lame media-libs/flac

…listato di flac2mp3.sh

#!/bin/bash
OUT_DIR="./mp3"
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR}
# lame options
lame_opts=" --vbr-new -V 2 -B 256 "
for x in "${@}"
do
FLAC=${x}
MP3="${FLAC%.flac}.mp3"
[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ;
metaflac --export-tags-to=- "$FLAC" | sed 's/=\(.*\)/="\1"/' > tmp.tmp
. ./tmp.tmp
rm tmp.tmp
echo "Converting ${FLAC} to MP3 format"
flac -c -d "$FLAC" | lame ${lame_opts} --tt "$TITLE" \
--tn "$TRACKNUMBER" \
--tg "$GENRE" \
--ty "$DATE" \
--tc "$COMMENT" \
--ta "$ARTIST" \
--tl "$ALBUM" \
--add-id3v2 \
- ${OUT_DIR}/"$MP3"
done

…uso: ./flac2mp3.sh file1.flac . . . filen.flac

Trust Bluetooth 2.0 EDR Adapter BT-2100p su Gentoo x86

Monday, January 12th, 2009

…piccolissima guida su come configurare l’adattore bluetooth 2.0 EDR Trust BT-2100p per trasferire dati da e verso una periferica, ad esempio un cellulare…
…abilitare il supporto nel kernel…

[*] Networking support  --->
  [*]  Bluetooth subsystem support  --->
    --- Bluetooth subsystem support
    [*]   L2CAP protocol support
    [*]   SCO links support
    [*]   RFCOMM protocol support
    [*]     RFCOMM TTY support
    [*]   BNEP protocol support
    [*]     Multicast filter support
    [*]     Protocol filter support
    [*]   HIDP protocol support
    Bluetooth device drivers  --->
      [*] HCI USB driver
      [*] HCI SDIO driver
      [*] HCI UART driver
      [*]   UART (H4) protocol support
      [*]   BCSP protocol support
      [*]   HCILL protocol support

…installare i tool necessari…

emerge -u net-wireless/bluez-utils

…e anche, molto comodo da usare…

emerge -u net-wireless/kdebluetooth

…configurare /etc/conf.d/bluetooth e tutti i file necessari in /etc/bluetooth, in particolare hcid.conf

#
# HCI daemon configuration file.
#
 
# HCId options
options {
	# Automatically initialize new devices
	autoinit yes;
 
	# Security Manager mode
	#   none - Security manager disabled
	#   auto - Use local PIN for incoming connections
	#   user - Always ask user for a PIN
	#
	security user;
 
	# Pairing mode
	#   none  - Pairing disabled
	#   multi - Allow pairing with already paired devices
	#   once  - Pair once and deny successive attempts
	pairing multi;
 
	# PIN helper
	#pin_helper /usr/bin/bluepin;
	#pin_helper /usr/lib/kdebluetooth/kbluepin;
	pin_helper /etc/bluetooth/pin-helper;
 
	# D-Bus PIN helper
	#dbus_pin_helper;
}
 
# Default settings for HCI devices
device {
	# Local device name
	#   %d - device id
	#   %h - host name
	name "TUONOMEHOSTPREFERITO";
 
	# Local device class
	# class 0x3e0100;
	class 0x7e010c;
	discovto 0;
 
	# Default packet type
	#pkt_type DH1,DM1,HV1;
 
	# Inquiry and Page scan
	iscan enable; pscan enable;
 
	# Default link mode
	#   none   - no specific policy 
	#   accept - always accept incoming connections
	#   master - become master on incoming connections,
	#            deny role switch on outgoing connections
	lm accept;
 
	# Default link policy
	#   none    - no specific policy
	#   rswitch - allow role switch
	#   hold    - allow hold mode
	#   sniff   - allow sniff mode
	#   park    - allow park mode
	lp rswitch,hold,sniff,park;
 
	# Authentication and Encryption (Security Mode 3)
	#auth enable;
	#encrypt enable;
}

…scrivere il pin da usare con le periferiche bluetooth…

echo "wxyz" > /etc/bluetooth/pin

…avviare kbluetooth e inserire l’adattatore bluetooth… buon divertimento…
EDIT:
…la vita comoda piace a molti… per far funzionare il vostro front-end occorre editare anche /etc/dbus-1/system.d/bluetooth.conf duplicando le seguenti righe e mettendo al posto di root il proprio username…

<policy user="root">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent"/>
</policy>

ndiswrapper 1.53 + linux-2.6.27

Wednesday, October 29th, 2008

If you have problem compiling ndiswrapper 1.53 against linux-2.6.27 sources and you don’t use the svn repository, then you’ll need this patch. For your Gentoo box, get the ebuild and copy it in your private overlay. Before digest‘ing it, don’t forget to copy the patch and the ndiswrapper-CVE-2008-4395.patch into the correct ${FILESDIR}.

Configurare il bonding su Gentoo ~x86

Wednesday, October 15th, 2008

…abilitare il supporto al bonding nel kernel…

Device Drivers  --->;
  [*] Network device support  --->;
     [*]  Bonding driver support

…installare ifenslave…

emerge ifenslave

…aggiungere il caricamento del modulo all’avvio editando /etc/conf.d/modules

modules="bonding"
module_bonding_args="miimon=100 mode=1"

…ed editando /etc/conf.d/net configurare le interfacce da unire nel bonding…

config_eth0=( "null" )
config_eth1=( "null" )
slaves_bond0="eth0 eth1"
config_bond0=( "xxx.xxx.xxx.xxx netmask yyy.yyy.yyy.yyy broadcast zzz.zzz.zzz.zzz" )
routes_bond0=( "default via www.www.www.www" )
dns_servers_bond0=( "uuu.uuu.uuu.uuu vvv.vvv.vvv.vvv" )
dns_domain_bond0="abcdefgh.ij"
dns_search_bond0="abcdefgh.ij"

…aggiungere e togliere i servizi non più necessari…

ln -s /etc/init.d/net.lo /etc/init.d/net.bond0
rc-update add net.bond0 default
rc-update del net.eth0 default
rc-update del net.eth1 default

…riavviare la macchina per testare se tutto si configura come voluto…

…il bonding può essere configurato in 7 modi diversi usando il parametro mode

  1. mode=0: ridondanza e bilanciamento del carico in trasmissione
  2. mode=1: una sola interfaccia attiva, le altre come backup
  3. mode=2: ridondanza e semplice bilanciamento
  4. mode=3: solo ridondanza
  5. mode=4: ridondanza e bilanciamento ma necessita che il router supporti il 802.3ad Link Aggregation
  6. mode=5: ridondanza e bilanciamento solo in trasmissione
  7. mode=6: ridondanza e bilanciamento in trasmissione e ricezione

Lighttpd + password protected AWStats on Gentoo

Monday, September 29th, 2008

Install stuff

echo "dev-lang/php cgi cli bcmath calendar cdb cgi cli ctype mysqli pcre posix sockets tokenizer zip xmlwriter" >> /etc/portage/package.use
echo "www-servers/lighttpd fastcgi memcache php" >> /etc/portage/package.use
echo "net-www/awstats geoip vhosts" >> /etc/portage/package.use
emerge lighttpd awstats

Edit /etc/lighttpd/lighttpd.conf making sure there are these lines:

server.modules = ( "mod_auth" )
include "mod_cgi.conf"
include "mod_fastcgi.conf"
include "mod_auth.conf"

Add user and password

touch /etc/lighttpd/.htpasswd
htpasswd -c /etc/lighttpd/.htpasswd yourpreferredusername

Install AWStats into your webserver

mkdir /path/to/documentroot/directory/htdocs/awstats
webapp-config -I -h localhost -d /awstats/ awstats awstatsversion

Edit AWStats config file

cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.yourdomain.conf
nano /etc/awstats/awstats.yourdomain.conf

Check at least LogFile="/var/log/lighttpd/access.log" (default lighttpd logfile) is present in /etc/awstats/awstats.yourdomain.conf
Add mod_auth.conf to Lighttpd

cat /etc/lighttpd/mod_auth.conf 
$HTTP["url"] =~ "^/cgi-bin/awstats.pl" {
  auth.backend = "htpasswd"
  auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd"
  auth.require = ("/cgi-bin/awstats.pl" => (
     "method"  => "basic",
     "realm"   => "AWStats",
     "require" => "valid-user"
  ))
}

Update your stats

/path/to/documentroot/directory/cgi-bin/awstats.pl -config=yourdomain -update

Add an hourly cronjob

echo "0 * * * * root /path/to/documentroot/directory/cgi-bin/awstats.pl -config=yourdomain -update" >> /etc/crontab
/etc/init.d/vixie-cron restart

Start Lighttpd. That’s it!

Sony Vaio VGN-NR21Z/S experience 01

Friday, September 5th, 2008

I got a new laptop for work: it’s a Sony Vaio VGN-NR21Z/S. Well, I had to fix the dsdt table, as aspected. It wasn’t a piece of cake but I did it, even if I’m still not sure it’s completely correct.
If you need it, and you’re a bit lazy, here there is the custom dsdt file to be passed to you kernel. You can have a look at the original decompiled dsdt, at the fixed one and at the differences.
Now I can even adjust the volume by the Fn keys and acpid sees all events. But, how can I adjust the brightness of the backlight?

lspci -n

Friday, July 25th, 2008

…ciao Two… quando cerchi la lista dei moduli da comprendere nel nuovo kernel aiutati con questo