About Unix and Linux

Thursday, March 30, 2006

hotplug usermap file format

A sample file is here.

# script match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi
# bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass
# bInterfaceSubClass bInterfaceProtocol driver_info
perf 0x0003 0x04b4 0x8613 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
perf 0x0003 0x06cd 0x010b 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

match_flags tells the hotplug usb agent what to match for to
run the script.

match_flags for the various fields are
idVendor:0x0001
idProduct:0x0002
bcdDevice_lo:0x0004
and so on

so if I needed to match the idVendor & idProduct only with
what is there match_flags needs to be 0x0001 + 0x0002 = 0x0003

So if the necessary fields match the script named "perf"
will be called.

DMA for HDD

hdparm -i /dev/hda

check the dma line and make sure that DMA is on. If not try setting it to DMA by doing

hdparm -d1 /dev/hda

If that doesn't work it is probably because the driver that controls IDE chipset(which accesses the HDD) is probably the generic IDE driver. Find out the IDE chipset details and try to compile the driver into the kernel(not as a module). Having DMA is the like the difference between night and day. KDE startups and runs smoother. Video capturing works like a charm without dropping frames.....

Wednesday, March 29, 2006

NTP time synchronization debian

apt-get install ntp-server ntpdate

ntpdate can set the current time based on information from NTP servers. ntp-server actually syncronizes the current clock with other NTP servers.

Dell Axim X30 sync in Debian

apt-get install synce-kde synce-serial synce-dccm

Download the kernel driver from http://synce.sourceforge.net/tmp/kernel-2.6-driver.tar.gz

as non-root
tar zxvf kernel-2.6-driver.tar.gz
edit the Makefile and change
LINUX_SOURCE_PATH := /usr/src/linux-$(shell uname -r)
to
LINUX_SOURCE_PATH := /usr/src/kernel-source-$(shell uname -r)
make
(root)
make install
modprobe ipaq.ko

Saturday, March 25, 2006

Getting sound to work on debian

I had installed alsa but on doing a alsaconf I found that the sound card wasnt being detected. lspci had listed the card as unknown. Looking up the vendor/card id database online I found the card description which I used for looking up the sound card list at http://www.alsa-project.org/ . This was listed with some special compilation instructions. So I downloaded the lasted driver(1.0.10) from the website and did the following

cd /usr/src
mkdir alsa
cd alsa
cp /downloads/alsa-*
bunzip2 alsa-driver-1.0.10
tar -xf alsa-driver-1.0.10
cd alsa-driver-1.0.10
./configure --with-cards=hda-intel --with-sequencer=yes;make;make install

Then running alsaconf it detected the card and configured it. A final word on permissions. The alsa driver creates /dev/dsp and /dev/sequencer but the files have permission 660(rw-rw---)
which means that normal users cannot access it. The user needs to be added to the 'audio' group for sound to work. This is done by logging in as root and doing
gpasswd -a user-name audio

Friday, March 24, 2006

Compiling kernel in debian

cd /usr/src/kernel-src-2.6.8
make-kpkg --rev Custom.1 kernel_image

this will create a kernel-src-2.6.8-Custom.1-386.deb. To install the kernel
dpkg --install /usr/src/kernel-src-2.6.8-Custom.1-386.deb
See that there are atleast two kernels present. One the original one which came with the distro and the new one that we have just installed. The original one can be used if the new one doesn't boot for some matter. Reboot. If the kernel doesnt boot, boot into the original kernel and then
cd /boot
mkinitrd -o initrd.img-2.6.8-386 2.6.8

add the following line in /boot/grub/menu.lst

initrd /initrd.img-2.6.8-386

just after

kernel /vmlinuz-2.6.8 root=/dev/hdaX ro

This might solve the problem. Even if there is no problem I find that having the initrd seems to help. I found that when making minor changes to drivers make-kpkg wasnt building the code and packing the modules. so I had to do a "make" before make-kpkg. Usually make-kpkg takes a long time only the first time. After that it is decently fast.

ieee 1394 capturing with kino in debian

modprobe raw1394
modprobe dv1394

check if /dev/raw1394 and /dev/dv1394 files exist. If no create them as follows

mknod -m 666 /dev/raw1394 c 171 0
mknod -m 666 /dev/dv1394 c 171 32

start up kino. Goto Edit ---> Preferences --> IEEE 1394

In DV Capture
Select dv1394 for driver and /dev/dv1394

Monday, March 20, 2006

Compiling kernel in FreeBSD

cd /usr/src/sys/i386/conf
cp GENERIC MYKERN
vi MYKERN <--- edit MYKERN file for other options. In addition change the ident option from GENERIC to something else like MYKERNEL
config MYKERN
cd ../compile/MYKERN
make cleandepend;make depend;make;make install

Apparently there is a newer way to do this
cd /usr/src
make buildkernel KERNCONF=MYKERN
make installkernel KERNCONF=MYKERN

Sunday, March 19, 2006

