Hardware
Replacing broken laptop displays
by Mostafa on Feb.02, 2007, under Hardware
Notebook LCD replacement need not be a costly affair:
How To Replace A Broken Laptop or Notebook Display
ScreenTek is apparently a leading manufacturer.
Return of DARKWORLD
by Mostafa on Jan.15, 2006, under Hardware, Software
Yup! My favorite PC just regained Net connectivity today. I moved into the new apartment this morning and was up and running by the evening. The guy who I share the place with wasn’t around and so I would have had to wait till I got the info about the wireless network. So, instead of waiting, I just decided to see what kind of a WLAN he has … and oh my oh my … there were 5 freakin’ access points around — and 3 of them completely unsecured! As it turned out, one belonged to the dude I share the place with …
Anyway, then I decided to catch up on my TV eps (Stargate SG1/Atlantis, Threshold, Supernatural, Doctor Who) and f*** the speed sux! It’s a bloody T-Online DSL1000 Flat deal. Anyway, the IP I got was “192.168.0.5″, so I deduced that the router should be at “192.168.0.1″ or “192.168.0.254″. And sure enough there it was in the first address. Obviously, it asked me for a password that I didn’t know. So, I just tried “admin:1234″ .. and nope, no go .. Then I thought I’d just do a little net search. The router was NETGEAR (deduced from the WLAN SSID), so I just googled “netgear default password” and the 4th hit came up with “admin:password”. Turns out the guy didn’t even change that password
So, I got in, fiddled around with the NAT settings and Azureus was NAT free in no time. This has got to be the prime example of an unsecured network …
Anyway, once the guy got back, I explained everything to him and changed the router password and setup a WEP-key. It seems there was a machine leeching off of this net and things improved a little once that dude got kicked out. It turns out DSL6000 costs just as much as he pays right now — but he has no use for so much bandwidth when I’m gone — so we’ll just change to DSL2000 with 384k upload for now. That should be enough for me to download the occasional SG1 / Doctor Who episode
Addressing Individual Audio Channels of a Multichannel ALSA System
by Mostafa on Oct.03, 2005, under Hardware, How To ..., Linux, Software
At first I thought I could just use one of the audio editors to create a 5.1 channel sound file and blank all the channels that I don’t want. Sweep claims to be a multichannel audio editor but at the moment it’s not possible to edit the individual audio channels. So, I tried out Audacity. Although Audacity allows the editing of the individual channels, it’s not possible to save the edited file in a multichannel format – it’s invariably down-mixed to stereo. So, custom sound files were no longer an option ..
At this point, I started looking at the ALSA PCM plugins. The route plugin seemed like the perfect candidate. In order to use the plugin I had to create the plugin definitions in the file ~/.asoundrc:
[darkknight@darkworld ~]$ cat .asoundrc
pcm_slave.rt {
pcm surround50
channels 5
}
pcm.front_l { #Front Left
type route
slave rt
ttable.0.0 1
}
pcm.front_r { #Front Right
type route
slave rt
ttable.0.1 1
}
pcm.front_c { #Front Center
type route
slave rt
ttable.0.4 1
}
pcm.rear_l { #Rear Left
type route
slave rt
ttable.0.3 1
}
pcm.rear_r { #Rear Right
type route
slave rt
ttable.0.2 1
}
pcm.front_both { #Front - Both
type route
slave rt
ttable.0.0 1
ttable.0.1 1
}
pcm.rear_both { #Rear - Both
type route
slave rt
ttable.0.2 1
ttable.0.3 1
}
The plugins can be used with the aplay utility:
[darkknight@darkworld ~]$ aplay -D front_c /usr/share/sounds/alsa/Front_Center.wav Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Of course it makes sense to use only Mono files with the plugins since the mappings are always carried out from channel 1. It’s the ttable entry that’s responsible for the mapping. The first value is the source channel (0 = channel 1, 1 = channel 2, etc.). The second value is the channel to route to. The third value controls the volume; a value of 0 means 0% volume and a value of 1.0 means 100% volume.
With the new plugin definitions, it’s even easier to balance the speaker levels. The following command will alternate between the front speakers and the center speaker until interrupted:
[darkknight@darkworld ~]$ while [ 1 ]; do /usr/bin/aplay -D front_both -q /usr/share/sounds/alsa/Noise.wav; /usr/bin/aplay -D front_c /usr/share/sounds/alsa/Noise.wav; done
Turn on 800DPI mode for the Logitech MX-510 Mouse
by Mostafa on Aug.27, 2005, under Hardware, How To ..., Linux, Software
5 easy steps:
1. Get and install the Logitech Applet from here or directly from here
2. Install the poper udev rules:
Create a file logitech-mice.rules under /etc/udev/rules.d/ with the following contents:
[darkknight@darkworld rules.d]$ cat logitech-mice.rules
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c00e", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c00f", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c012", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c024", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c01b", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c025", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c01d", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
BUS="usb", SYSFS{idVendor}="046d", SYSFS{idProduct}="c031", PROGRAM="/usr/local/bin/logitech_applet -e -s 800"
Change the file permissions:
[darkknight@darkworld rules.d]$ sudo chown root.root logitech-mice.rules [darkknight@darkworld rules.d]$ sudo chmod 644 logitech-mice.rules && ls -l total 24 -rw-r--r-- 1 root root 146 Apr 13 20:30 10-wacom.rules -rw-r--r-- 1 root root 7406 May 21 05:45 50-udev.rules -rw-r--r-- 1 root root 888 Sep 6 23:12 logitech-mice.rules
3. Modify /etc/X11/xorg.conf as follows to support the thumb buttons:
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "6 7"
Option "Buttons" "7"
Option "Emulate3Buttons" "no"
EndSection
4. Create a script xmouse.sh under /etc/X11/xinit/xinitrc.d with the following contents:
[darkknight@darkworld xinitrc.d]$ cat xmouse.sh #!/bin/bash /usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"
This ensures that the scrolling funtion is correctly assigned to the wheel and not to the thumb buttons.
Make sure that the file permissions are correct:
[darkknight@darkworld xinitrc.d]$ sudo chmod 755 xmouse.sh && ls -l total 16 -rwxr-xr-x 1 root root 1579 Apr 11 13:43 xinput.sh -rwxr-xr-x 1 root root 81 Sep 2 17:36 xmbind.sh -rwxr-xr-x 1 root root 66 Sep 6 23:41 xmouse.sh
5. Reboot (Or simply unplug/re-plug mouse and restart X)
Happy surfing! Got the udev rules from the Ubuntu Forum (modified the PROGRAM line to use logitech_applet instead of lmctl).
Edit [July 30, 2007]: It has been a while since the steps above were posted. The syntax of UDEV rules have changed much since then. The updated rule is (for my MX-510):
$ cat /etc/udev/rules.d/60-logitech-mouse.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c01d", RUN+="/usr/local/bin/logitech_applet -e -s 800"
Device details necessary for writing UDEV rules can be discovered using (substitute /dev/input/mouse1 with path to device of interest):
# udevinfo -a -p $(udevinfo -q path -n /dev/input/mouse1)
Update [19th Nov. 2009]: On Fedora 12 (X.Org X Server 1.7.1), the configuration needed to get the thumb buttons working is:
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "Buttons" "9"
Option "ZAxisMapping" "4 5"
EndSection
It seems that it is no longer necessary to remap the buttons using xmouse.sh.
Custom Keybinding (GNOME)
by Mostafa on Aug.25, 2005, under Hardware, How To ..., Linux, Software
This is useful for multimedia keyboards that aren’t automatically recognized. Also useful when you want actions other that those offered in “gnome-keybinding-properties“. The first step is to check if the buttons are recognized at all. This can be accomplised by running “xev”
$ xev
Once the little window pops up, press any of the buttons and see if you get an output like the following:
KeyPress event, serial 29, synthetic NO, window 0x3c00001, root 0xd6, subw 0x0, time 2073408, (1033,644), root:(1051,745), state 0x0, keycode 231 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 29, synthetic NO, window 0x3c00001, root 0xd6, subw 0x0, time 2073529, (1033,644), root:(1051,745), state 0x0, keycode 231 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes:
If you do get the output, the important thing to note is the keycode (keycode 231 here). Once you have the keycode for a key, you need to define a Key Symbol for it. To do this, you need a xmodmap file. You can get a copy of it using:
$ xmodmap -pke > ~/.xmodmaprc
Once the current map is dumped, open the file for editing and locate the required keycode:
$ vi ~/.xmodmaprc [snip] keycode 231 = [snip]
As we can see there is no symbol associated with the keycode 231 yet. To get a list of available symbols, look at /usr/X11R6/lib/X11/XKeysymDB. Since the button is marked as Refresh, we can use XF86Refresh as a suitable symbol:
[snip] keycode 231 = XF86Refresh [snip]
Once all the required keys have been set, save the file.
To make the new map take effect (in GNOME):
$ gconftool-2 --set "/desktop/gnome/peripherals/keyboard/general/known_file_list" --type list --list-type string "[.xmodmaprc]" $ gconftool-2 --set "/desktop/gnome/peripherals/keyboard/general/update_handlers" --type list --list-type string "[.xmodmaprc]"
At this point you probably need to logout and log back in.
Now, for the case where xev doesn’t already detect the key. Start by tailing the /var/log/messeges file:
$ sudo tail -f /var/log/messages
The last lines of the file will be displayed. Now, press the desired key. Now, you should see something like
Aug 27 13:55:58 darkworld kernel: atkbd.c: Unknown key pressed (translated set 2, code 0x96 on isa0060/serio0). Aug 27 13:55:58 darkworld kernel: atkbd.c: Use 'setkeycodes e016 <keycode>' to make it known. Aug 27 13:55:58 darkworld kernel: atkbd.c: Unknown key released (translated set 2, code 0x96 on isa0060/serio0). Aug 27 13:55:58 darkworld kernel: atkbd.c: Use 'setkeycodes e016 <keycode>' to make it known.
So, as suggested, we make it known by:
$ setkeycodes e016 187
I chose 187 since it doesn’t appear to be used by any key yet. Once all the keycodes have been set, repeat as before to assign the key symbols.
[Edit (Sept. 8, 2005)]
It seems that there is a better way to choose the kernel keycode. We can run getkeycodes to see which keycodes are currently in use. We can use any keycode between 84 and 255 that is not already used.
$ getkeycodes Plain scancodes xx (hex) versus keycodes (dec) for 1-83 (0x01-0x53) scancode equals keycode 0x50: 80 81 82 83 99 0 86 87 0x58: 88 117 0 0 95 183 184 185 0x60: 0 0 0 0 0 0 0 0 0x68: 0 0 0 0 0 0 0 0 0x70: 93 0 0 89 0 0 85 91 0x78: 90 92 0 94 0 124 121 0 Escaped scancodes e0 xx (hex) e0 00: 0 195 196 197 198 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 150 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: 128 159 158 157 155 226 0 112 e0 70: 0 0 0 0 0 0 0 0 e0 78: 0 0 0 0 0 0 0 0
It also seems we need to restore the kernel keycode mapping after every reboot. This is easily accomplished by having the required commands in /etc/rc.local:
[darkknight@darkworld ~]$ cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
setkeycodes e016 187 e015 188 e014 189 e013 190 e005 191
e01e 192 e009 193 e00b 202 e008 194 e018 199
e00a 200 e017 201 e03b 203 e03c 204 e03d 205
e03e 206 e03f 207 e040 208 e041 211 e042 210
e043 212 e023 213 e057 214 e058 215 e064 216
The kernel keycodes are different from the keycodes used by X. So, we need to run xev again to get the keycodes (as seen by X) of the newly found keys.
Got the hints from here.
[End Edit]
Now that we have KeySymbols, what do we do with them? Open up gconf-editor and browse to the key /apps/metacity/global_keybindings. There, choose any of the run_command_* keys marked as disabled and change the value to the desired KeySymbol (e.g. XF86AudioPrev). Then navigate to the key /apps/metacity/keybinding_commands and find the command_* key with the same number as the run_command_*. Change the value of the key to whatever command you wish to be performed when the Previous key is pressed. If you happen to run out of run_command_* and command_* key pairs, simply create new pairs from the right click menu.
Audigy 2 ZS on FC4
by Mostafa on Aug.23, 2005, under Hardware, Linux, Software
I’ve finally got a setup that sounds just as good as it does on Windows. I’ve tested the surround system with a DVD and so far it sounds pretty good. I think the trouble was that there wasn’t any signal generator to let me balance the speakers properly. But today I discovered that there is an alsa subdirectory under /usr/share/sounds that contains a noise file. Playing that in a loop:
$ while [ 1 ]; do aplay /usr/share/sounds/alsa/Noise.wav; done
I finally managed to get that elusive speaker balance through alsamixer. Now, all that’s missing is CMSS3D
This site might be useful.


