background image

F8­x86_64 on the Acer Ferrari 3400LMi

Appendix B – 

dual­head.sh

#!/bin/bash

#
# Available at http://ferrari.databa.se/3400/f8/dual­head.sh

#
# A script to manipulate connected graphical outputs,

# including TV­out. It includes the most common operations
# and may also be configured to run on an XF86Display event.

# Typically Fn­F5 or similar on a laptop.
#

# Prerequisites:
# This script will work with one graphics card only.

# Furthermore it will only work with two CRTCs,
# i.e. two outputs may be simultaneous active.

#
# Comments:

# In order to optimize performance and minimize flicker
# xrandr is at most called twice. Once to read the current

# state and once for setting the new state. Thus, some code
# may look strange at the first glance.

#
# By Sven­Göran Bergh, 2008­01­01

#

### Edit user settings here: ######################################
                       #

DEFAULTACTION="toggle" # May be changed with argument 1
DEFAULTSIDE="left"     # May be changed with argument 2

                       #
###################################################################

### Edit hardware specific settings here: #########################

                       #
INTERNAL="LVDS"        # Specify the name of the internal display

TVOUTPUT="S­video"     # Specify the name of the TV­output
TVMODE="pal"           # Specify TV mode, PAL or NTSC

                       #
###################################################################

# Get X user

#XUSER=$(w | awk '$3 ~ /^:[0­9]$/ {print $1; nextfile}')

# Get X display (current or first running)
DISPLAY=${DISPLAY:= \

    $( w | awk '$3 ~ /^:[0­9]$/ {print $3; nextfile}' )}

# Quit if no X­server is running
[ "${DISPLAY}" ] || exit 1

46

Summary of Contents for Ferrari 3400LMi

Page 1: ...ire 8 4 3 Comments 8 5 USB 9 6 5 in 1 Card reader 9 7 PC card 9 8 Special keys buttons 9 8 1 Configuration procedure 10 8 1 1 X key codes 10 8 1 2 Scan codes 11 8 1 3 Linux key codes 12 8 1 4 X key codes revisited 13 8 1 5 Configure actions 14 9 CPU ACPI support 14 9 1 Suspend 15 9 2 CPU frequency scaling 15 10 Graphics 15 10 1 Basics 15 10 1 1 The radeon driver 16 10 1 2 Simple X configuration 16...

Page 2: ...e phone 28 13 2 2 Prepare the laptop 28 13 2 3 Static configuration 30 13 2 4 Dynamic routine 31 13 2 5 GPRS 32 13 3 Sending files 33 13 4 Mouse keyboard 33 13 5 KBluetooth 33 13 5 1 Installation 33 13 5 2 Mouse keyboard 34 13 5 3 Scan for devices 34 13 5 4 Lock screen 35 13 5 5 Transfer files 36 14 Infrared 36 14 1 Configuring IrDA 36 14 2 Testing IrDA 38 15 Modem 38 15 1 Installing daemon 39 15 ...

Page 3: ...fense was totally broken The combination is truly devastating I have noticed strange things happening to me since I got My Precious Please feel free to comment on any topic or possible improvements in this document 1 1 Version This is an updated version of this document This time I have chosen to install Fedora 8 x86_64 and many things has really changed to the better The first version dealt with ...

Page 4: ...grade Seagate Momentus 160 GB ATA ATAPI 6 5400rpm ST9160821A No configuration needed NIC wired OK Broadcom NetXtreme BCM5788 Gigabit Ethernet No configuration needed NIC wireless OK Broadcom BCM4306 802 11b g W LAN Use kernel module b43 see comments below Modem OK VIA AC 97 56k Modem Unstable See below for configuration DVD drive OK Matshita DVD RAM UJ 825S DVD CD R W DVD RAM No configuration need...

Page 5: ...g your new laptop These are mentioned in the corresponding sections below and may be installed afterwards 2 1 Potential pitfalls Depending on your setup there are some pitfalls you should know about 2 1 1 Graphical installer Fedora Core 5 installation and later runs without any problems while Fedora Core 4 should be started with linux nofb This tells the installation to disable the frame buffer so...

