Archive

Archive for March, 2007

Bluetooth Headset

March 28, 2007 Pari Leave a comment

1. Build
First download the source btsco-0.5.tgz

tar zxf btsco-0.5.tgz

./configure
make
make install

Compile and install the kernel module. This installs snd-bt-sco.ko in /lib/modules/{kernel_version}/extra/.

cd kernel
make
make install
depmod -e


2. Setup

Load the bluetooth sound module:

modprobe snd-bt-sco

Scan to get the MAC address of headset:

hcitool scan

Connect to the headset:

hcitool cc $HEADSET_MAC_ADDRESS

Start btsco:

btsco -v $HEADSET_MAC_ADDRESS

Automatic startup of btsco

Load the snd-bt-sco module (didn’t work when I put it in modprobe.conf, so I put in rc.local):

echo ‘modprobe snd-bt-sco’ >> /etc/rc.d/rc.local

Then, create a script, btsco.sh, containing:

btsco -v $HEADSET_MAC_ADDRESS > /tmp/btsco.log 2>&1

which you can put in your desktop startup session:

System–>Preferences–>More Preferences–>Sessions
Once the Sessions window comes up, select “Startup Programs”, and “Add” ~/bin/btsco.sh to it.

3. Automating pin feed
Add the following line in the options {} section of /etc/bluetooth/hcid.conf

pin_helper /etc/bluetooth/pin-helper;

Next create executable /etc/bluetooth/pin-helper, with contents:

#!/bin/sh
echo -n “PIN:” ‘cat /etc/bluetooth/pin’

and the file /etc/bluetooth/pin with the your headsets default pin (my headset’s default is 0000), with contents:

0000

NOTE: pin_helper seems to be of no use, it throws the following error in /var/log/messages:

Unknown option ‘pin_helper’ line 26

4. Automatic binding
Modify the file /etc/bluetooth/rfcomm.conf. This is my rfcomm.conf:

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device HEADSET_MAC_ADDRESS;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment “iTech Clip IIe”;
}

5. Misc
List your bluetooth dongle:

hcitool dev

Categories: Linux

Transcode

March 27, 2007 Pari Leave a comment

I just needed a way to shrink a video 640×480 video to 320×240 using command line, and found transcode. A really powerful command line tool for video editing on Linux.

transcode -F mpeg4 -y ffmpeg -Z 320×240 -E 44100,16 -i video.mpg -o video-small.mpg

Update: here’s an article on it on Linux Journal.

Categories: Linux

Ubuntu chroot

March 22, 2007 Pari Leave a comment

If you need a 32-bit linux test bed on your 64-bit Ubuntu Gutsy (without resorting to vmware), it’s quite easy to create a 32-bit Ubuntu chroot inside a 64-bit Ubuntu.

This will create a complete base installation of Ubuntu Gutsy 32-bit under /ubuntu32:

apt-get install schroot debootstrap
mkdir /ubuntu32
debootstrap –arch i386 gutsy /ubuntu32

That’s it. You have a fully isolated 32-bit linux file system (chroot jail) you can use. To login:

sudo chroot /ubuntu32

FYI, if you leave out the “–arch i386″, the architecture will default to the host systems architecture.

Additional

# Setup your sudo account
cp /etc/sudoers /ubuntu32/etc/.
chroot /ubuntu32
groupadd -g 110 admin
useradd -G admin -m your_user_name

# Select timezone
tzselect

# Set your locale
locale-gen en_US.UTF-8

Permissions

To give permission to users to use the chroot’d environment – add the following in /etc/schroot/schroot.conf:

[ubuntu32]
description=Gutsy 32-bit
location=/ubuntu32
users=user1, user2
aliases=default, sandbox

To login as a user:

# Using alias
schroot -c sandbox

# or default alias
schroot

Extra Packages (optional)

# First copy your apt sources and update
cp /etc/apt/sources.lst /ubuntu32/etc/apt/.
chroot /ubuntu32
apt-get update

# Development environment
apt-get install gcc make automake autoconf libtool binutils gdb libc6-dev libncurses5-dev flex bison m4

# Extra
apt-get install vim-runtime lynx

Categories: Linux

Tomato on Buffalo WHR-HP-54

March 17, 2007 Pari Leave a comment

Just got my Buffalo WHR-HP-54 from Newegg yesterday, and today… I flashed it with Tomato firmware. I also found it to be much better and more intuitively designed than OpenWRT.

Here are the steps:

  1. Open a terminal keep this command ready (DO NOT PRESS ENTER). Note that 192.168.11.1 is the default IP of the Buffalo router:
    tftp -v -m binary 192.168.11.1 -c put tomato-firmware.trx

  2. In another terminal ping the router:
    ping 192.168.11.1

  3. Then unplug the router.
  4. Wait 5 secs and plugin the router again and wait for ping to resume.
  5. Then immediately (within say 3 pings) pressed enter on the above tftp command.
  6. The pinging will stop and the tftp command will finish in less than 1 second. The router will reset itself, and it will reboot. This will take about 1-2 minutes. So do not disturb the router for at least 2 minutes.
  7. Then in browser goto 192.168.1.1.

That’s it! you should be able to see the Tomato screen.

Categories: Linux