Bluetooth Serial Port To NXT in Linux

Posted by Tony Buser Sun, 22 Oct 2006 17:23:00 GMT

I finally got around to playing with the NXT in linux with ruby-nxt. Since ruby-nxt currently only supports a serial port connection (hopefully a native bluetooth module will be ready soon), you have to use rfcomm to setup a serial device. Here's how you do it (using ubuntu 6.06 and a linksys usb adapter)...

First you have to find the mac address of your NXT with the following command:

abuser@wraith:/etc/bluetooth$ hcitool scan
Scanning ...
        00:16:53:04:B3:46       NXT

Then sudo vim /etc/bluetooth/rfcomm.conf and add an entry like this:

rfcomm0 {
        bind yes;
        # Bluetooth address of the device
        device 00:16:53:04:B3:46;
        # RFCOMM channel for the connection
        channel 1;
        # Description of the connection
        comment "NXT";
}

Then restart bluetooth with a sudo /etc/init.d/bluez-utils restart.

Then to verify it's setup, run rfcomm and you should see output like this:

abuser@wraith:/etc/bluetooth$ rfcomm
rfcomm0: 00:16:53:04:B3:46 channel 1 clean

You should now have a /dev/rfcomm0 that you can use with ruby-nxt. The first time you run a ruby-nxt program, it might pop up a message for the PIN, just enter 1234.

If you want to setup a connection FROM the NXT to your computer, (where your computer is a slave to the NXT where you can send BT messages from a program running on the NXT to your computer) follow these instructions.

Similar instructions for windows here and osx here.

mod_fcgid Slow Startup on Ubuntu Fix 1

Posted by Tony Buser Fri, 28 Jul 2006 01:20:00 GMT

I recently switched to using modfcgid instead of modfastcgi. So far its nice and fast... except for the first hit after a period of inactivity. This is because fcgid kills off idle processes and it takes an annoyingly long time to start one up on this server. It turns out there is an option to set a minimum number of processes, however the version of mod_fcgid on Ubuntu Breezy doesn't have it. Here's how I installed it:

sudo apt-get install apache2-dev

Download mod_fcgid 1.09 or greater

Edit it's Makefile and change top_dir = /usr/share/apache2

make

cp .libs/mod_fcgid.so /usr/lib/apache2/modules

Edit /etc/apache2/mods-available/fcgid.conf and add a line that says DefaultMinClassProcessCount 3 and restart apache.

The first hit after a restart will be slow, but from then on it will maintain at least DefaultMinClassProcessCount processes.

Installing Gentoo x86_64

Posted by Tony Buser Mon, 10 Jan 2005 01:44:13 GMT

I just spent the better part of the weekend trying to get Gentoo installed on my new-ish computer. I wanted to try out a good 64bit OS. (WindowsXP64 beta being a nightmare) I primarily use Mandrake at work, but I read Mandrake wasn't that great on amd64. (note: I like Mandrake, so sue me. I wouldn't exactly call myself a linux guru, but I have been using it for over 10 years (woah, has it been that long) since the days of downloading slackware disks off a BBS) Fedora installed relatively easily, but I wasn't too impressed with it. I'd played with Gentoo in the past and I really missed it, unfortunately despite Gentoo's awesome documentation I had a hell of a time getting it to install on this system (the LiveCD didn't detect the sata hard drive or the onboard nic). Right now I'm sitting happily in a super fast (glxgears running at a whopping 13,900 fps! -that wasn't a typo) slick Gnome desktop while emerge --update world compiles in the background. I wanted to write it all down for my own records before I forget what I had to do to get it working. Here's a basic rundown of my system:

MSI K8N Neo Platinum Motherboard (NFORCE3-250) AMD Athlon 64 3200+ Western Digital 10,000RPM 74gig Serial ATA (WDC WD740GD-00FL) nVIDIA GeForce 6800 1gig ram

First, we'll get the install to see the drives, etc and get the right kernel options going...

The first two major problems were getting the damn thing to see the hard drives and the nic. The modules required are satanv and forcedeth (for the nic). However Gentoo wasn't smart enough to do that automatically. Most resources I found said to just run "modprobe satanv" and "modprobe forcedeth", however these commands would just lock up. Finally I found that when you boot the livecd you have to type "gentoo noapic" at the boot prompt. Once I did that, I was able to load those modules with modprobe.

