/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space.  */
static int get_lsr_info(struct tty_struct *tty, struct moschip_port *mos7720_port, unsigned int __user *value)
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space.  */
static int get_lsr_info(struct tty_struct *tty, struct moschip_port *mos7720_port, unsigned int __user *value)
{
	struct usb_serial_port *port = tty->driver_data;
	unsigned int result = 0;
	unsigned char data = 0;
	int port_number = port->number - port->serial->minor;
	int count;
	count = mos7720_chars_in_buffer(tty);
	if (count == 0) {
		send_mos_cmd(port->serial, MOS_READ, port_number,
							UART_LSR, &data);
		if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
					== (UART_LSR_TEMT | UART_LSR_THRE)) {
			dbg("%s -- Empty", __func__);
			result = TIOCSER_TEMT;
		}
	}
	if (copy_to_user(value, &result, sizeof(int)))
		return -EFAULT;
	return 0;
}