1 #include <minix/drivers.h>
3 /* State management variables. */
5 EXTERN
int is_status_msg_expected
;
7 /* Custom states definition. */
8 #define PR_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
9 #define PR_STATE_IS_CUSTOM(s) ((s) == PR_STATE_WRITE_PROTOCOL_FREE)
11 /*===========================================================================*
13 *===========================================================================*/
14 int sef_cb_lu_prepare(int state
)
18 /* Check if we are ready for the target state. */
21 /* Standard states. */
22 case SEF_LU_STATE_REQUEST_FREE
:
26 case SEF_LU_STATE_PROTOCOL_FREE
:
27 is_ready
= (!writing
&& !is_status_msg_expected
);
31 case PR_STATE_WRITE_PROTOCOL_FREE
:
32 is_ready
= (!writing
);
36 /* Tell SEF if we are ready. */
37 return is_ready
? OK
: ENOTREADY
;
40 /*===========================================================================*
41 * sef_cb_lu_state_isvalid *
42 *===========================================================================*/
43 int sef_cb_lu_state_isvalid(int state
)
45 return SEF_LU_STATE_IS_STANDARD(state
) || PR_STATE_IS_CUSTOM(state
);
48 /*===========================================================================*
49 * sef_cb_lu_state_dump *
50 *===========================================================================*/
51 void sef_cb_lu_state_dump(int state
)
53 sef_lu_dprint("printer: live update state = %d\n", state
);
54 sef_lu_dprint("printer: writing = %d\n", writing
);
55 sef_lu_dprint("printer: is_status_msg_expected = %d\n",
56 is_status_msg_expected
);
58 sef_lu_dprint("printer: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
59 SEF_LU_STATE_WORK_FREE
, TRUE
);
60 sef_lu_dprint("printer: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
61 SEF_LU_STATE_REQUEST_FREE
, TRUE
);
62 sef_lu_dprint("printer: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
63 SEF_LU_STATE_PROTOCOL_FREE
, (!writing
&& !is_status_msg_expected
));
64 sef_lu_dprint("printer: PR_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
65 PR_STATE_WRITE_PROTOCOL_FREE
, (!writing
));