Archive for the 'Sophos' Category

The Quick Brown Fox…

So, I didn’t participate in Firefox 3 Download Day because I wasn’t available for long enough to wait for Firefox to compile.  Oh well; 4,257,614 others from the US did, so I think I’m covered.

Here are my initial impressions.

Continue reading ‘The Quick Brown Fox…’

Remotely Obtaining emerge Progress

I’m quite glad that I installed Gentoo onto Sophos. The system is far cleaner now, and I can easily keep it updated. I cheated a little bit and used binaries for some of the larger programs (like Firefox), but the system is running quite smoothly. I’m compiling Enlightenment (DR17) as I write this.To prevent the system from being slowed down by the VESA framebuffer, I output logs of emerge instances. For example, to compile Enlightenment, I ran emerge -v e > log 2> errorlog. While I don’t usually get much output on the errorlog file (a bunch of “>>> Regenerating /etc/ld.so.cache” messages), the log stores all of the compilation information. However, I wanted a way to quickly tell which package I was compiling, from a remote location (namely, my main computer). So, I wrote a quick script to find out.

#!/bin/bash
 
if [ -e ./log ]; then
        LOGFILE='log'
else
        LOGFILE='$1'
fi
 
NUM=`cat $LOGFILE | grep '>>> Emerging' | tail -n 1 | cut -d( -f 2 | cut -d) -f1`
NAM=`cat $LOGFILE | grep '>>> Emerging' | tail -n 1 | cut -d  -f6`
 
echo "Current Package: $NUM : $NAM"

The script looks to see if you have a file named log in your current directory. If you don’t, it takes an argument from the command line. Feel free to add elif statements to include other directories and files (e.g. /root/log, /var/log/package_emerge.log, etc.). It’ll output something like this:

sophos ~ # progress
Current Package: 20 of 23 : x11-libs/ecore-9999

And that’s all there is to it. It’s a very simple script, but it gets the job done.

Updates to Sophos

So, I’ve decided to scrap Slackware and install Gentoo on Sophos. Although Slackware is extremely flexible (and generally a good choice for a stable OS), I feel that the system will perform better with a proper Gentoo installation. Slackware’s package manager is driving me mildly insane, too.

I installed Enlightenment (DR17) onto Sophos with little expectation that it would run well. The processor is only 800MHz, the graphics card is only partially supported, and the system only has 256MB of RAM. Much to my surprise, though, all animations were smooth and I even got fancy stuff like the drop shadow working. Enlightenment is a really well-designed window manager. I really wish that Compiz Fusion will adopt many of its algorithms for working with windows.

But, I digress. I liked Enlightenment so much that I decided to plan for two accounts in the Gentoo installation. The standard account will start up with just a full screen instance of Firefox. There will be no window manager (saves loading time). The web-based interface will then be loaded. However, there will also be a second account for regular use (although I don’t know how useful a touchscreen will be). That account will start up with Enlightenment.

I’m also planning to redesign the user interface. I think that I’m going to get away from having so many boxes and things. It just makes the design too complicated. I’m going to keep the email box and the weather box. Then, I’ll stick the stations box on the bottom of the screen and I’ll make the station links larger so that it is easier to tap on them. I’ll make a mockup soon.

I’m also thinking of building an IR receiver so that I can use a remote control with Sophos. It should be easy enough to do. I’ve found numerous instructions on the web. The only real issue that I can see concerns obtaining the IR receiver. I don’t know what the local RadioShack has.

Oh, and by the way, I figured out how to hook Sophos up to my stereo. So, I think I’ll place it beside the stereo. I might need to find a quieter CPU fan, though. It’s running at around 4000-5000 RPM, so it’s somewhat detectable.

Fun with Laptop Keyboards

