31/12/2007

Ndiswrapper and WPA in a (nut)shell

Say hello to Hactar: cheap office PC (presumably AMD Sempron and some or other chipset) gracing my parents' WPA1-encrypted network via a Siemens Gigaset 108 USB WLAN adapter. The Gigaset is supposed to have an atheros chip, but apparently madwifi cannot handle USB devices yet, so it had to be ndiswrapper. Network cards set up with ndiswrapper don't seem to show up in Yast without effort, so I did it quick n' dirty in a shell.
Note: the ndiswrapper wraps Windows drivers compliant to the Network Driver Interface Specification for use under Linux. The following HowTo is in part taken from openSuSE.

You need the packages ndiswrapper, wpa_supplicant, dhcpcd (all in SuSE distro), and the Windows driver from the installation CD (net5523.inf worked for me).
Do the following in a root shell (in whatever directory you copied the Windows drivers to):
# ndiswrapper -i net5523.inf (install)
# ndiswrapper -l (list drivers, you should get the net5523 here)
Now plug in you WLAN adapter.
# modprobe ndiswrapper
See if you find a wlan0 entry in the ouput of the following lines, note the missing configuration data in iwconfig.
# dmesg
# iwconfig
Scan for available networks:
# iwlist scan
Create a configuration file
# vi /etc/wpa_supplicant.conf
containing this (with the appropriate ESSID and PSK key):
network={
ssid="networkname"
scan_ssid=1
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
psk="mypsk"
}

The next lines do the actual network setup by starting the adapter, setting up the network configuration with wpa_supplicant and getting an IP with dhpcd (if you want a fixed IP, set it with ifconfig). As this is the part to do after every boot, I copied all this to a shell script.
# ifconfig wlan0 up
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
# dhcpcd wlan0


I suppose you can put all this in a startup script in /etc/init.d, but by this time my vacation was up.
BTW, the ndiswrapper module has to be reloaded after a kernel update with modprobe ndiswrapper. I put it also into the shell script (first line), just in case.
A nice overview over network-related shell commands can be found at Wirelessdefence.org.

07/12/2007

HowTo automount external ntfs-formatted USB hard drives with write permissions for normal users AND the correct locale...

To automount your hard drive with write permissions, first backup your fstab.

su
cp /etc/fstab /etc/fstab.bak

Then plug in your drive and give it write permissions in ntfs-config. This puts and entry in fstab, which effectively prevents HAL from automounting the drive. So you need to replace the new fstab with your backup. Then unmount your drive.

cp /etc/fstab.bak /etc/fstab
umount /dev/sdXY

If you now try to mount your drive in Konqueror with right-click --> Mount, it should give you an error message. Now edit your /etc/PolicyKit/PolicyKit.conf and put in any users or UIDs who need to be able to mount the drive.
<config version="0.1">
<match action="hal-storage-mount-removable-*">
<match user="taaris|1001">
<return result="yes">
</return>
</match></match>

Then reload the settings.

polkit-reload-config

If you now plug in your drive or mount it in Konqueror, it should be mounted with read/write permission for everyone.


To mount it (and everything else you mount with ntfs-3g as well) with the correct locale, you need to replace /sbin/mount.ntfs-3g with a small bash script.

su
mv /sbin/mount.ntfs-3g /sbin/mount.ntfs-3g.bak
touch /sbin/mount.ntfs-3g
echo '#!/bin/bash
/bin/ntfs-3g -o locale=de_DE.UTF-8 $1 $2' > /sbin/mount.ntfs-3g
chmod +x /sbin/mount.ntfs-3g

Sources (info, not code!) can be found here and here.

04/12/2007

HowTo (almost) synchronize your Motorola RAZR V3 with KAddressBook

Enable bluetooth. YaST --> Hardware --> Bluetooth

Then plug in your dongle, kbluetooth should start automatically and settle into your systray. Right-click on it and select "KBlueMon". Enable "FindMe" mode ("Sichtbar" in German) and start scanning.

To put new ringtones (32 kbps/22kHz for mp3s is definitely enough) on your phone, right click on KBluetooth again, then select "Send File". Find the file you want to send, select your phone and click "Send". Wow, that was easy ;-)

To bind your phone to a device node (eg. to use in kitchensync or kmobiletools), first figure out its MAC address by

hcitool scan

then configure rfcomm by editing your /etc/bluetooth/rfcomm.conf file and putting in an entry like

rfcomm0 {
bind yes;
device 00:12:8A:A3:70:34;
channel 1;
comment "taaris RAZR V3";
}

now you can either reboot, or bind manually

rfcomm bind all

then create the device node, if you don't have it already

mknod /dev/rfcomm0 c 216 0

Now get the permissions sorted out. Create a group called phone and put yourself (and anyone else who's going to access your gadget) in it. Restart your session.

chgrp phone /dev/rfcomm0 (you might have to repeat this if you cannot access the device anymore after a reboot)
chmod 660 /dev/rfcomm0

To give credit where it's due, most of this info was found here.

Now you can configure kmobiletools to use with your RAZR V3. Not that this is really helpful at the moment, since you cannot actually synchronize your phone just yet - but let's hope for KDE4 and KDEPIM.

launch kmobiletools
Settings --> Main Settings. The Configure dialog will pop up.
nnder Devices set:
'Mobile phone device': /dev/rfcomm0
Leave other settings at defaults.
Under Mobile phone set:
'Phone type': Generic GSM device
'Dialing options': CKPD dial System
Select the 'Use Motorola battery indicator' check box.

Then go to Settings --> Reinitialize GSM Device.