9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] more bitsy fixes and /dev/pcmevs to detect card insertions
@ 2002-05-20  8:33 Fco.J.Ballesteros
  0 siblings, 0 replies; only message in thread
From: Fco.J.Ballesteros @ 2002-05-20  8:33 UTC (permalink / raw)
  To: 9fans

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-20  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-20  8:33 [9fans] more bitsy fixes and /dev/pcmevs to detect card insertions Fco.J.Ballesteros

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).