5.3.6 Device Event Noti.cation

A device driver sends events occurring in devices to the event noti.cation message buffer (TDN_EVENT) as device event noti.cation. The system default event noti.cation message buffer is specified at the time of device registration, but can be changed later. The system default event noti.cation message buffer is defined in TDEvtMbfSz in system con.guration information.

The following event types are defined.


	typedef	enum tdevttyp {
		TDE_unknown	= 0,	/* undefined	*/
		TDE_MOUNT	= 0x01,	/* media mounted	*/
		TDE_EJECT	= 0x02,	/* media ejected	*/
		TDE_ILLMOUNT	= 0x03,	/* media illegally mounted	*/
		TDE_ILLEJECT	= 0x04,	/* media illegally ejected	*/
		TDE_REMOUNT	= 0x05,	/* media remounted	*/
		TDE_CARDBATLOW	= 0x06,	/* card battery alarm	*/
		TDE_CARDBATFAIL	= 0x07,	/* card battery failure	*/
		TDE_REQEJECT	= 0x08,	/* media eject request	*/
		TDE_PDBUT	= 0x11,	/* PD button state change	*/
		TDE_PDMOVE	= 0x12,	/* PD move	*/
		TDE_PDSTATE	= 0x13,	/* PD state change	*/
		TDE_PDEXT	= 0x14,	/* PD extended event	*/
		TDE_KEYDOWN	= 0x21,	/* key down	*/
		TDE_KEYUP	= 0x22,	/* key up	*/
		TDE_KEYMETA	= 0x23,	/* meta key state change	*/
		TDE_POWEROFF	= 0x31,	/* power switch off	*/
		TDE_POWERLOW	= 0x32,	/* low power alarm	*/
		TDE_POWERFAIL	= 0x33,	/* power failure	*/
		TDE_POWERSUS	= 0x34,	/* auto suspend	*/
		TDE_POWERUPTM	= 0x35,	/* clock update	*/
		TDE_CKPWON	= 0x41	/* auto power on notification	*/
	} TDEvttyp;

Device events are noti.ed in the following format. The contents of event noti.cation and size di.er with each event type.


	typedef struct t_devevt {
		TDEvttyp evttyp; /* event type */
		/* Information specific to each event type is appended here. */
	} T_DEVEVT;

The format of device event noti.cation with device ID is as follows.


	typedef struct t_devevt_id {
		TDEvttyp evttyp; /* event type */
		ID devid; /* device ID */
		/* Information specific to each event type is appended here. */
	} T_DEVEVT_ID;

See the device driver specifications for event details.

Measures must be taken so that if event noti.cation cannot be sent because the message buffer is full, the lack of noti.cation will not adversely a.ect operation on the receiving end. One option is to hold the noti.cation until space becomes available in the message buffer, but in that case other device driver processing should not, as a rule, be allowed to fall behind as a result. Processing on the receiving end should be designed to the extent possible to avoid message buffer overflow.

Comments