So then I went about installing Gentoo, decided to use the universal live cd and just go with a stage3 install so I wouldn't have to compile everything. The next mistake I made was using the genkernal option to compile my kernel. Doing that means linux will not be able to see the sata drive because you have to compile the sata_nv into the kernel and not as a module. So you have to compile the kernel manually and enable the following options (into the kernal not as modules, I decided to compile the nic in as well, but that could be a module if you want):

cd /usr/src/linux mv .config .config-old make clean make menuconfig

Device Drivers ->

SCSI device support -> SCSI low level drivers -> < *> Serial ATA (SATA) support < *> NVIDIA SATA support

Networking support -> [*] Network device support Ethernet (10 or 100Mbit) -> < *> Reverse Engineered nForce Ethernet support (EXPERIMENTAL)

Turn on sound card support, but don't enable anything under Advanced Linux Sound Architecture or Open Sound System. (we'll be using gentoo's alsa-driver package later)

Sound -> Sound card support

I haven't actually tried this with anything yet, but the board has it...

IEEE 1394 (FireWire) support -> < *> IEEE 1394 (FireWire) support

I haven't been able to get the fancy frame buffer console working though, I keep getting vesafb0 error -6 even though I enabled the following...

Graphics support -> < *> VESA VGA graphics support Console display driver support ---> [*] Video mode selection support < *> Framebuffer Console support

Apparently Gentoo complains unless you enable devfs under...

File systems -> Pseudo filesystems -> [*] /dev file system support (OBSOLETE)

Also make sure you have ext2 and ext3 enabled, but I think that was on by default and I removed reiserfs. I'm pretty sure that was everything. Finally, compile your kernel. (one nice thing about doing your kernel manually is that it compiles a LOT faster then genkernel since you're only doing the bare minimum, boots faster too)

make && make modules_install mount /boot (note: I decided to go with basic suggestion of having a seperate boot partition) cp arch/x86_64/boot/bzImage /boot/kernel-2.6.9-custom vim /boot/grub/grub.conf (can't believe base gentoo doesn't come with vim, so emerge vim first, stupid nano)

Put the following in grub.conf, note! the noapic option. Here's my partition scheme:

/dev/sda1 = windows xp /dev/sda2 = /boot /dev/sda3 = swap /dev/sda4 = /

default 0
timeout 30
splashimage=(hd0,1)/grub/splash.xpm.gz

title=Gentoo 2.6.9
root (hd0,1)
kernel /kernel-2.6.9-custom root=/dev/sda4 noapic

title=Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1

Next, we'll get that sweet Geforce 6800 working with xorg-x11...

This was a lot easier, but I still ran into a hell of a problem getting the damn acceleration working. I also found a neat thread on the forums that increased my glxgears fps test from about 8,000 fps to almost 14,000.

emerge nvidia-kernel emerge nvidia-glx

Add a line that says "nvidia" to /etc/modules.autoload.d/kernel-2.6. And run "modules-update". Then run "modprobe nvidia".

Edit /etc/modules.d/nvidia and uncomment the line that says: options nvidia NVregEnableAGPSBA=1 NVregEnableAGPFW=1

xorgconfig made an xorg.conf that loaded fine, but glxinfo would complain about "Error: couldn't find RGB GLX visual". Turns out it requires you to add a DefaultDepth of at least 16 in the Screen section of /etc/X11/xorg.conf. Here's a snip of the changed settings I made and what I did to get the scroll wheel on my intellimouse to work:

Section "Device" Identifier "Card0" Driver "nvidia" VendorName "nVidia Corporation" BoardName "Unknown Board" BusID "PCI:1:0:0"

Option "NvAGP" "2" Option "NoLogo" "true" Option "RenderAccel" "true" Screen 0 EndSection

Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 16 SubSection "Display" Depth 16 Modes "1280x1024" "1024x768" "800x600" "640x480" EndSubSection EndSection

Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/mouse" Option "Buttons" "5" Option "ZAxisMapping" "4 5" EndSection

Now to get sound working...

I basically just followed the Gentoo alsa docs. The built in sound on this motherboard is an intel8x0.

In /etc/make.conf add alsa and oss to your USE. Also add a line that says: ALSA_CARDS="intel8x0"

emerge alsa-driver emerge alsa-oss emerge alsa-utils

Add the following two lines to /etc/modules.d/alsa:

alias snd-card-0 snd-intel8x0 alias sound-slot-0 snd-card-0

Run the following commands:

rc-update add alsasound boot /etc/init.d/alsasound start amixer set Master 100 unmute amixer set PCM 100 unmute amixer set Center 100 unmute amixer set Surround 100 unmute