Page 6: ...to copy your existing installation to the new drive you need the following two lines in your etc modprobe conf file alias scsi_hostadapter libata options libata ignore_hpa 1 If you plan on installing a fresh system on the new drive take a look in the 2 Installation section above During the installation the proper entries are written to etc modprobe conf 4 IEEE 1394 Firewire With FC5 and later ther...

Page 7: ...1394 sbp2 aborting sbp2 command kernel scsi1 destination target 0 lun 0 kernel command Write 10 2a 00 01 06 d0 df 00 00 03 00 kernel ieee1394 sbp2 aborting sbp2 command kernel scsi1 destination target 0 lun 0 kernel command Write 10 2a 00 02 e1 bd b0 00 00 20 00 Seems to me like a hole bunch of timeouts with corresponding bus resets These suspicions got even stronger after timing a read data trans...

Page 8: ...l hardware Valid values for the max_speed option are 0 100 mb 1 200 mb 2 400 mb default 3 800 mb When timing the very same read transfer as above I now get the following result time cp rp media ieee1394disk 430MB_folder real 0m24 871s user 0m0 076s sys 0m6 400s That is what I call improvement Going from over 20 minutes down to roughly 25 seconds 4 3 Comments After some further exercises with other...

Page 9: ...re some what confusing Some of the special buttons do not need any additional configuration to work Others need a key code mapping while some even lack a scan code The chain of scan codes and key codes translations starts in the core Linux kernel and ends in your X configuration Some examples of confusion The Mail button gets a pre configured key code of 155 by Linux but with X loaded the key code...

Page 10: ...d Fn F8 yes x x Toggle mute Fn Home yes Go home XF86Home Fn End yes Go to end XF86End Fn up yes x x Volume raise Fn down yes x x Volume lower Fn left yes Brightness lighter no configuration needed Fn right yes Brightness darker no configuration needed Bluetooth yes No configuration needed WLAN yes No configuration needed 8 1 Configuration procedure It is a tedious procedure to find out the proper ...

Page 11: ... need to get the other keys to show up under X as well In order for them to do so they need properly configured Linux key codes that they lack for the moment 8 1 2 Scan codes This step is different and considerable easier under F8 than FC4 or FC5 There is no need to shutdown X now as before 2 Just press the desired key ex P1 Then take look at the dmesg output dmesg tail atkbd c Unknown key pressed...

Page 12: ...21 0 Escaped scancodes e0 xx hex e0 00 0 0 0 0 0 0 0 0 e0 08 0 0 0 0 0 0 0 0 e0 10 165 0 0 0 0 0 0 0 e0 18 0 163 0 0 96 97 0 0 e0 20 113 140 164 0 166 0 0 0 e0 28 0 0 255 0 0 0 114 0 e0 30 115 0 172 0 0 98 255 99 e0 38 100 0 0 0 0 0 0 0 e0 40 0 0 0 0 0 119 119 102 e0 48 103 104 0 105 112 106 118 107 e0 50 108 109 110 111 0 0 0 0 e0 58 0 0 0 125 126 127 116 142 e0 60 0 0 0 143 0 217 156 173 e0 68 1...

Page 13: ...v to figure out what X key codes these buttons got I got the following Button X key code P1 201 P2 146 Fn F1 135 Fn F2 140 Fn F3 248 7 Ok now we have X key codes for all special keys buttons and need to map them to proper key symbols In order to do that put the following in the file etc X11 Xmodmap Acer Ferrari 3400Lmi special keys buttons Button X key code Mail 236 WWW 178 P1 201 P2 146 Fn F1 135...

Page 14: ...a0 XF86AudioMute keycode 0xb0 XF86AudioRaiseVolume keycode 0xae XF86AudioLowerVolume 8 1 5 Configure actions 9 Finally it is time to configure the button actions Actions for all but the audio control keys are easily configured in the KDE Control Center Regional Accessibility Keyboard Shortcuts under the tab Command Shortcuts 10 However you probably also want to configure the audio control buttons ...

