1 #include <minix/drivers.h>
3 /* State management variables. */
6 /* Custom states definition. */
7 #define PR_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
8 #define PR_STATE_IS_CUSTOM(s) ((s) == PR_STATE_WRITE_PROTOCOL_FREE)
10 /*===========================================================================*
12 *===========================================================================*/
13 int sef_cb_lu_prepare(int state
)
17 /* Check if we are ready for the target state. */
20 /* Standard states. */
21 case SEF_LU_STATE_REQUEST_FREE
:
25 case SEF_LU_STATE_PROTOCOL_FREE
:
26 is_ready
= (!writing
);
30 case PR_STATE_WRITE_PROTOCOL_FREE
:
31 is_ready
= (!writing
);
35 /* Tell SEF if we are ready. */
36 return is_ready
? OK
: ENOTREADY
;
39 /*===========================================================================*
40 * sef_cb_lu_state_isvalid *
41 *===========================================================================*/
42 int sef_cb_lu_state_isvalid(int state
)
44 return SEF_LU_STATE_IS_STANDARD(state
) || PR_STATE_IS_CUSTOM(state
);
47 /*===========================================================================*
48 * sef_cb_lu_state_dump *
49 *===========================================================================*/
50 void sef_cb_lu_state_dump(int state
)
52 sef_lu_dprint("printer: live update state = %d\n", state
);
53 sef_lu_dprint("printer: writing = %d\n", writing
);
55 sef_lu_dprint("printer: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
56 SEF_LU_STATE_WORK_FREE
, TRUE
);
57 sef_lu_dprint("printer: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
58 SEF_LU_STATE_REQUEST_FREE
, TRUE
);
59 sef_lu_dprint("printer: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
60 SEF_LU_STATE_PROTOCOL_FREE
, (!writing
));
61 sef_lu_dprint("printer: PR_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
62 PR_STATE_WRITE_PROTOCOL_FREE
, (!writing
));