Thursday, July 30, 2009

How to set the time with NTP as an option

I will show you how to manually update the time and manually use NTP to update the time.

1. Set the current time manually. Before you can use NTP, you need to have the time on your system correct to within a few minutes. If its more than an hour or so, NTP won't have confidence in the time it gets from the server and as a result, it won't update the time. As root:

date "MMDDHHmmYYYY"


where MM is the two digit month, DD is the two digit day, HH is the two digit hour on a 24-hour clock, mm is the two digit minute, and YYYY is the four digit year. For example, 6:30pm on July 30, 2009 would be:

date "073018302009"



2. As root, use YaST to setup the NTP daemon:

yast ntp-client


This YaST module is available under the "Network Services" section of the YaST2 GUI.

You'll need to set the NTP start to automatic before YaST will let add a time server. Add a public server (the tool has a pretty good list of servers you can use). Then, if you don't have a permanent Internet connection (including a laptop or a computer using the Network Manager applet), set NTP to only start manually.


3. From this point on, anytime you want to reset the time on your computer, use, as root:

ntpd -q


This will cause NTP to set the time and then quit.

Saturday, June 27, 2009

Change SSH Port

If you have two or more computers behind a NAT (i.e., router) and you want to access both machines, you need to change the SSH port on at least one of them. To do so, as root, edit /etc/ssh/sshd_config. Add a line that reads "Port PORT_NUMBER". The relevant part of my file looks like this:

Port 2200
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::


You will need to either restart the SSH daemon (or reboot) before the change will take effect. And of course, you'll need to adjust the firewall on your computer to allow the new port to pass through, as well adjust your NAT.

Thursday, June 25, 2009

Freeing disk space

This is just an FYI to anyone who is deleting files off their hard drive and it's probably a pretty familiar concept to those who've been using Linux for awhile.

For any file, Linux maintains a list of handles, that is programs that are currently using the file. When you delete the file, it is only removed from the disk when the number of handles goes to zero.

This becomes important if your drive is almost full and you delete a file, but you find that your disk space has not changed. The most likely reason is that some program still has an open handle.

Make sure that any program that might be using the program is closed and if all else fails, a reboot will clear all of the open file handles.

And if you weren't already aware, the command line tool to find out how much disk space you have left is 'df'.

Tuesday, June 23, 2009

Sound not working in Flash? Here's a possible fix.

Here's the symptom: your sound works fine, except in Flash. You've tried multiple browsers and Flash sound doesn't work in any of them.

The problem is that you're using PulseAudio as a sound engine and sometimes Flash doesn't work well with it.

To fix this, remove the libpulse0 package. As root:

yast --remove libpulse0


When I did this, it ended up removing MPlayer due to dependecies. I reinstalled MPlayer from the repositories which brought back one PulseAudio package, but sound still worked in Flash.

Monday, June 22, 2009

::Updated:: A guide to getting the Digipro T-8000U Tablet to work with OpenSUSE

This post supersedes my previous one. It fixes the bugs that were in that one.

This guide will get the Digipro T-8000U tablet working with OpenSUSE 11.1.

1. Install the necessary prerequisites. As root:

yast -i gcc xorg-x11-devel xorg-x11-server-sdk


2. Get the latest version of the WizardPen driver, which as of now is 0.7.0a2. It is available on a Microsoft website (don't ask me why):

http://cid-43438aff38d34c29.skydrive.live.com/self.aspx/Public/wizardpen/wizardpen-0.7.0-alpha2.tar.gz

Untar, configure, and compile it. Do not install it.

tar xvzf wizardpen-0.7.0-alpha2.tar.gz
cd wizardpen-0.7.0-alpha2
./configure && make


3. The Makefile installs the driver where Xorg won't find it, so you have to install it manually. As root:

cp src/wizardpen_drv.la /usr/lib/xorg/modules/input
cp src/.libs/wizardpen_drv.so /usr/lib/xorg/modules/input


4. You need to find the device associated with the tablet. First, do:

grep Name /proc/bus/input/devices


Look for something that looks like your tablet. Mine was "Aiptek". If nothing sticks out, you can do an:

lsusb


to find the full name of the tablet and compare that with the output from "grep Name /proc/bus/input/devices".

Then do (assuming your tablet's name is Aiptek):

lshal | grep "input.product = 'Aiptek'" -A 20 -B 20 | grep input.device


This should produce a single line with your device. Mine was /dev/input/event7. If this doesn't work, do a "lshal" and search through the output until you find the string.

5. Download and run this calibration routine. The one that is provided with the WizardPen code does not calibrate in the Z-direction, which is critical to getting the pressures to work.

wget http://www.filefactory.com/file/ag8g447/n/wizardpen-calibrate_c wizardpen-0.7.0-alpha2/calibrate/wizardpen-calibrate.c
cd wizardpen-0.7.0-alpha2/calibrate
make
sudo ./wizardpen-calibrate /dev/input/event7


6. As root, edit /etc/X11/xorg.conf. Add a section that reads:

Section "InputDevice"
Driver "wizardpen"
Identifier "WizardTablet"
Option "Device" "/dev/input/event7"
Option "TopX" "0"
Option "TopY" "0"
Option "TopZ" "54"
Option "BottomX" "3000"
Option "BottomY" "2200"
Option "BottomZ" "511"
Option "MaxX" "3000"
Option "MaxY" "2200"
Option "MaxZ" "511"
EndSection


where all of the numbers are from the calibration program in step 5. In the ServerLayout section, add a line that reads:

  InputDevice  "WizardTablet"  "AlwaysCore"


7. Reboot.

The tablet should be working now. To use it in Gimp, you need to go to Edit, Preferences, Input Devices, Configure Extended Input Devices, and for the WizardTablet device, set the Mode to Screen. Be warned, with an extended input device (the tablet) enabled in Gimp the mouse can no longer be used to draw. However, disabling the tablet re-enables the mouse. See this GTK bug for more details.

There is one lingering bug and that is that hotplugging does not work. I'll look at this sometime over the next week. Until then, you'll need to have the devices you want to use plugged in at boot.

---===Very Important===--- If you have a dynamic collection of input devices, where what you have plugged into the computer changes from boot to boot, you'll need to make a couple of small modifications to your xorg.conf. These corrections are necessary if you want to, for example, use a USB mouse occasionally. You need to replace the "/dev/input/DEVICE" lines with either the "/dev/input/by-path/DEVICE_PATH" or "/dev/input/by-id/DEVICE_ID" for your device. You can find out what this are by doing a:

find /dev/input


with and without the device plugged in and then comparing the outputs. There will be two files associated with each device. For mice, use the one without "event" on the end and for the tablet, use the one with "event" on the end.