Linux repositories inspector


December 22, 2003


Pcfclock kernel driver


pcfclock - parallel port radio clock devices


modprobe pcfclock [parport= number ,...]


The pcfclock devices are character devices for the parallel port radio clock sold by Conrad Electronic under order number 967602.
The radio clock, which is put between a parallel port and your printer, receives the legal German time, i.e. CET or CEST, from the DCF77 transmitter and uses it to set its internal quartz clock.
If the Linux Device Filesystem is mounted the device files are available in the pcfclocks subdirectory. The old-style device files are typically created by:
mknod -m 444 /dev/pcfclock0 c 181 0
mknod -m 444 /dev/pcfclock1 c 181 1
mknod -m 444 /dev/pcfclock2 c 181 2
The time information requested from the radio clock is put into an array of 18 bytes by the device driver. The following Perl program shows how to decode the information stored in the array:
sysopen(FH, "/dev/pcfclock0", 0) or die "$!";
sysread(FH, $buf, 18);
@time = unpack("C18", $buf);
die "invalid time data" if $time[0] != 9;
$not_in_sync = ($time[1] & 1);
$sec = $time[2] + 10 * $time[3];
$min = $time[4] + 10 * $time[5];
$hour = $time[6] + 10 * $time[7];
if (($time[8] & 3) == 1) {
$isdst = 1;
} elsif (($time[8] & 3) == 2) {
$isdst = 0;
} else {
$isdst = -1;
$battery_low = ($time[8] & 4);
$wday = $time[9];
$mday = $time[10] + 10 * $time[11];
$mon = $time[12] + 10 * $time[13];
$year = $time[14] + 10 * $time[15];
$usec = 31250 * $time[16];
$usec += 500000 if ($time[17] & 1);
$wday ranges from 1 to 7, i.e. from Monday to Sunday. $mon ranges from 1 to 12 and $year from 0 to 99.


If the driver is loaded as a module you can configure it using module parameters:
parport Attach device drivers to specific ports. For example, parport=0,none,2 binds the first device to the first parallel port, disables the second device and binds the third device to the third parallel port.
If the driver is built into the kernel you can configure it using the kernel command-line. The equivalent of the above command would be pcfclock=parport0,none,parport2. With pcfclock=0 the driver is disabled entirely.




The following kernel messages can be printed.
pcfclock: no devices found
No parallel port exists or there is no working radio clock connected to any parallel port.
pcfclock: no radio clock found at parport0
Either there is no radio clock at the given parallel port or the clock has not received the time from the DCF77 transmitter yet.
pcfclock: not in sync at parport0
The last radio reception failed, i.e. the radio clock is not in sync with the DCF77 transmitter.
pcfclock: battery status low at parport0
The radio clock’s battery must be replaced.


Andreas Voegele


⇧ Top