FritzNet

FritzNet is a blog of my path to freedom from Micro$oft. I'm embarking on trip into the Open Source movement. In this blog, I will be documenting my plans, successes and failures.

Friday, January 26, 2007

Puppy Linux on an old computer

It's been a long time since I've posted here. I've been extremely busy with school and work. I just don't have the time to mess around with Linux. I still run it every day on my laptop, but I can't mess around with it since I really need the laptop for school. But my son recently asked to boot up with Linux.

I had Puppy Linux installed, but to get to it I had to use a floppy drive. I don't like having to mess with a floppy, and I didn't want to use a CD. I found this thread on the forums, and it sort of worked for me. I did have to make a couple changes, so I decided to write this up so I don't lose track of what I did. I also want to make sure that the original topic doesn't disappear.

First, I downloaded the new ISO and burned it to CD. I booted into Windows and created a c:\puppy folder. I then copied all the files from the CD into this folder. I feel sure that I don't need all the files, but I figure that the files that aren't needed are the smaller files, and they add up to about 5 meg. A small price to pay for not having the headache of tracking down exactly what files are needed.

Next, I needed to use GRUB. I got grub.exe from here. This went into the c:\puppy folder as well. Finally, GRUB makes use of a file called menu.lst. This file basically is a menu list that allows you to pick OS to boot into. I pulled the menu.lst file off my Ubuntu laptop. It's in the /boot/grub folder. I commented out all the menu items for my laptop and put in the following:

timeout 0
title Puppy Linux
rootnoverify (hd0,0)
kernel (hd0,0)/puppy/vmlinuz root=/dev/ram0 acpi=off
PFILE=pup001-none-131072 PHOME=hda1
initrd (hd0,0)/puppy/initrd.gz


Finally I got to the point to change the way the computer will boot up. Time to edit the autoexec.bat and config.sys files. The original poster suggested using sysedit on the Win98 machine and it was a bit easier to use since I got to change each of the files with a single open. The config.sys file was empty and I added the following:

REM [Start of additions for Linux]
[menu]
menuitem=win, Windows
menuitem=linux, Puppy Linux ver. 2.13
menudefault=win, 15

[linux]

[win]
REM [End of additions for Linux]


This basically sets up the menu to select Windows or Linux. It also sets up a timeout to choose Windows after 15 seconds. The autoexec.bat file was also empty, so I added the following:

REM [Start additions for Linux]
GOTO %CONFIG%

:LINUX
ECHO Welcome to Puppy Linux!
PAUSE
C:\PUPPY\GRUB.EXE --config-file=(hd0,0)/puppy/menu.lst

:WIN
REM [End additions for Linux]


This makes use of the selection made in the config.sys file. It then gives a welcome to Linux message and pauses. I removed the pause, no need to wait for a key stroke. It then calls GRUB. If Windows is picked, or it times out, nothing in autoexec.bat is used.

This is a slow computer. It's a 450 MHz AMD K6-2 and has 192 Meg of memory. It seems like the computer is much faster with Puppy Linux running on it. I'll try to get my son working on this computer more and using Puppy Linux as much as I can. I firmly believe that Linux is still growing. I also think that it will help him know much more about computers than any of his peers.

Sunday, October 22, 2006

I'm going to finish my basement, what's that got to do with computers? Usually nothing, but in my case, the computer with the printer connected is in the basement. So my choices was to bring a computer to the first floor to act as a print server, or get a small print server and save some electricity by not having to keep the computer turned on.

I went with the print server. I found a refurbished NetGear PS110. Below is what I needed to do to get it working.

First, I have Ubuntu on my laptop, and an old computer with Win98 and soon it will have Edubuntu on it. I figured I would plug in the print server and it would get the IP via DHCP. It didn't. I found that the CONFIG file has a line for DHCP and it's Disabled. Apparently it's done at the factory.

Since it didn't get an IP address, I decided to have the software for the print server set it up. I brought up the Win98 computer and installed the software. I launched the Wizard, and while it saw the print server, it would not configure it. I refreshed the screen to ensure that the computer now saw the print server and launched the IP config utility. I typed in all the details and it updated them. I then installed the printer on the Win98 machine using the install printer utility. Worked like a charm. I found out later that I would have been able to configure the IP by doing a

arp -s -v 192.168.1.150 macaddress

Then it was time to conquer the laptop. I brought up the CUPS web page located at:

http://localhost:631/printers

Over to the Administration tab.

add
lpd/lpr host or printer
device uri = lpd://192.168.1.150/P1
model driver hp, I used 'HP LaserJet 6L ' for my printer

When I hit add, it asked me for a username and password. None of the passwords I knew would work. I eventually had to create a password for the root user. I put in the password and it installed. I then had to remove the password.

Create the password with:

sudo passwd root

Remove the password with:

sudo passwd -l root

Everything working fine now. As I said before, I do this Blog for my own use in case I have to rebuild the computer.

Monday, June 19, 2006

Function keys are now working

