Skip to content

Commit

Permalink
Add extra command for LBP6000 support
Browse files Browse the repository at this point in the history
Edited by mounaiban for clarity

Signed-off-by: mounaiban <29518031+mounaiban@users.noreply.github.com>
  • Loading branch information
rezaxdi authored and mounaiban committed Sep 21, 2022
1 parent faa773b commit 3b67cc9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/capt-command.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum capt_command {
CAPT_UPLOAD_2 = 0xE0A5,
CAPT_FIRE = 0xE0A7,
CAPT_JOB_END = 0xE0A9,
CAPT_LBP6000_SETUP_0 = 0xE0BA,

CAPT_JOB_SETUP = 0xE1A1,
CAPT_GPIO = 0xE1A2,
Expand Down
52 changes: 51 additions & 1 deletion src/prn_lbp2900.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ static const uint8_t lbp3010_gpio_init[] = {
0x00, 0x00, /* S7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

static const uint8_t lbp6000_init[] = {
0x01, 0x00,
};

static const struct capt_status_s *lbp2900_get_status(const struct printer_ops_s *ops)
{
const struct lbp2900_ops_s *lops = container_of(ops, struct lbp2900_ops_s, ops);
Expand Down Expand Up @@ -186,6 +190,31 @@ static void lbp3010_job_prologue(struct printer_state_s *state)
lbp2900_wait_ready(state->ops);
}

static void lbp6000_job_prologue(struct printer_state_s *state)
{
(void) state;
uint8_t buf[8];
size_t size;

capt_sendrecv(CAPT_IDENT, NULL, 0, NULL, 0);
sleep(1);
capt_init_status();
lbp2900_get_status(state->ops);

capt_sendrecv(CAPT_START_0, NULL, 0, NULL, 0);
capt_sendrecv(CAPT_JOB_BEGIN, magicbuf_0, ARRAY_SIZE(magicbuf_0), buf, &size);
job=WORD(buf[2], buf[3]);

capt_sendrecv(CAPT_GPIO, lbp3010_gpio_init, ARRAY_SIZE(lbp3010_gpio_init), NULL, 0);
lbp2900_wait_ready(state->ops);

capt_sendrecv(CAPT_LBP6000_SETUP_0, lbp6000_init, ARRAY_SIZE(lbp6000_init), NULL, 0);
lbp2900_wait_ready(state->ops);

send_job_start(1, 0);
lbp2900_wait_ready(state->ops);
}

static bool lbp2900_page_prologue(struct printer_state_s *state, const struct page_dims_s *dims)
{
const struct capt_status_s *status;
Expand Down Expand Up @@ -493,6 +522,27 @@ static struct lbp2900_ops_s lbp3010_ops = {
.get_status = capt_get_xstatus_only,
.wait_ready = capt_wait_xready_only,
};

static struct lbp2900_ops_s lbp6000_ops = {
.ops = {
.job_prologue = lbp6000_job_prologue,
.job_epilogue = lbp2900_job_epilogue,
.page_setup = lbp2900_page_setup,
.page_prologue = lbp2900_page_prologue,
.page_epilogue = lbp2900_page_epilogue,
.compress_band = ops_compress_band_hiscoa,
.send_band = ops_send_band_hiscoa,
.cancel_cleanup = lbp3010_cancel_cleanup,
.wait_user = lbp3010_wait_user,
},
.gpio = {
.init = lbp3010_gpio_init,
.blink = lbp3010_gpio_blink,
},
.get_status = capt_get_xstatus_only,
.wait_ready = capt_wait_xready_only,
};

register_printer("LBP3010/LBP3018/LBP3050", lbp3010_ops.ops, WORKS);
register_printer("LBP3100/LBP3108/LBP3150", lbp3010_ops.ops, EXPERIMENTAL);
register_printer("LBP6000/LBP6018", lbp3010_ops.ops, EXPERIMENTAL);
register_printer("LBP6000/LBP6018", lbp6000_ops.ops, EXPERIMENTAL);

0 comments on commit 3b67cc9

Please sign in to comment.