Installing FreeBSD 6.0

The CDs for the installation can be created from ISO images available here

ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.0/

Download the 6.0-RELEASE-i386-disc1.iso and 6.0-RELEASE-i386-disc2.iso files. I didn't have any burning software for Windows and since I had FreeBSD 5.3 I thought I'd try using tools in that instead. Took me a while to hunt down the cd writing software in the ports package(sysutils/cd-write). After installing that I tried cdrecord but it didnt report any recordable devices when used with

cdrecord -scanbus

I read somewhere about burncd and tried that

burncd -f /dev/acd1 data /tmp/6.0-RELEASE-i386-disc1.iso fixate

The fixate option is important otherwise the CD wouldnt boot.
Installation is pretty straightforward. The only crib I had was that there was no progress bar. The screen would say Installing XX package YYYZZZ bytes at XYZ KB/s. What use is this for people installing from a local CDROM. The other thing was that I had configured for KDE installation but when the installation completed and the system came up I couldn't start KDE. KDE wasn't installed. I was almost starting to install KDE from the ports directory when I remember the sysinstall command a guy had told me about. This is the same program that is used during initial installation phase too. Insert the 2nd CD into the CD drive. Run the sysinstall command and check the "Install from CD" button. Select the packages to be installed and click Install. Took more than an hour to install all the packages. If there was a progress bar I could atleast have done something else in the meantime instead of just waiting for the thing to finish. This is one area that FreeBSD lags behind other Linux Distros. Some useful tips.

startx starts the X windows environment. To get kde to start type
echo exec startkde > ~/.xinitrc
and then run startx.

To configure DHCP on an interface at startup have the following line in /etc/rc.conf ifconfig_xl0="DHCP"
where xl0 is the name of the interface

One thing that surprised me was that KDE ran slow. Had never had this problem before. Previous versions of KDE in FreeBSD and Linux were decently fast. Now the GUI was slower than Windows. Other than that KDE (3.4) is excellent. The KDE people seem to be getting their act together. Icons, Fonts, Menu/windows styles look very professional.

Update : I installed GNOME and that too was slow!!!!. The first time that this was something related to my configuration was that GNOME gave a "couldn't lookup hostname do you still want to proceed" dialog. After adding the following line to rc.conf
hostname="home-desktop"
and rebooting it setup the hostname correctly. However only after adding a line to /etc/resolv.conf did things improve considerably.
192.168.0.2 home-desktop home-desktop.homenet
This is kind of strange since we get the IP address via DHCP and yet we have to plug in the ip-hostname map for name resolving to work. Now KDE and GNOME fared much better

Friday, March 03, 2006

Experimenting with the Westell 6100

My setup at home is

Desktop(192.168.0.2) <--> Wireless router/hub(192.168.0.1) <---> Westell 6100 (dsl modem , 192.168.1.1) <--------> ISP

Goto the modem page by typing http://192.168.1.1. Enter the modem username and password. Goto Configuration ---> VC Configuration. Normally there would be only one VCI enabled with protocol PPPoE. Click the Edit button for that VCI. For VC 1 configuration change Protocol from PPPoE to Bridge. This basically means that the Westell 6100 just acts a modem to the ISP without actually using PPPoE(which is needed for the internet connection setup). Click Save. A popup asks whether you want to reboot the modem. Click yes. The modem reboots and comes up and the Internet light doesnt come on. My goal was to run a PPPoE server on my desktop to see if I could connect to the net that way. I downloaded and ran the Roaring Penguin PPPoE client for Linux. Nothing!!!. What the PPPoE client actually does it to broadcast an ethernet packet to which PPPoE servers respond. It looked like the wireless router I had wasn't forwarding the broadcast out onto the broadband side of the LAN. So I connected the Desktop directly to the Westell 6100 and reran the PPPoE client. Connected!!!. Still I couldn't browse. An "ifconfig" showed that PtP link had been established. Howevere a "route print" showed that the default route wasn;t set to the ip address of the other side of the PtP link(10.1.25.1). That was done by a simple

route add default gateway 10.1.25.1

Still attempting to ping www.google.com or www.yahoo.com failed. I had had the ip address of the google server by chance from a previous ping so I tried that and it worked. That means that there was a problem with the DNS lookup. A google search revealed that the DNS server ip address is negotiated along with the PPP connection and could be found in the /var/run/ppp/resolv.conf file. Alternately a "tail -f /var/log/messages" showed the DNS server ips when the PPP client connected. Placed those ip addresses in the /etc/resolv.conf file and then everything worked fine. I still havent figured out how to automate this though(setting up routes, dnc etc). I disconnected the session and connected the desktop back to the wireless router. While checking the configuration of my wireless router(http://192.168.0.1). I came across the question "Does your Internet connection require you to login ? Yes, No" . I check the "Yes" box typed in the ISP username/password and saved the configuration. When the wireless router came up I was able to access the net again. So this time the wireless router had setup the PPPoE connection.