IBM Linux Commercial: Prodigy

Posted by Tony Buser Fri, 10 Oct 2003 16:58:30 GMT

60x60_prodigy.jpg I saw this awesome Linux commercial the other day and went looking for it. Unfortunately IBM's webpage seems to have a javascript error and I can't download it. Luckily someone* archived a copy. True, it's not quite not quite the Linux version of Apple’s 1984, but it did make the hair on the back of my neck tingle. (and it still does everytime I watch it)

UPDATE: Turns out the original wouldn't open in linux, oops! Lucas was able to convert it to a DivX/FFmpeg MPEG-4 format. If you had trouble downloading the original, try this one instead. It's also about half the size. :) I was able to play it in mplayer, xine, and totem: Click here to download it. (3.5M)

If you're on windows, this will mean you'll need the DivX codec. There's a link to download the free edition from this website.

Thanks Lucas. Use my link to download it, don't kill his poor .Mac account. :)

I Love Perl Thong

Posted by Tony Buser Mon, 30 Jun 2003 18:59:18 GMT

PerlMonks Store > I Love Perl Thong | Powered by CafePress.com - hehe, the back side says "use strict;" ;)

Mandrake 9.1 BitTorrent Download

Posted by Tony Buser Wed, 26 Mar 2003 13:31:19 GMT

Mandrake 9.1 is out. Lots of new features. 3 CDs is big download (1.9 gig), so if you'd like to download it, I'd suggest using BitTorrent... If only to help my download go faster. :) Raph Levien has started a torrent. The more people that use it, the faster the download. So download and install BitTorrent and start the download of Mandrake 9.1 here. And do us all a favor and leave the BitTorrent window open for a while after you finish downloading to help others. My download is currently at 90k and rising. Much better then fighting the clogged ftp mirrors!

Amusing Spam

Posted by Tony Buser Mon, 24 Feb 2003 00:17:07 GMT

Believe it or not I get well over 1000 spam emails a month. I've been on the internet too long and have been way too careless about how and what I register for. I mean I've been using the same email address for the past 8 years. I must be on every single spam list on the planet by now. Thank god for programs like Spamassassin, Vipul's Razor, and DCC. With them I usually only get maybe 1 or 2 spams in my inbox a day. Unfortunately with all this protection I occasionally miss out on real gems of stupidity. Today I was going through my filed spam to make sure it didn't catch anything I wanted when I found the following product that claims to:

* Reduce the amount of sleep you need * Cause wounds to heal faster * Lose weight while your sleeping * Become less winded when excersizing * Put color back in grey hair * Grow hair back where it had once fallen out * Tighten skin * Strengthen bones * Body builders - use this to build your muscles quicker .........The List truly goes on and on.......... As seen on NBC, CBS, CNN, and Oprah! The health discovery that actually reverses aging symptoms without dieting or exercise! This PROVEN FDA approved discovery has been reported on by the New England Journal of Medicine - don't just take our word for it.

Holy shit! Seriously, it does all that. Who believes this stuff? Oprah does, so it must be real right? All it needs to do is copy DVDs and give you a free college degree and I think it would do what every spam claims all in one.

HOWTO Encourage Women in Linux

Posted by Tony Buser Sat, 22 Feb 2003 22:12:04 GMT

I was searching for information on recording and cleaning up an old vinyl record into mp3 on linux. So I did a search for "linux vinyl howto" which yielded this gem: HOWTO Encourage Women in Linux. heh, eventually I did find some better information. If anyone has some advice on audio processing to remove hiss and pops from recordings on linux. Please let me know.

Prelude RPM Dependencies Suck

Posted by Tony Buser Sat, 22 Feb 2003 02:43:05 GMT

I'm running Mandrake 9.0 on my firewall at home and I remember it installed Prelude by default. I always figured I'd check it out later and left it running figuring it wouldn't hurt anything. I like snort and use it at work so I figured I'd just get rid of prelude. So I went to uninstall it and this is what I got:

[root@gr0k bin]# rpm -e prelude
error: removing these packages would break dependencies:
        prelude = 0.4.2-7mdk is needed by prelude-report-0.4.2-7mdk
[root@gr0k bin]# rpm -e prelude-report
error: removing these packages would break dependencies:
        prelude-report = 0.4.2-7mdk is needed by prelude-0.4.2-7mdk

Uhmmm... huh? It's times like these I really miss debian.