Page 15: ...wersave now feels really mature and has three pre configured CPU policies Performance Dynamic and Powersave Dynamic is the default and there is no real reason to change it 10 Graphics The advancement of Xorg and its related drivers and modules has been enormous the last two years Fedora 8 includes Xorg 7 2 which is a welcome improvement in X server configuration Furthermore there is absolutely no ...

Page 16: ...rt RandR 1 2 Fortunately the radeon driver is one of them 10 1 2 Simple configuration If you are familiar with X configuration and take a look at the default etc X11 xorg conf file generated during the installation you will notice a significant change Many of the traditional settings sync and refresh rates modes and modelines are gone All these settings are now auto detected by RandR 1 2 and shoul...

Page 17: ...t only important setting needed in xorg conf However in order to enjoy hardware support for 3D acceleration the virtual screen may not be larger than 3000x2000 This limitation differs for the various driver but for the radeon driver the limitation is 3000x2000 This is sufficient for having an external monitor running at 1600x1200 side by side with your internal display as 1400x1050 After modifying...

Page 18: ...onnect an external monitor and try the following commands Get a full report of the current status by xrandr verbose Activate the external monitor with its default mode and mirror the internal display xrandr output VGA 0 auto Put the external monitor to the left of the internal panel with xrandr output VGA 0 left of LVDS Change resolution and refresh rate of the external monitor xrandr output VGA 0...

Page 19: ...he sequence will only include the first three modes from above Notice that the internal monitor may be dimmed at any time by pressing the Fn F6 button Thus turning off the internal monitor is not included in the script The script is outlined in Appendix B and may be downloaded at http ferrari database se 3400 f8 dual head sh The script also includes some other common operation to manipulate the gr...

Page 20: ...ons of most interest for performance are AccelMethod default XAA AGPMode auto detected ColorTiling default on and EnablePageFlip default off The first three are correct by default but due to instability in rare cases EnablePageFlip is disabled by default Turning on the option EnablePageFlip in xorg conf reveals no flaws I have not noticed any glitches with this option on my setup so I feel confide...

Page 21: ...ection Remember that we have three outputs but only two rendering pipelines CRTCs What would then happen if we try to auto detect and configure all available outputs xrandr auto with both VGA 0 and S video connected We actually do not know The internal display may only use the first pipeline CRTC 0 but that might be allocated by either VGA 0 or S video Furthermore we will have a race condition bet...

Page 22: ... 11b g WLAN chip on the Ferrari you have two choices The traditional NdisWrapper or the kernel module b43 When I first got this laptop there was no other option than NdisWrapper but lately the kernel module b43 has evolved and matured As its name implies NdisWrapper is a wrapper for NDIS drivers meaning that you use a corresponding Windows driver instead of a Linux driver For some WLAN chips this ...

Page 23: ... to build it as a module dmesg grep b43 b43 phy0 Broadcom 4306 WLAN found b43 phy0 debug Found PHY Analog 2 Type 2 Revision 2 b43 phy0 debug Found Radio Manuf 0x17F Version 0x2050 Revision 2 lsmod grep b43 b43 150001 0 rfkill 14801 1 b43 mac80211 127949 1 b43 input_polldev 12113 1 b43 ssb 38725 1 b43 2 Next we need to make sure that the wireless tools package is installed on our system rpm q wirel...

Page 24: ... sure we get the results and feedback that we expect This is to verify the functionality and simplify troubleshooting if needed 7 The WLAN interface should show up iwconfig wlan0 wlan0 IEEE 802 11g ESSID Mode Managed Channel 0 Access Point Not Associated Tx Power 0 dBm Retry min limit 7 RTS thr off Fragment thr 2352 B Encryption key off Link Quality 0 Signal level 0 Noise level 0 Rx invalid nwid 0...

Page 25: ...want to connect to and set the ESSID of your W LAN interface iwconfig wlan0 essid Perspektiv 11 Your WLAN interface should now be associated with the access point iwconfig wlan0 wlan0 IEEE 802 11g ESSID Perspektiv Mode Managed Frequency 2 412 GHz Access Point 00 E0 63 50 98 B0 Bit Rate 1 Mb s Tx Power 27 dBm Retry min limit 7 RTS thr off Fragment thr 2352 B Encryption key off Link Quality 63 100 S...

