Citizen Tz30-m01 - Driver

static long tz30_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) struct tz30_device *dev = filp->private_data; switch(cmd) case TZ30_CMD_CUT: tz30_send(dev, "\x1D\x56\x01", 3); // full cut break; case TZ30_CMD_STATUS: return tz30_get_status(dev);

// citizen_tz30.c static ssize_t tz30_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) struct tz30_device *dev = filp->private_data; u8 *kbuf = kmalloc(count, GFP_KERNEL); if(copy_from_user(kbuf, buf, count)) return -EFAULT; citizen tz30-m01 driver

def print_line(self, text): self.ser.write(text.encode() + b'\n') static long tz30_ioctl(struct file *filp, unsigned int cmd,

// Add ESC/POS init if buffer empty if(dev->buffer_pos == 0) u8 init_seq[] = 0x1B, 0x40; tz30_send(dev, init_seq, 2); static long tz30_ioctl(struct file *filp

// citizen_tz30.h #define TZ30_MAJOR 240 #define TZ30_CMD_RESET 0x01 #define TZ30_CMD_CUT 0x02 #define TZ30_CMD_STATUS 0x03 struct tz30_device struct uart_port *uart; struct cdev cdev; wait_queue_head_t write_wait; spinlock_t lock; bool paper_out; bool cover_open; ;