1*b9170857Ssobrado.\" $OpenBSD: hotplugd.8,v 1.13 2015/07/27 17:28:39 sobrado Exp $ 2ec953a5bSgrange.\" 3ec953a5bSgrange.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> 4ec953a5bSgrange.\" 5ec953a5bSgrange.\" Permission to use, copy, modify, and distribute this software for any 6ec953a5bSgrange.\" purpose with or without fee is hereby granted, provided that the above 7ec953a5bSgrange.\" copyright notice and this permission notice appear in all copies. 8ec953a5bSgrange.\" 9ec953a5bSgrange.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10ec953a5bSgrange.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11ec953a5bSgrange.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12ec953a5bSgrange.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13ec953a5bSgrange.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14ec953a5bSgrange.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15ec953a5bSgrange.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16ec953a5bSgrange.\" 17*b9170857Ssobrado.Dd $Mdocdate: July 27 2015 $ 18ec953a5bSgrange.Dt HOTPLUGD 8 19ec953a5bSgrange.Os 20ec953a5bSgrange.Sh NAME 21ec953a5bSgrange.Nm hotplugd 22ec953a5bSgrange.Nd devices hot plugging monitor daemon 23ec953a5bSgrange.Sh SYNOPSIS 24ec953a5bSgrange.Nm hotplugd 25ec953a5bSgrange.Op Fl d Ar device 26ec953a5bSgrange.Sh DESCRIPTION 27ec953a5bSgrangeThe 28ec953a5bSgrange.Nm 29ec953a5bSgrangedaemon monitors the 30ec953a5bSgrange.Xr hotplug 4 31ec953a5bSgrangepseudo-device, acting on signaled events by executing the scripts in the 32ec953a5bSgrange.Pa /etc/hotplug 33ec953a5bSgrangedirectory. 34ec953a5bSgrangeBy default it uses the 35ec953a5bSgrange.Pa /dev/hotplug 36ec953a5bSgrangedevice for reading events from, but an alternative device can be 37ec953a5bSgrangespecified with the 38ec953a5bSgrange.Fl d 39ec953a5bSgrangeoption. 40ae1dbca6Sjmc.Pp 41ec953a5bSgrangeActions can be configured either for device attachment or detachment. 42ec953a5bSgrangeOn device attachment the 43ec953a5bSgrange.Pa attach 44ec953a5bSgrangescript is executed if it exists. 45ec953a5bSgrangeOn device detachment the 46ec953a5bSgrange.Pa detach 47ec953a5bSgrangescript is executed if it exists. 48ec953a5bSgrangeIn both cases two parameters are passed to the scripts: the class and name 49ec953a5bSgrangeof the attached or detached device. 50ae1dbca6SjmcThe device class corresponds to the classes described in the 51369bef3aSschwarze.In sys/device.h 52ec953a5bSgrangeheader file and can be one of the following: 53ae1dbca6Sjmc.Pp 54ae1dbca6Sjmc.Bl -tag -width Ds -offset indent -compact 55ec953a5bSgrange.It 0 56ec953a5bSgrangegeneric, no special info 57ec953a5bSgrange.It 1 58ec953a5bSgrangeCPU (carries resource utilization) 59ec953a5bSgrange.It 2 60ec953a5bSgrangedisk drive 61ec953a5bSgrange.It 3 62ec953a5bSgrangenetwork interface 63ec953a5bSgrange.It 4 64ec953a5bSgrangetape device 65ec953a5bSgrange.It 5 66ec953a5bSgrangeserial line interface 67ec953a5bSgrange.El 68ec953a5bSgrange.Pp 69ae1dbca6SjmcNot all classes are really usable. 706521dc59SjasperFor example, it's unlikely that a CPU will be hotplugged. 71ec953a5bSgrange.Pp 72ae1dbca6SjmcThe device name is the usual name, 73ae1dbca6Sjmcas listed in 74ae1dbca6Sjmc.Xr MAKEDEV 8 , 75ae1dbca6Sjmcand the unit number, e.g.\& 76ec953a5bSgrange.Pa sd1 . 77ec953a5bSgrange.Sh FILES 78ec953a5bSgrange.Bl -tag -width "/dev/hotplug/attach" -compact 79*b9170857Ssobrado.It Pa /dev/hotplug 80ec953a5bSgrangePseudo-device file. 81*b9170857Ssobrado.It Pa /etc/hotplug 82ec953a5bSgrangeDirectory where the scripts to execute are located. 83*b9170857Ssobrado.It Pa /etc/hotplug/attach 84ec953a5bSgrangeScript to execute on device attachment. 85*b9170857Ssobrado.It Pa /etc/hotplug/detach 86ec953a5bSgrangeScript to execute on device detachment. 87ec953a5bSgrange.El 88ec953a5bSgrange.Sh EXAMPLES 89ec953a5bSgrangeSample 90ec953a5bSgrange.Pa attach 91ec953a5bSgrangescript: 92ec953a5bSgrange.Bd -literal -offset indent 93ec953a5bSgrange#!/bin/sh 94ec953a5bSgrange 95ec953a5bSgrangeDEVCLASS=$1 96ec953a5bSgrangeDEVNAME=$2 97ec953a5bSgrange 98ec953a5bSgrangecase $DEVCLASS in 99ec953a5bSgrange2) 100ec953a5bSgrange # disk devices 101ae1dbca6Sjmc disklabel=`/sbin/disklabel $DEVNAME 2\*(Gt&1 | \e 102c20ae834Smarkus sed -n '/^label: /s/^label: //p'` 103ec953a5bSgrange case $disklabel in 104ec953a5bSgrange Sony*DSC*) 105ec953a5bSgrange # Sony DSC camera 106b3745705Sian mount -o nodev,nosuid /dev/"$DEVNAME"i /mnt/camera 107ec953a5bSgrange ;; 108ec953a5bSgrange esac 109ec953a5bSgrange ;; 110ec953a5bSgrange3) 1111df9b91cSian # network devices; requires hostname.$DEVNAME 1129892f1fcSian sh /etc/netstart $DEVNAME 113ec953a5bSgrange ;; 114ec953a5bSgrangeesac 115ec953a5bSgrange.Ed 116ec953a5bSgrange.Sh SEE ALSO 117ec953a5bSgrange.Xr hotplug 4 118ec953a5bSgrange.Sh HISTORY 119ec953a5bSgrangeThe 120ec953a5bSgrange.Nm 121ec953a5bSgrangeprogram first appeared in 122ec953a5bSgrange.Ox 3.6 . 123ec953a5bSgrange.Sh AUTHORS 124ec953a5bSgrangeThe 125ec953a5bSgrange.Nm 126ec953a5bSgrangeprogram was written by 12744e68d47Sschwarze.An Alexander Yurchenko Aq Mt grange@openbsd.org . 128