In a previous post, I mentioned that didn't have any function keys working. Well, since I got out of this semester, I fixed this problem. Long ago, I found instructions for making the function keys work on the Gentoo forums. I had to read through them and took out the parts that I didn't need. After paring down all that discussion, I ended up with a much quicker and easier procedure that works.

First, I put the following code into a file called sonyfn.c This code was submitted to the Gentoo forums by Pijalu. If this code is helpful to you, please let him know.


#include
#include
#include
#include
#include
#include

// input thing
#include

// sound stuff
#include

// keys
#define FN_F2 1 // cut sound
#define FN_F3 2 // volume -
#define FN_F4 4 // volume +
#define FN_F5 8 // Brightness -
#define FN_F6 16 // Brightness +
#define FN_F7 32 // LCD/SCREEN
#define FN_F10 128 // Zoom in
#define FN_F12 64 // Suspend
#define S1_BTN 4096 // S1 custom button
#define S2_BTN 8192 // S2 custom button

#define FN_INPUT_VALUE 245 // Fn key generate a 245 value
#define FN_INPUT_TYPE 4 // a 4 type
#define FN_INPUT_CODE 4 // and a 4 code

// config hard coded :p
#define MIXER_DEV "/dev/mixer"

// SOUND HANDLER
int get_volume(int *value)
{
int mixer = open(MIXER_DEV, O_RDONLY);

if (mixer) {
ioctl(mixer, SOUND_MIXER_READ_VOLUME, value);
close(mixer);
return 0;
}
else
return 1;
}

int set_volume(int *value)
{
int mixer = open(MIXER_DEV, O_RDWR);

if (mixer) {
ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, value);
close(mixer);
return 0;
}
else
return 1;
}

int volume_up()
{
int value = 0;

get_volume(&value);

if (value < 0x5a5a)
value += 0x0a0a;
else
value = 0x6464;

set_volume(&value);

return 0;
}

int volume_down()
{
int value = 0;

get_volume(&value);

if (value > 0x0a0a)
value -= 0x0a0a;
else
value = 0;

set_volume(&value);

return 0;
}

int oldvalue;
int mute()
{
int value;

get_volume(&value);

if (value) {
oldvalue=value;
value=0;
set_volume(&value);
}
else {
if (!oldvalue) {
volume_up();
}
else {
set_volume(&oldvalue);
}
}

return 0;
}
// END OF SOUND

/* Return current brightness of the screen */
int getBrightness() {
FILE* handle;
char buffer[2];
int ret;

if ((handle=fopen("/proc/acpi/sony/brightness","rb"))==NULL) {
perror("Error opening /proc/acpi/sony/brightness");
exit(-1);
}
if (fscanf(handle,"%d",&ret)!=1) {
perror("Error reading /proc/acpi/sony/brightness");
exit(-1);
}
fclose(handle);
return ret;

}

/* Set the current brightness of the screen */
void setBrightness(int b) {
FILE* handle;
char buffer[2];

// validate values
if (b>8) {
b=8;
}
else if (b<1) {
b=1;
}

if ((handle=fopen("/proc/acpi/sony/brightness","wb"))==NULL) {
perror("Error opening /proc/acpi/sony/brightness");
exit(-1);
}
if (fprintf(handle,"%d",b)!=1) {
perror("Error writing /proc/acpi/sony/brightness");
exit(-1);
}
fclose(handle);
}

// Pool the fnkey status
int getCodes() {
FILE* handle;
char buffer[10];
int ret;
if ((handle=fopen("/proc/acpi/sony/fnkey","rb"))==NULL) {
perror("Error opening /proc/acpi/sony/fnkey");
exit(-1);
}
if (fscanf(handle,"%d",&ret)!=1) {
perror("Error reading /proc/acpi/sony/fnkey");
exit(-1);
}
fclose(handle);
return ret;
}

// main and loop
int main(int argc, char **argv) {
// event interface
int fd = -1; /* the file descriptor for the device */
int i; /* loop counter */
size_t read_bytes; /* how many bytes were read */
struct input_event ev[64]; /* the events (up to 64 at once) */

/* key code */
int key;

/* used if event hit fn */
int hasSomething;

/* open event interface*/
if (argc != 2) {
/* i don't like outputs...
fprintf(stderr, "Using /dev/input/event0 for input\n");
fprintf(stderr, "Overide with %s event-device\n", argv[0]);
*/
if ((fd = open("/dev/input/event0", O_RDONLY)) < 0) {
perror("event interface open failed");
exit(1);
}
}
else {
if ((fd = open(argv[1], O_RDONLY)) < 0) {
perror("event interface open failed");
exit(1);
}
}

nice(10); // be a nice dirty code (less dirty but keep nice)


while(1) { /* loop */
hasSomething=0; /* nothing yet */

/* read the event interface */
read_bytes = read(fd, ev, sizeof(struct input_event) * 64);

if (read_bytes < (int) sizeof(struct input_event)) {
perror("sonyfn: short read");
exit (1);
}

/* Loop for all readed events until we have something interesting.. */
for (i = 0;! hasSomething && ( i < (int) (read_bytes / sizeof(struct input_event)) ); i++) {
hasSomething= (ev[i].type == FN_INPUT_TYPE)
&& (ev[i].code == FN_INPUT_CODE)
&& (ev[i].value == FN_INPUT_VALUE);
}

/* If we got a FN event, plz do something...*/
if ( hasSomething && (key=getCodes()) ) {
if ((key & FN_F5)==FN_F5) { // lower brightness
setBrightness(getBrightness()-1);
}
if ((key & FN_F6)==FN_F6) { // higher brightness
setBrightness(getBrightness()+1);
}
if ((key & FN_F2)==FN_F2){
mute();
}
if ((key & FN_F3)==FN_F3) {
volume_down();
}
if ((key & FN_F4)==FN_F4) {
volume_up();
}
if ((key & FN_F12)==FN_F12) {
if (fork()==0) {
/* that's my home made script for swsusp
#!/bin/sh
sync
echo "disk" > /sys/power/state
*/
if (execv("/bin/hibernate",NULL)==-1) {
perror("Cannot run hibernate");
}
}
}
/* rest i still don't care */
}
}// while

close(fd);
return 0;
}