Page 26: ...ystem startup type chkconfig add NetworkManager chkconfig add NetworkManagerDispatcher chkconfig level 5 NetworkManager on chkconfig level 5 NetworkManagerDispatcher on 13 Bluetooth No special actions were needed for me to get Bluetooth up and running It was truly amazing how easy it was However in order to be complete the details are summarized below 13 1 Verify installation Make sure that you ha...

Page 27: ...AVE ACCEPT Name redneck superwise net 0 Class 0x100100 Service Classes Object Transfer Device Class Computer Uncategorized HCI Ver 1 1 0x1 HCI Rev 0x20d LMP Ver 1 1 0x1 LMP Subver 0x20d Manufacturer Cambridge Silicon Radio 10 If you have come this far without any problems you are all set and ready to go 13 2 Using a phone modem To help get you started I have summarized the basic steps to hook up y...

Page 28: ...w we are ready to configure the laptop Start by scanning for bluetooth devices in your surrounding hcitool scan Scanning 00 0A D9 E9 D8 4F S Gs P900 The first field is the bluetooth address of your phone The second field contains its given name You should also be able to ping it by its address l2ping 00 0A D9 E9 D8 4F Ping 00 0A D9 E9 D8 4F from 00 0E 9B 87 3B 90 data size 44 0 bytes from 00 0A D9...

Page 29: ... OBEX File Transfer Service RecHandle 0x10002 Service Class ID List OBEX File Transfer 0x1106 Protocol Descriptor List L2CAP 0x0100 RFCOMM 0x0003 Channel 2 OBEX 0x0008 Service Name Bluetooth Serial Port Service Description Bluetooth Serial Port Service Provider Symbian Ltd Service RecHandle 0x10003 Service Class ID List Serial Port 0x1101 Protocol Descriptor List L2CAP 0x0100 RFCOMM 0x0003 Channel...

Page 30: ...ess That is about it Now your phone is analogue to an external modem connected to your virtual serial device dev rfcomm1 Configure ppp to make use of it and you are done 13 2 3 Static configuration Ok now what Do I need to repeat all the steps above each time I want to use my phone as a modem No for convenience you may configure your system for all this to take place automatically However the meth...

Page 31: ...eat for both modem to modem dial ups and GPRS connections So I have configured KDE to call my script just before Kppp is opened First I was a bit suspicious about this method to work all the time but I have not had any trouble this far and I have been using it for years now You may find a printout of the script in Appendix C or download it from http ferrari databa se 3400 f8 dun bind sh Obviously ...

Page 32: ...ration rather than actual dialing Two AT command strings are vital for GPRS connections First a configuration string is used to specify things like protocol and network provider This string is passed during modem initialization and in my case it is AT CGDCONT 1 IP services vodafone net 0 0 After initialization the actual dialing is substituted by sending a connection request to the network provide...

Page 33: ...d the mouse keyboard Then press the setup button on the mouse keyboard to make it announce itself and type hidd search Searching Connecting to device 00 0A 94 C1 B6 5D In the next section you will find a more user friendly and persistent way of connecting your bluetooth mouse keayboard 13 5 KBluetooth If you are running KDE there is a Bluetooth extension called KBluetooth available There is a simi...

Page 34: ...th mouse or keyboard with KBluetooth is really simple Activate the mouse and move it around and it will be detected automatically The first time it is detected an authentication dialog is raised If you want to use the same device in the future without a new acknowledge press Always Accept otherwise just press Accept Could it be easier 13 5 3 Scan for devices KBlueMon is a basic tool to scan for bl...

Page 35: ...eLock may be used to lock the screen whenever a bluetooth device becomes unreachable Once the device appears again the screen is unlocked This is a very convenient security measure to prevent others from fiddling with your Precious when you leave it unattended 35 ...

