WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: APM legacy support TC 4.x current  (Read 2633 times)

Offline avalon

  • Newbie
  • *
  • Posts: 11
APM legacy support TC 4.x current
« on: April 22, 2012, 11:31:53 PM »
Hello. Using an OLD pentium 100 MHz as a print server for a similarly old Laserjet 4 parallel printer that I couldn't make working with the broken USB->parallel cables found in stores. It works fine for tha last couple of hours. Now the only thing that bugs me is that I can't shutdown the machine just by the power button. The machine is HP Vectra (unknown model) but it can shutdown and power-on by software. I had slackware on it a loong time ago and it was working.

But there is no apm module in tinycore. I am wondering if tinycore could have the the apm module compiled? Perhaps disable it by default to not cause troubles on newer machines but be available for those who need it? Perhaps in a separate extension? I see an old thread about APM that shows some opinions about it: http://forum.tinycorelinux.net/index.php/topic,1495.0.html

Or is there some other way I can capture the power button events, initiate a shutdown and perform a power off with a script or something?

UPDATE: hmm, or maybe only apmd is missing... I see this line in dmesg:
apm: BIOS version 1.1 Flags 0x03 (Driver version 1.16ac)
« Last Edit: April 22, 2012, 11:40:32 PM by avalon »

Offline xyz-worx

  • Jr. Member
  • **
  • Posts: 69
Re: APM legacy support TC 4.x current
« Reply #1 on: April 23, 2012, 01:10:18 AM »
Hi avalon,

I had a similar problem with my old PC using TCL 3.8.4 some month ago. There, it was not possible
to shutdown the machine via  software - I always had to press the power-button to switch it off.
Maybe you  can take a look at the end of my thread (http://forum.tinycorelinux.net/index.php/topic,10731.0.html).
Especially the link to the boot-code description might be interesting.
Playing around with these codes did solve my problem - may be yours too.

regards
xyz-worx

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: APM legacy support TC 4.x current
« Reply #2 on: April 23, 2012, 05:09:47 AM »
I think You'll need ACPI functionality for that,  will have to check what I did to enable this on my old test pc.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: APM legacy support TC 4.x current
« Reply #3 on: April 23, 2012, 06:20:44 AM »
APM is built-in, perhaps apmd is indeed what you need.
The only barriers that can stop you are the ones you create yourself.

Offline avalon

  • Newbie
  • *
  • Posts: 11
Re: APM legacy support TC 4.x current
« Reply #4 on: April 23, 2012, 08:34:48 AM »
Thanks, but no joy for now.

I compiled apmd for pentium and put it in an extension but it does not detect the power button. PC just halts without giving any chance to OS to shutdown. I also tried all combination of apm= without luck (apm=on apm=power-off apm=smp apm=realmode-power-off). The machine does not have an ACPI BIOS so APM is the only option. It is strange because I'm almost sure the old slackware installation was able to shut it down.

wrt detecting power button hit:
Reading on the internet, people suggest that it depends on BIOS how the power button behaves. I obviously need to play with the bios options to see if anything can be changed. Unfortunately I see only one suspicious option - running windows 95 which is already enabled. If there is no way to cahnge power button behavior from BIOS I guess I'm out of luck because BIOS is not sending an APM event but just shuts down :( I can't remember how the previous slackware installation handled that... and not doing to reinstall :)

Attaching apm.tcz 3.2.2 built for pentium arch if anybody needs it. Should work  with any version of TC because binaries are static.
Here's how to build:
  • download sources from debian (google for: apmd debian)
  • extract sources, debian patch didn't apply cleanly so didin't use it
  • vi Makefile and change PREFIX=/urs/local/ and DESTDIR=/tmp/apm and PROXY_DIR=$(PREFIX)/etc
  • in the Makefile apply standard CFLAGS=-march=486 -mtune=686 -Os -pipe
  • make && make install
  • cd /tmp/apm
  • mksquashfs ./ ../apm.tcz -all-root
  • /tmp/apm.tcz is the package

You still need an apmd_proxy script though, you may take one from some distro like debian but it expects scripts in /etc/ instead of /usr/local/etc but sed does just fine :)

The attached package does not contain a proxy script. I crafted a simple script manually just to check how apmd calls it but before I have the power button event propagated as an APM event, apmd is useless to me.

P.S. it's incredibly easy to create a TC package, very nice!

     [EDIT]: Removed attachment due to forum policy violation.  Rich
« Last Edit: April 23, 2012, 10:03:53 AM by Rich »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: APM legacy support TC 4.x current
« Reply #5 on: April 23, 2012, 10:07:22 AM »
Hi avalon
I had to remove the file you posted. It is against forum policy to post binaries or extensions. If you feel your extension
may be useful to others, please submit it to the repository.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: APM legacy support TC 4.x current
« Reply #6 on: August 18, 2012, 04:32:45 AM »
On a box with a dead power button, when linux fails to power off I have come to learn to just reboot into FreeDOS and then "fdapm poweroff".
Not very elegant but most reliable and efficient :P
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)