Then I had to compile this by doing a:


$ gcc sonyfn.c -o sonyfn
$ mv sonyfn /usr/bin
$ sudo chown root /usr/bin/sonyfn
$ sudo chmod 4755 /usr/bin/sonyfn


Then to manually run this, you call the program and provide the path to the keyboard. In my case, the keyboard is /dev/input/event0.

So now I need it to launch at boot time, so I'm using the Session GUI to add it to the start up programs.

sonyfn /dev/input/event0 &


I rebooted and it launches just fine.

Wednesday, June 14, 2006

Upgrading to Dapper Drake

On June 1st, the latest version of Ubuntu came out. It was 6.06, Dapper Drake. I read that there have been a couple improvements implemented. I don't know the details, but I do know that they improved hibernate. I was waiting for my classes to be over, and today I took my last final.

So it's time to upgrade. I did a quick search, and came up with this blog. Since it appears that it would be a piece of cake, so I decided to go for it. I launched the Upgrade Manager and saw that it knew about the upgrade. I clicked to install the upgrade and accepted all defaults, although the only real choices you had were to continue and after the install you could choose to remove the non-supported applications. It took just over an hour to download and install the upgrade.

Now for the testing. I found that hibernate works just fine. I put it to sleep and woke it up just fine. I'll put it to sleep tonight and see if it wakes up tomorrow. I also know that it now supports WPA. I'm going to read up on that and see how to configure it. Since everything else in Ubuntu is a piece of cake, I doubt this will be any more difficult. Is it obvious that I really like this distro?

One thing that is different is my touch pad now has a scroll portion. I don't particularly like it yet. I'll have to use it a little and see if I like it better. Time will tell.

Saturday, June 03, 2006

Crossover Office

I had to use Office 2003 for some of my school work. I took an Access course, so had to use Office 2003. I have been using OpenOffice.org for all my papers and any writing I need to do. I registered and paid for my next courses and started working on my reimbursement paperwork. What do I find? The forms I have to fill in won't work in OpenOffice.

So I started looking around and downloaded Crossover Office. I got the 30 day free trial. Since I'm using Ubuntu, I did have to set up my system to allow logging in as root. After downloading, I found it's just a script that gets run. I had to run it several times. I ran it first as sudo and the script told me that I couldn't run it as sudo. I then used "su -" and the script told me that I was not able to use this because root does not have display settings configured. I then ran it with "su" and it worked just fine. Installed without any errors.

Next thing that needed done is installing whatever you need to run. I picked Office 2003 from the list and told it where to install from. Again, I had to do this 2 times. The first time, the program informed me that because it's a Windows CD, there are hidden files that the CD-ROM could not see. It then offered to fix this problem itself. I usually wouldn't allow a program to "fix" my system, but it spelled out exactly what was going to happen. All it needed to do was edit my fstab file. It modified the file and I was able to install Office 2003 without a hitch. I'm curious if Office will expire or not.

Will I buy Crossover Office? Maybe, it all depends on how often I use it.

Monday, March 06, 2006

Almost strictly Linux

It's sure been a long time since I've posted.

Well, I'm about 85% Linux now at home. I do have to use XP to do my Access course. That's a pain, but not too bad since it's only for the one class. I've used Linux for all the other courses. I looks like I'll be able to use it for the other courses.

Tuesday, January 10, 2006

A wireless add-on

One thing I found that seemed to be missing from Ubuntu was a good way to connect to whatever wireless networks were around. Out of the box, you boot up and it connects to your wireless network. In a perfect world, this would work great. But this doesn't work on a laptop. I plan on going to different places with this thing.

So, a post to the forums, and I get pointed to gtkWifi. This thing is just like the wireless tool in XP, but it allows you to store the keys to multiple networks and select them automatically. I have only this one network that I will connect to on a regular basis, so I can't test this.

It comes as a .deb package, so it was easy to install. Launch a terminal and do:

dpckg --install package.deb


It installed just right. It even automatically put it into the "other" menu. This is just too simple. It will just take a short time for Linux to be really main stream once people really look at this distro.