static ssize_t
write_aux(struct file *file, const char *buffer, size_t count,
	  loff_t * ppos)
{
	ssize_t retval = 0;

	if (count) {
		ssize_t written = 0;

		if (count > 32)
			count = 32;	/* Limit to 32 bytes. */
		do {
			char c;
			get_user(c, buffer++);
			aux_write_dev(c);
			written++;
		}
		while (--count);
		retval = -EIO;
		if (written) {
			retval = written;
			file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
		}
	}

	return retval;
}
Example #2
0
/*
 * Write to the aux device.
 */
static int write_aux( int minor, const char * buffer, int count )
{
  int retval = 0;

  if (count) {
    int written = 0;
    if (count > 32)
      count = 32; /* Limit to 32 bytes. */
    do {
      char c;
      c = *buffer++;
      aux_write_dev(c);
      written++;
    } while (--count);
    retval = -EIO;
    if (written) {
      retval = written;
    }
  }
  return retval;
}
Example #3
0
static int open_aux(struct inode * inode, struct file * file)
{
	if (!aux_present)
		return -ENODEV;
	if (aux_count++)
		return 0;
	if (!poll_aux_status()) {
		aux_count--;
		return -EBUSY;
	}
	queue->head = queue->tail = 0;		/* Flush input queue */
	if (request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)) {
		aux_count--;
		return -EBUSY;
	}
	MOD_INC_USE_COUNT;
	poll_aux_status();
	outb_p(AUX_ENABLE,AUX_COMMAND);		/* Enable Aux */
	aux_write_dev(AUX_ENABLE_DEV);		/* enable aux device */
	aux_write_cmd(AUX_INTS_ON);		/* enable controller ints */
	poll_aux_status();
	aux_ready = 0;
	return 0;
}