Page 36: ...ng the DEVICE in etc sysconfig irda to dev ttyS1 and fire up the IrDA service etc init d irda start Voilà Watching the log messages verified that all modules were loaded and I had got a new device irda0 to play with The device showed up with ifconfig as well It was just too easy And yes although all looked perfect it did not work Trying the irdadump reviled just a big silence 14 1 Configuring IrDA...

Page 37: ...pts file Here you need to uncomment or insert the line exclude irq 3 to prevent the pcmcia service from intervening 3 Now we want a module capable of handling FIR on the Ferrari chip to be loaded when the IrDA service is started The module of choice is nsc ircc so add the following two lines in etc modprobe conf alias irda0 nsc ircc options nsc ircc dongle_id 0x09 io 0x2f8 irq 3 dma 1 Pay attentio...

Page 38: ...receiving traffic So activate IR on the remote device e g your phone and place the two IR ports eye to eye Then do a dump of the traffic irdadump i irda0 xid cmd 62a9cc0d ffffffff S 6 s 5 14 xid cmd 62a9cc0d ffffffff S 6 s redneck hint 0400 Computer 23 xid cmd ffffffff 6f700c8d S 1 s 0 14 xid rsp 62a9cc0d 6f700c8d S 1 s 0 redneck hint 0400 Computer 23 xid cmd ffffffff 6f700c8d S 1 s P900 hint 9325...

Page 39: ...ided by Linmodems http linmodems technion ac il They do a great job in providing binary modem daemons by regular compiles of the Linuxant code This daemon may very well be compiled as a 32 bit executable Even if we are running on a 64 bit platform Note Unfortunately the modem support is still unstable Depending on the versions of the modem daemon and the kernel it might work Even though it is very...

Page 40: ... shipped with the package needs to be modified a bit in order to accomplish this You will find my modified version in Appendix D 7 Download and add this script as a service to the Sys V system wget http ferrari databa se 3400 f8 slmodemd sysv init sh chmod u x slmodemd sysv init sh slmodemd sysv init sh install 8 Now edit your configuration options in etc sysconfig slmodemd A list of all supported...

Page 41: ...s below 15 2 1 Connecting The problem might occur while establishing a connection The best way to observe this is to start slmodemd manually with the debug flag set service slmodemd stop Shutting down SmartLink Modem driver OK slmodemd d 1 alsa country SWEDEN nortpriority Once the daemon is running in debug mode dial the preferred number The modem goes on line dials the number and the other end an...

Page 42: ...ault may be devastating When the modem daemon goes insane it will hug your CPU and squeeze it all real hard If the daemon has real time priority you will have a hard to get control over you system again and a forced shutdown might be the only way out Note You should always run slmodemd with the nortpriority option set Failing to do so might hang your entire system 16 References This document is a ...

Page 43: ...F8 x86_64 on the Acer Ferrari 3400LMi http www hpl hp com personal Jean_Tourrilhes Linux Wireless html 43 ...

Page 44: ...river kbd Option XkbModel pc105 Option XkbLayout se EndSection Section InputDevice Identifier Synaptics Driver synaptics Option Device dev input mice Option Protocol auto dev Option Emulate3Buttons yes EndSection Section Monitor Identifier Internal Panel VendorName Acer ModelName Ferrari 3400 LMi Option PreferredMode 1400x1050 EndSection Section Monitor Identifier External VGA Monitor Option LeftO...

Page 45: ...nal VGA Monitor Option Monitor S video External TV Option AccelMethod XAA Option AGPMode 1 Option ColorTiling 1 Option EnablePageFlip 1 EndSection Section Screen Identifier Screen0 Device Videocard0 DefaultDepth 24 SubSection Display Viewport 0 0 Depth 24 Virtual 3000 2000 EndSubSection EndSection 45 ...

Page 46: ...optimize performance and minimize flicker xrandr is at most called twice Once to read the current state and once for setting the new state Thus some code may look strange at the first glance By Sven Göran Bergh 2008 01 01 Edit user settings here DEFAULTACTION toggle May be changed with argument 1 DEFAULTSIDE left May be changed with argument 2 Edit hardware specific settings here INTERNAL LVDS Spe...