After doing some research, I discovered a general method for hooking a laptop keyboard up to any computer using a PS/2 port. It is possible to think of a “keyboard” (as in a keyboard for your desktop computer or something) as having two major elements: the keyboard matrix and the keyboard controller. The keyboard matrix consists of a circuit board (either like a traditional PCB or flexible, depending on the keyboard), the keys, and the materials to make the keys make a connection on the board. Some keyboards use a rubber sheet or a bunch of rubber buttons to make the connections. Others use a scissor technique. The keyboard controller takes input data from the keyboard matrix and converts it to a set of instructions readable by computers. Laptops have keyboard controllers built into their motherboards. However, external keyboards have keyboard controllers in the frame of the keyboard itself. For example, I have a PS/2 keyboard that I use for Sophos right now. After taking it apart (held together by 17 screws in all), I discovered that the matrix pinout consisted of two flat cables (well, actually, they were part of the plastic sheet that constituted the matrix) with brush-style mylar connectors that connected to the keyboard controller.

Once I find a suitable controller, setting up the keyboard should be a snap, with two small exceptions.  First, I will have to remap the keys, as I doubt that many of the keycodes will be correct.  Second, actually connecting the keyboard to the controller will be a bit of a challenge.  I’m thinking of etching out a copper tracing using PCB and clamping it to the ribbon cable and also to the keyboard controller.  This might be the only way.  However, I’ll see if I can find a pre-made clamp first.

Gentoo is Up and Running.

After installing well over 3000 different packages from Portage, I finally have a usable Gentoo installation. I finally decided on a partition scheme like this:

  • /dev/hda1 – /boot – EXT2 – 100MB
  • /dev/hda2 – SWAP – SWAP – 1GB
  • /dev/hda3 – / – Reiser4 – 159GB or so
  • /dev/hdb1 – /mnt/xp – NTFS – 10GB
  • /dev/hdb2 – /mnt/vista – NTFS – 50GB
  • /dev/hdb3 – /mnt/share – NTFS – 97GB

As for my USB drives, I’ve got two right now. I borrowed a 320GB drive so that I could back up all of my data and selectively copy it over to my new system. I also have an 80GB drive, which I will use for system backups (I’ll get to that in a second).

So, I decided to make hdb3 an NTFS partition because I wanted a partition that I could use to back up all of my files in my home directory and also so that I could store music, videos, and other things that I want to share between Linux and Windows. This was the best way to do that.

I have read numerous warnings about the dangers of Reiser4. I have also read documents that stated that XFS was much better. But, some of the benchmarks are absolutely fantastic. And, even better, Reiser4 is modular, so it can be easily updated to make it even faster. So, I decided to go with it. But, I don’t intend to just leave my data to the whims of a single file system. I intend to keep at least two or three copies of my most important data on different filesystems and different drives at all times. But, that’s not all.
I’m going to design my own backup system. At its core, it will be very simple. Although there may well be nothing wrong with the backup systems that only update changed files, I don’t really feel secure unless I copy the entire file directory over. Considering that my most important files can be condensed down to a couple of gigabytes, I’m just going to use a bzipped tar backend. Every week, a Python script will launch and ask me to backup my data. At this point, it will copy my entire home directory (minus the VirtualBox virtual machines) and copy it to /mnt/share. I call this type of backup a “Stage1″ backup. I suspect that I’ll keep around 5 revisions at a time.

The “Stage2″ backup is a little more interesting. Every 3 weeks or so, the script will ask me to initiate this type of backup. First, it will process a Stage1 backup. Then, it will ask me to connect and mount my external 80GB USB drive. It will then copy all of the data located in /mnt/share to the USB drive. Unfortunately, given the amount of data and the amount of space left in the USB drive, I may only be able to keep 2 or 3 revisions at a time.

A “Stage3″ backup is reserved for if I ever get a 500GB drive or something where I can just copy entire disk images over to the drive. This is the ultimate form of backup because it preserves everything exactly.

I’m not sure what a “Stage4″ backup would be. Perhaps a copy of every single hard drive that I own. That would be several terabytes large.

KDE and Gnome required a full night of compiling each. Then, I realized that I had forgotten to enable the xinerama USE flag for KDE, so I had to recompile a whole bunch of packages again. After I did so, however, TwinView worked very well. My desktop is set up much like my old one. However, KDE is much more responsive thanks to excellent kernel tweaks courtesy of kamikaze-sources. I was originally using viper-sources, as recommended by the Conrad Installation Guide, but they were a bit old (2.6.21 instead of 2.6.22). The kamikaze-sources also provided some tweaks for CFQ, which was nice. I tried using the Dynamic Ticks feature of the kernel, but found it to slow down my system quite a bit. It caused Compiz to not work properly with games (the FPS dropped down to like 20 FPS).  I am also using the SLUB allocator right now, which seems to have some improvements over the existing SLAB model.

