// 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.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; ;

tz30_send(dev, kbuf, count); kfree(kbuf); return count;

def reset(self): self.ser.write(b'\x1B\x40') time.sleep(0.5)

// Add ESC/POS init if buffer empty if(dev->buffer_pos == 0) u8 init_seq[] = 0x1B, 0x40; tz30_send(dev, init_seq, 2);