9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Fco.J.Ballesteros <nemo@plan9.escet.urjc.es>
To: 9fans@cse.psu.edu
Subject: [9fans] more bitsy fixes and /dev/pcmevs to detect card insertions
Date: Mon, 20 May 2002 10:33:27 +0200	[thread overview]
Message-ID: <03b54a2b967dbc1a6bf9e3fe3dbd5898@plan9.escet.urjc.es> (raw)

[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]

Hi,

This is a set of files to be put at /sys/src/9/bitsy/ that includes

1) makes the sdata driver work again for pcmcia disks
2) adds two commands 'sleeping' and 'reseting' to /dev/suspend
3) adds a #y/pcmevs file useful to detect card insertions

plus the suspend stuff (l.s power.c) again, because I suspect that the
version I sent before was not the one working (I think suspend is
already fixed at the labs and will probably be included in a future
update).

Regarding 1), I had to change the Devconf struct to match that used by
..../port/devsd.c and also to define fake ISAConf and pcmspecial code to
get devsd compiled; this required changes in several other drivers.
That's why the patch includes more files than strictly needed.

Regarding 2), "echo sleeping >/dev/suspend" makes the power button
cause a suspend; "echo reseting >/dev/suspend" makes the power button
cause a suspend + reset-on-resume (the behaviour of the distributed
bitsy source).

Regarding 3), the /dev/pcmevs file is handy to fire up scripts when a
pcmcia card is inserted.  For example, I use this to get `startsd'
executed whenever I plug my pcmcia disk in:

#!/bin/rc
# pcmwatch: watch for insertion events

cat /dev/pcmevs | {
	# would read a line with "#y/pcm[01]ctl"
	# for each card insertion.
	while (slot=`{read}){
		if (grep -s MK2001MPL $slot)
			startsd
		if (grep -s WaveLAN/IEEE $slot)
			startip
	}
}

If others find this useful, I'm willing to adapt the same code for the pc
architecture, as well as the man page. BTW, perhaps the man page could
be renamed pcmcia(3) for all the architectures involved.

To make the example complete, here is my startsd:

#!/bin/rc
# startsd: start using the disk; unmount at exit to keep kfs clean
echo -n 'configure #SC ata 1'  >/dev/pcm0ctl >[2]/dev/null
if (!test -d /dev/sdC0)
	bind -a '#S' /dev
if (!test -e /dev/sdC0/plan9)
	disk/fdisk -p /dev/sdC0/data >/dev/sdC0/ctl
if (!test -e /dev/sdC0/fs)
	disk/prep -p /dev/sdC0/plan9 >/dev/sdC0/ctl
disk/kfs -f /dev/sdC0/fs
window ' mount -c /srv/kfs /n/kfs ; acme ; disk/kfscmd halt'


Since programs will notice broken chans, I think there's no point
in card removal events, sic. My current approach is that start* scripts
execute acme and after acme exits, they unmount the file systems.
Any better way?

[-- Attachment #2: bitsysd.tgz --]
[-- Type: application/octet-stream, Size: 43454 bytes --]

                 reply	other threads:[~2002-05-20  8:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03b54a2b967dbc1a6bf9e3fe3dbd5898@plan9.escet.urjc.es \
    --to=nemo@plan9.escet.urjc.es \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).