So far, I have had only two major issues.  DBUS didn’t seem to want to work correctly.  It was failing when Compiz tried to load (which might have caused Compiz to run smoothly) and it also wasn’t playing nicely with HAL, so my drives were not being automounted.  I later discovered that the security policy implemented was contradicting itself.  It first instructed DBUS to allow certain connections and then later on denied them.  This was a quick fix; I just needed to stick comment tags around the offending block.

The other issue involved Gamin, a file alteration monitor.  Apparently, the issue that I was having occurs with both Gamin and its predecessor FAM.  After using Konqueror for a while, I noticed that the system started to slow down severely.  I later noticed that Konqueror was displaying 100% CPU usage.  After some research, I discovered that the file alteration monitor, which indeed does exactly what you might expect: watch for changes in the filesystem, was reporting numerous errors at extremely high rates, causing my CPU usage to spike.  After a few tests, I found that I was able to stop the issue by sticking three lines into /etc/gamin/gaminrc:

none /var/log/*
fsset ext2 notify
fsset ext3 notify

I didn’t need to add extra fsset lines for ntfs-3g and reiser4 because the issue mainly occurred with the EXT3 USB drive that I had borrowed to back my data up.  After fixing this problem, my CPU usage returned to something normal.

So, Gentoo seems to be running fine right now.  I still have more copying to do before my system is complete, but I’m getting there.

As for Sophos, I have more or less put that project on hold.  It’s going quite well, but I still need a touch screen.  I did buy a laptop keyboard, however.  There is very little information about modding laptop keyboards to work with PS/2 connectors, but I have found a few resources.  This blog post shows how someone had connected his laptop keyboard up to a spare keyboard controller from another keyboard and then used some software to read the resulting keycodes.  It’ll be a bit of work (especially to find a keyboard controller with the same matrix dimensions), but I’m up for it.

XML is supposed to be easy to parse, right?

Apparently not if you are using PHP.

Seeing that PHP is a web language, it only makes sense that it should have some functions for parsing XML documents.  Well, as it turns out, the closest thing that it has is XMLReader.  It sounds good, right?  Too bad there is little-to-no documentation on it because it is so new.  Furthermore, it was unnecessarily complicated for my purposes.  I just needed it to read an XML feed from Weather.com.  After a little bit of experimentation, I was able to to get it to do some stuff.  However, it just wasn’t doing what I needed it to do.  So, I ended up writing my own implementation for an XML reader that was specific to the Weather.com feed.  It grabs the current conditions and the forecast and stores it into a neat little array that is formatted into a nice looking table on the main page (I’ll try to get a screenshot up later).  I ended up using icons from the Weather widget for an awesome widget program called Screenlets.  So, now, the weather box is working fine.  That makes me happier.  Although I nearly drove myself insane trying to get the XML parser to work.  I ended up just using a bunch of explode() calls, although I probably could have done a better job with Regex.  Also, I was able to get the email to load asynchronously, so the load time of the page is much faster now.

What PHP really needs is a function that will take XML data and turn it into a multi-branched array.  It shouldn’t be that hard to do.  Maybe I’ll write one myself one day.

libgmail is amazing.

There are a few APIs out there for grabbing your email from a Gmail account.  I decided to try out libgmail, an API written in Python.  I am simply astounded at the number of different functions available.  It supports managing the contacts list, different folders and labels, threads, messages in those threads, and tons of other things.  Of course, I only need it to provide data for an interface similar to iGoogle’s Gmail widget/gadget/some-other-synonym.  On the downside, it is a bit slow, and most of that occurs from the login process.  So, instead of having the list of mail refresh every few minutes, I have a little counter at the bottom right of the screen that will refresh every 3 minutes using AJAX.  This method works fairly well.  LightTPD doesn’t want to play nicely with Python either, so I have to use a PHP script wrapper that calls shell_exec(“python getemail.py”); in order to get my email.  A little hackish, yes.  But it does the job without slowing things down too much.
I also have finished the PHP template.  I’m so used to designing them now, it only took me around 5 minutes.  So far, so good.

Preliminary Layout Design

Here’s an actual screenshot of the layout so far (click for a larger view):

Layout

I’m keeping to my concept design pretty well, surprisingly enough. I tried running this in a fullscreen Firefox window on the monitor and it looks great (I don’t have a touchscreen yet, so I’ve just been using some random monitor that has been lying around). The logo needs to be nudged to the left just a bit, though. My CSS is pretty heavy; over 50 lines of code already. However, the computer seems to have no problem loading the pages. Once I have finished perfecting the basic layout, I’ll whip up a PHP template to take care of interface consistency problems.

PHP seems to have good support for both XML parsing (for the weather applet) and INI parsing (for keeping track of the radio stations). On that note, I’ve got an INI system floating about in my head. It works something like this:

All of the stations are stored in stations.ini. The format will be something like:

[station1]
name = “Station 1″
stream = “http://station1.tld/stream.mp3″
site = “http://station1.tld/”
playcount = 5

[station2]
name = “Station 2″
stream = “http://station2.tld/stream.mp3″
site = “http://station2.tld/”
playcount = 19

Et cetera.

[station1], [station2], etc. will all be fixed names. Everything else can be changed, of course.
When a song is selected, the name, stream, and site keys will all be copied to nowplaying.ini. When the sound system is paused, mpg321 (the backend MP3 player) will be killed and nowplaying.ini will be moved to paused.ini. When the system is unpaused, the reverse will happen.

Obviously, I’ve got to figure out some way to support non-MP3 streams.

Progress: Good.
Sanity: Good (for now).

Insert Witty Title Here

I forgot to mention that I can say that I have put my flesh and blood into the creation of this computer; I sliced my finger on a piece of metal when installing the backplate.

I replaced the 2.4.33.3 kernel with a 2.6 series kernel (2.6.21.5). After three attempts, I finally got everything right. I decided to go with a 2.6 kernel because it supports preemption and allows me to change the timings as well. It helped clear up a problem where XMMS was skipping while trying to play audio. Also, I have support for I2C thanks to the Fintek F71805 chip, which monitors my hardware. So, I’ll probably stick some hardware information somewhere in the interface (possibly in the “System” tab).

I’ve got the latest versions of PHP and LightTPD installed now. I had to hack LightTPD a bit to allow root to run it, but I am actually able to use PHP to start playing a radio station. PHP calls exec(play.sh). In turn, play.sh calls mpg321 `cat stream`, where stream is the name of the file containing the MP3 stream. There seems to be no problem with skipping even with intensive processes running in the background, although after a while, the station starts to make periodic popping sounds. I’ll have to look into that.

I also found that I could clock the processor down to 400MHz without major performance repercussions, which is pretty amazing. Even with half the clock speed, things run very smoothly. At this lower speed, the CPU only runs at about 15°C. I’m not sure how happy I am with the hard drive, though; it seems to heat up the case quite a bit and is louder than I expected that it would be. Even with that, the system is extremely quiet. I might replace the fans in the future, but I can barely hear them right now.

Things that I have left to do: set up the autologin system, build the interface(!!!), and securify everything. After that, it will be usable. Although, once I buy the touchscreen, I’m going to have to recompile the kernel with support for it.

45.9 Seconds

No, I didn’t make another computer in that span of time. However, that is how long Sophos takes to boot up from a press of the power button. The BIOS screen is about 5 seconds long, which isn’t bad. The new kernel that I installed (all modules removed) seems to load fairly quickly as well. I’m also using Fluxbox now instead of XFCE because it loads immediately. However, the init structure needs to be redefined a bit in order to speed things up. I think I’m going to switch to a 2.6 kernel instead as well, because I seem to have a bit of a problem with multitasking on this machine. Overall, however, I’m pleased with the results. I might even clock the CPU down a little from its stock 800MHz in order to reduce the speeds of the fan by decreasing the temperature.