Page 47: ...re calling xrandr case echo ACTION tr A Z a z in init toggle status internal tv Recognized actions Do nothing and continue help usage usage exit 0 printf s Unknown operation s n ME ACTION usage exit 1 esac Get information about all outputs ALLINFO xrandr q awk connected printf s 1 if 2 dis if 3 0 9 x printf s 3 else printf Initialize some useful variables for i 0 i ALLINFO i Array with all outputs...

Page 48: ...O i awk F print 2 awk F print 2 3 Index for the internal output ALLOUT i INTERNAL INTNDX i Index for the currently active external output ACTIVE i a ACTIVE i INTERNAL CURNDX i CURNDX CURNDX INTNDX CURRENT ALLOUT CURNDX case echo SIDE tr A Z a z in left LOCATION left of INTERNAL right LOCATION right of INTERNAL top above LOCATION above INTERNAL bottom below LOCATION below INTERNAL esac function run...

Page 49: ...3s 9s 7s 10s 10s n ALLOUT i c a ALLPOS i ALLRES i function internal Internal output always active INT output INTERNAL auto pos 0x0 Turn off currently active external output CURRENT INTERNAL OFF output CURRENT off run xrandr INT OFF function tvout If TV output already active exit CURRENT TVOUTPUT exit 0 Internal output always active INT output INTERNAL auto Turn off currently active external output...

Page 50: ...else for i 0 i ALLOUT i CONCTD i CURRENT break until NEXT do i i 1 ALLOUT NEXT CONCTD i done fi Internal output always active INT output INTERNAL auto Turn off currently active external output CURRENT INTERNAL a CURRENT NEXT OFF output CURRENT off Turn on next connected external output NEXT INTERNAL ON output NEXT auto If mirror mode reposition internal output Otherwise position external output NE...

Page 51: ...F8 x86_64 on the Acer Ferrari 3400LMi internal internal tv tvout usage esac 51 ...

Page 52: ...s echo e 033 60G 033 1 32mOK 033 0 39m return 0 failure echo e 033 60G 033 1 31mFAILED 033 0 39m exit 1 Check that local Bluetooth device is active echo n Checking for local Bluetooth device hciconfig grep UP RUNNING dev null success failure If the rfcomm port exists but is currently not in use try to release it if rfcomm show RFPORT 2 dev null awk print 5 closed then echo n Trying to free closed ...

Page 53: ...int 1 BTADDR success failure Find the Dial Up Networking channel echo n Searching for Dial Up Networking service DUN sdptool search bdaddr BTADDR DUN awk Channel print 2 DUN success failure Bind the rfcomm port to the DUN channel echo n Binding dev rfcomm RFPORT to DUN channel DUN rfcomm bind RFPORT BTADDR DUN success failure 53 ...

Page 54: ...ETVAL 0 Default configuration SLMODEMD_DEVICE SLMODEMD_OPTS SLMODEMD_COUNTRY SWEDEN USE_ALSA yes Source configuration CONFIG etc sysconfig PROG if f CONFIG then CONFIG override default group and permissions if defined in CONFIG other valid options also can be put into SLMODEMD_OPTS variable GROUP SLMODEMD_OPTS SLMODEMD_OPTS group GROUP PERMS SLMODEMD_OPTS SLMODEMD_OPTS perm PERMS fi Do not try to ...

Page 55: ...AL eq 0 touch var lock subsys PROG return RETVAL stop echo n Shutting down SmartLink Modem driver killproc PROG RETVAL RETVAL eq 0 rm f var lock subsys PROG echo return RETVAL See how we were called case 1 in start start stop stop status status PROG RETVAL restart reload stop start RETVAL condrestart if f var lock subsys PROG then stop start RETVAL fi install install t m 755 0 etc init d PROG dev ...

Page 56: ...F8 x86_64 on the Acer Ferrari 3400LMi echo Usage PROG start stop status restart condrestart install exit 1 esac exit RETVAL 56 ...

Reviews: