Commit 278d72ae authored by Max Asbock's avatar Max Asbock Committed by Linus Torvalds

[PATCH] ibmasm driver: redesign handling of remote control events

This patch rewrites the handling of remote control events.  Rather than making
them available from a special file in the ibmasmfs, now the events from the
RSA card get translated into kernel input events and injected into the input
subsystem.  The driver now will generate two /dev/input/eventX nodes -- one
for the keyboard and one for the mouse.  The mouse node generates absolute
events more like a touch pad than a mouse.
Signed-off-by: default avatarVernon Mauery <vernux@us.ibm.com>
Signed-off-by: default avatarMax Asbock <masbock@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b8acb808
......@@ -34,16 +34,31 @@
#include <linux/version.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/input.h>
/* Driver identification */
#define DRIVER_NAME "ibmasm"
#define DRIVER_VERSION "0.4"
#define DRIVER_AUTHOR "Max Asbock"
#define DRIVER_VERSION "1.0"
#define DRIVER_AUTHOR "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>"
#define DRIVER_DESC "IBM ASM Service Processor Driver"
#define err(msg) printk(KERN_ERR "%s: " msg "\n", DRIVER_NAME)
#define info(msg) printk(KERN_INFO "%s: " msg "\n", DRIVER_NAME)
extern int ibmasm_debug;
#define dbg(STR, ARGS...) \
do { \
if (ibmasm_debug) \
printk(KERN_DEBUG STR , ##ARGS); \
} while (0)
static inline char *get_timestamp(char *buf)
{
struct timeval now;
do_gettimeofday(&now);
sprintf(buf, "%lu.%lu", now.tv_sec, now.tv_usec);
return buf;
}
#define IBMASM_CMD_PENDING 0
#define IBMASM_CMD_COMPLETE 1
......@@ -121,41 +136,11 @@ struct reverse_heartbeat {
unsigned int stopped;
};
/* remote console events */
struct mouse_event {
long x;
long y;
unsigned char buttons;
unsigned char transitions;
struct ibmasm_remote {
struct input_dev keybd_dev;
struct input_dev mouse_dev;
};
struct keyboard_event {
unsigned long key_code;
unsigned char key_down;
};
struct remote_event {
unsigned long type;
union {
struct mouse_event mouse;
struct keyboard_event keyboard;
} data;
};
#define DRIVER_REMOTE_QUEUE_SIZE 240
struct remote_queue {
struct remote_event *start;
struct remote_event *end;
struct remote_event *reader;
struct remote_event *writer;
unsigned int size;
int open;
wait_queue_head_t wait;
};
struct service_processor {
struct list_head node;
spinlock_t lock;
......@@ -168,7 +153,7 @@ struct service_processor {
char dirname[IBMASM_NAME_SIZE];
char devname[IBMASM_NAME_SIZE];
unsigned int number;
struct remote_queue remote_queue;
struct ibmasm_remote *remote;
int serial_line;
struct device *dev;
};
......@@ -210,11 +195,9 @@ extern int ibmasm_send_i2o_message(struct service_processor *sp);
extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *regs);
/* remote console */
extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp);
extern int ibmasm_init_remote_queue(struct service_processor *sp);
extern void ibmasm_free_remote_queue(struct service_processor *sp);
extern void ibmasm_advance_reader(struct remote_queue *q, unsigned int n);
extern size_t ibmasm_events_available(struct remote_queue *q);
extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp, struct pt_regs *regs);
extern int ibmasm_init_remote_input_dev(struct service_processor *sp);
extern void ibmasm_free_remote_input_dev(struct service_processor *sp);
/* file system */
extern int ibmasmfs_register(void);
......
......@@ -37,9 +37,7 @@
* | |-- event
* | |-- reverse_heartbeat
* | `-- remote_video
* | |-- connected
* | |-- depth
* | |-- events
* | |-- height
* | `-- width
* .
......@@ -50,9 +48,7 @@
* |-- event
* |-- reverse_heartbeat
* `-- remote_video
* |-- connected
* |-- depth
* |-- events
* |-- height
* `-- width
*
......@@ -75,14 +71,6 @@
* remote_video/width: control remote display settings
* write: set value
* read: read value
*
* remote_video/connected
* read: return "1" if web browser VNC java applet is connected,
* "0" otherwise
*
* remote_video/events
* read: sleep until a remote mouse or keyboard event occurs, then return
* then event.
*/
#include <linux/fs.h>
......@@ -593,75 +581,6 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
return count;
}
static int remote_event_file_open(struct inode *inode, struct file *file)
{
struct service_processor *sp;
unsigned long flags;
struct remote_queue *q;
file->private_data = inode->u.generic_ip;
sp = file->private_data;
q = &sp->remote_queue;
/* allow only one event reader */
spin_lock_irqsave(&sp->lock, flags);
if (q->open) {
spin_unlock_irqrestore(&sp->lock, flags);
return -EBUSY;
}
q->open = 1;
spin_unlock_irqrestore(&sp->lock, flags);
enable_mouse_interrupts(sp);
return 0;
}
static int remote_event_file_close(struct inode *inode, struct file *file)
{
struct service_processor *sp = file->private_data;
disable_mouse_interrupts(sp);
wake_up_interruptible(&sp->remote_queue.wait);
sp->remote_queue.open = 0;
return 0;
}
static ssize_t remote_event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
struct service_processor *sp = file->private_data;
struct remote_queue *q = &sp->remote_queue;
size_t data_size;
struct remote_event *reader = q->reader;
size_t num_events;
if (*offset < 0)
return -EINVAL;
if (count == 0 || count > 1024)
return 0;
if (*offset != 0)
return 0;
if (wait_event_interruptible(q->wait, q->reader != q->writer))
return -ERESTARTSYS;
/* only get multiples of struct remote_event */
num_events = min((count/sizeof(struct remote_event)), ibmasm_events_available(q));
if (!num_events)
return 0;
data_size = num_events * sizeof(struct remote_event);
if (copy_to_user(buf, reader, data_size))
return -EFAULT;
ibmasm_advance_reader(q, num_events);
return data_size;
}
static struct file_operations command_fops = {
.open = command_file_open,
.release = command_file_close,
......@@ -690,12 +609,6 @@ static struct file_operations remote_settings_fops = {
.write = remote_settings_file_write,
};
static struct file_operations remote_event_fops = {
.open = remote_event_file_open,
.release = remote_event_file_close,
.read = remote_event_file_read,
};
static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
{
......@@ -721,7 +634,5 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR);
ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR);
ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR);
ibmasmfs_create_file(sb, remote_dir, "connected", &remote_settings_fops, (void *)vnc_status(sp), S_IRUSR);
ibmasmfs_create_file(sb, remote_dir, "events", &remote_event_fops, (void *)sp, S_IRUSR);
}
}
......@@ -46,8 +46,8 @@ int ibmasm_send_i2o_message(struct service_processor *sp)
message = get_i2o_message(sp->base_address, mfa);
memcpy(&message->header, &header, sizeof(struct i2o_header));
memcpy(&message->data, command->buffer, command_size);
memcpy_toio(&message->header, &header, sizeof(struct i2o_header));
memcpy_toio(&message->data, command->buffer, command_size);
set_mfa_inbound(sp->base_address, mfa);
......@@ -59,23 +59,27 @@ irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id, struct pt_regs *reg
u32 mfa;
struct service_processor *sp = (struct service_processor *)dev_id;
void __iomem *base_address = sp->base_address;
char tsbuf[32];
if (!sp_interrupt_pending(base_address))
return IRQ_NONE;
dbg("respond to interrupt at %s\n", get_timestamp(tsbuf));
if (mouse_interrupt_pending(sp)) {
ibmasm_handle_mouse_interrupt(sp);
mfa = get_mfa_outbound(base_address);
ibmasm_handle_mouse_interrupt(sp, regs);
clear_mouse_interrupt(sp);
set_mfa_outbound(base_address, mfa);
return IRQ_HANDLED;
}
mfa = get_mfa_outbound(base_address);
if (valid_mfa(mfa)) {
struct i2o_message *msg = get_i2o_message(base_address, mfa);
ibmasm_receive_message(sp, &msg->data, incoming_data_size(msg));
}
} else
dbg("didn't get a valid MFA\n");
set_mfa_outbound(base_address, mfa);
dbg("finished interrupt at %s\n", get_timestamp(tsbuf));
return IRQ_HANDLED;
}
......@@ -56,17 +56,26 @@
#include "lowlevel.h"
#include "remote.h"
int ibmasm_debug = 0;
module_param(ibmasm_debug, int , S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ibmasm_debug, " Set debug mode on or off");
static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
int err, result = -ENOMEM;
int result;
struct service_processor *sp;
if ((err = pci_enable_device(pdev))) {
printk(KERN_ERR "%s: can't enable PCI device at %s\n",
DRIVER_NAME, pci_name(pdev));
return err;
if ((result = pci_enable_device(pdev))) {
dev_err(&pdev->dev, "Failed to enable PCI device\n");
return result;
}
if ((result = pci_request_regions(pdev, DRIVER_NAME))) {
dev_err(&pdev->dev, "Failed to allocate PCI resources\n");
goto error_resources;
}
/* vnc client won't work without bus-mastering */
pci_set_master(pdev);
sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL);
if (sp == NULL) {
......@@ -76,6 +85,9 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
}
memset(sp, 0, sizeof(struct service_processor));
sp->lock = SPIN_LOCK_UNLOCKED;
INIT_LIST_HEAD(&sp->command_queue);
pci_set_drvdata(pdev, (void *)sp);
sp->dev = &pdev->dev;
sp->number = pdev->bus->number;
......@@ -101,15 +113,6 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
goto error_ioremap;
}
result = ibmasm_init_remote_queue(sp);
if (result) {
dev_err(sp->dev, "Failed to initialize remote queue\n");
goto error_remote_queue;
}
spin_lock_init(&sp->lock);
INIT_LIST_HEAD(&sp->command_queue);
result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);
if (result) {
dev_err(sp->dev, "Failed to register interrupt handler\n");
......@@ -117,7 +120,12 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
}
enable_sp_interrupts(sp->base_address);
disable_mouse_interrupts(sp);
result = ibmasm_init_remote_input_dev(sp);
if (result) {
dev_err(sp->dev, "Failed to initialize remote queue\n");
goto error_send_message;
}
result = ibmasm_send_driver_vpd(sp);
if (result) {
......@@ -133,30 +141,25 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
ibmasm_register_uart(sp);
dev_printk(KERN_DEBUG, &pdev->dev, "WARNING: This software may not be supported or function\n");
dev_printk(KERN_DEBUG, &pdev->dev, "correctly on your IBM server. Please consult the IBM\n");
dev_printk(KERN_DEBUG, &pdev->dev, "ServerProven website\n");
dev_printk(KERN_DEBUG, &pdev->dev, "http://www.pc.ibm.com/ww/eserver/xseries/serverproven\n");
dev_printk(KERN_DEBUG, &pdev->dev, "for information on the specific driver level and support\n");
dev_printk(KERN_DEBUG, &pdev->dev, "statement for your IBM server.\n");
return 0;
error_send_message:
disable_sp_interrupts(sp->base_address);
ibmasm_free_remote_input_dev(sp);
free_irq(sp->irq, (void *)sp);
error_request_irq:
ibmasm_free_remote_queue(sp);
error_remote_queue:
iounmap(sp->base_address);
error_ioremap:
ibmasm_heartbeat_exit(sp);
error_heartbeat:
ibmasm_event_buffer_exit(sp);
error_eventbuffer:
pci_set_drvdata(pdev, NULL);
kfree(sp);
error_kmalloc:
pci_disable_device(pdev);
pci_release_regions(pdev);
error_resources:
pci_disable_device(pdev);
return result;
}
......@@ -165,16 +168,24 @@ static void __devexit ibmasm_remove_one(struct pci_dev *pdev)
{
struct service_processor *sp = (struct service_processor *)pci_get_drvdata(pdev);
dbg("Unregistering UART\n");
ibmasm_unregister_uart(sp);
ibmasm_send_os_state(sp, SYSTEM_STATE_OS_DOWN);
dbg("Sending OS down message\n");
if (ibmasm_send_os_state(sp, SYSTEM_STATE_OS_DOWN))
err("failed to get repsonse to 'Send OS State' command\n");
dbg("Disabling heartbeats\n");
ibmasm_heartbeat_exit(sp);
dbg("Disabling interrupts\n");
disable_sp_interrupts(sp->base_address);
disable_mouse_interrupts(sp);
dbg("Freeing SP irq\n");
free_irq(sp->irq, (void *)sp);
ibmasm_heartbeat_exit(sp);
ibmasm_free_remote_queue(sp);
dbg("Cleaning up\n");
ibmasm_free_remote_input_dev(sp);
iounmap(sp->base_address);
ibmasm_event_buffer_exit(sp);
pci_set_drvdata(pdev, NULL);
kfree(sp);
pci_release_regions(pdev);
pci_disable_device(pdev);
}
......
/*
* IBM ASM Service Processor Device Driver
*
......@@ -18,135 +17,256 @@
*
* Copyright (C) IBM Corporation, 2004
*
* Author: Max Asbck <amax@us.ibm.com>
* Authors: Max Asbck <amax@us.ibm.com>
* Vernon Mauery <vernux@us.ibm.com>
*
*/
/* Remote mouse and keyboard event handling functions */
#include <linux/pci.h>
#include "ibmasm.h"
#include "remote.h"
int ibmasm_init_remote_queue(struct service_processor *sp)
{
struct remote_queue *q = &sp->remote_queue;
disable_mouse_interrupts(sp);
static int xmax = 1600;
static int ymax = 1200;
q->open = 0;
q->size = 0;
q->start = kmalloc(DRIVER_REMOTE_QUEUE_SIZE * sizeof(struct remote_event), GFP_KERNEL);
if (q->start == 0)
return -ENOMEM;
static unsigned short xlate_high[XLATE_SIZE] = {
[KEY_SYM_ENTER & 0xff] = KEY_ENTER,
[KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH,
[KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK,
[KEY_SYM_KPMINUS & 0xff] = KEY_KPMINUS,
[KEY_SYM_KPDOT & 0xff] = KEY_KPDOT,
[KEY_SYM_KPPLUS & 0xff] = KEY_KPPLUS,
[KEY_SYM_KP0 & 0xff] = KEY_KP0,
[KEY_SYM_KP1 & 0xff] = KEY_KP1,
[KEY_SYM_KP2 & 0xff] = KEY_KP2, [KEY_SYM_KPDOWN & 0xff] = KEY_KP2,
[KEY_SYM_KP3 & 0xff] = KEY_KP3,
[KEY_SYM_KP4 & 0xff] = KEY_KP4, [KEY_SYM_KPLEFT & 0xff] = KEY_KP4,
[KEY_SYM_KP5 & 0xff] = KEY_KP5,
[KEY_SYM_KP6 & 0xff] = KEY_KP6, [KEY_SYM_KPRIGHT & 0xff] = KEY_KP6,
[KEY_SYM_KP7 & 0xff] = KEY_KP7,
[KEY_SYM_KP8 & 0xff] = KEY_KP8, [KEY_SYM_KPUP & 0xff] = KEY_KP8,
[KEY_SYM_KP9 & 0xff] = KEY_KP9,
[KEY_SYM_BK_SPC & 0xff] = KEY_BACKSPACE,
[KEY_SYM_TAB & 0xff] = KEY_TAB,
[KEY_SYM_CTRL & 0xff] = KEY_LEFTCTRL,
[KEY_SYM_ALT & 0xff] = KEY_LEFTALT,
[KEY_SYM_INSERT & 0xff] = KEY_INSERT,
[KEY_SYM_DELETE & 0xff] = KEY_DELETE,
[KEY_SYM_SHIFT & 0xff] = KEY_LEFTSHIFT,
[KEY_SYM_UARROW & 0xff] = KEY_UP,
[KEY_SYM_DARROW & 0xff] = KEY_DOWN,
[KEY_SYM_LARROW & 0xff] = KEY_LEFT,
[KEY_SYM_RARROW & 0xff] = KEY_RIGHT,
[KEY_SYM_ESCAPE & 0xff] = KEY_ESC,
[KEY_SYM_PAGEUP & 0xff] = KEY_PAGEUP,
[KEY_SYM_PAGEDOWN & 0xff] = KEY_PAGEDOWN,
[KEY_SYM_HOME & 0xff] = KEY_HOME,
[KEY_SYM_END & 0xff] = KEY_END,
[KEY_SYM_F1 & 0xff] = KEY_F1,
[KEY_SYM_F2 & 0xff] = KEY_F2,
[KEY_SYM_F3 & 0xff] = KEY_F3,
[KEY_SYM_F4 & 0xff] = KEY_F4,
[KEY_SYM_F5 & 0xff] = KEY_F5,
[KEY_SYM_F6 & 0xff] = KEY_F6,
[KEY_SYM_F7 & 0xff] = KEY_F7,
[KEY_SYM_F8 & 0xff] = KEY_F8,
[KEY_SYM_F9 & 0xff] = KEY_F9,
[KEY_SYM_F10 & 0xff] = KEY_F10,
[KEY_SYM_F11 & 0xff] = KEY_F11,
[KEY_SYM_F12 & 0xff] = KEY_F12,
[KEY_SYM_CAP_LOCK & 0xff] = KEY_CAPSLOCK,
[KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK,
[KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK,
};
static unsigned short xlate[XLATE_SIZE] = {
[NO_KEYCODE] = KEY_RESERVED,
[KEY_SYM_SPACE] = KEY_SPACE,
[KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE,
[KEY_SYM_ONE] = KEY_1, [KEY_SYM_BANG] = KEY_1,
[KEY_SYM_TWO] = KEY_2, [KEY_SYM_AT] = KEY_2,
[KEY_SYM_THREE] = KEY_3, [KEY_SYM_POUND] = KEY_3,
[KEY_SYM_FOUR] = KEY_4, [KEY_SYM_DOLLAR] = KEY_4,
[KEY_SYM_FIVE] = KEY_5, [KEY_SYM_PERCENT] = KEY_5,
[KEY_SYM_SIX] = KEY_6, [KEY_SYM_CARAT] = KEY_6,
[KEY_SYM_SEVEN] = KEY_7, [KEY_SYM_AMPER] = KEY_7,
[KEY_SYM_EIGHT] = KEY_8, [KEY_SYM_STAR] = KEY_8,
[KEY_SYM_NINE] = KEY_9, [KEY_SYM_LPAREN] = KEY_9,
[KEY_SYM_ZERO] = KEY_0, [KEY_SYM_RPAREN] = KEY_0,
[KEY_SYM_MINUS] = KEY_MINUS, [KEY_SYM_USCORE] = KEY_MINUS,
[KEY_SYM_EQUAL] = KEY_EQUAL, [KEY_SYM_PLUS] = KEY_EQUAL,
[KEY_SYM_LBRKT] = KEY_LEFTBRACE, [KEY_SYM_LCURLY] = KEY_LEFTBRACE,
[KEY_SYM_RBRKT] = KEY_RIGHTBRACE, [KEY_SYM_RCURLY] = KEY_RIGHTBRACE,
[KEY_SYM_SLASH] = KEY_BACKSLASH, [KEY_SYM_PIPE] = KEY_BACKSLASH,
[KEY_SYM_TIC] = KEY_APOSTROPHE, [KEY_SYM_QUOTE] = KEY_APOSTROPHE,
[KEY_SYM_SEMIC] = KEY_SEMICOLON, [KEY_SYM_COLON] = KEY_SEMICOLON,
[KEY_SYM_COMMA] = KEY_COMMA, [KEY_SYM_LT] = KEY_COMMA,
[KEY_SYM_PERIOD] = KEY_DOT, [KEY_SYM_GT] = KEY_DOT,
[KEY_SYM_BSLASH] = KEY_SLASH, [KEY_SYM_QMARK] = KEY_SLASH,
[KEY_SYM_A] = KEY_A, [KEY_SYM_a] = KEY_A,
[KEY_SYM_B] = KEY_B, [KEY_SYM_b] = KEY_B,
[KEY_SYM_C] = KEY_C, [KEY_SYM_c] = KEY_C,
[KEY_SYM_D] = KEY_D, [KEY_SYM_d] = KEY_D,
[KEY_SYM_E] = KEY_E, [KEY_SYM_e] = KEY_E,
[KEY_SYM_F] = KEY_F, [KEY_SYM_f] = KEY_F,
[KEY_SYM_G] = KEY_G, [KEY_SYM_g] = KEY_G,
[KEY_SYM_H] = KEY_H, [KEY_SYM_h] = KEY_H,
[KEY_SYM_I] = KEY_I, [KEY_SYM_i] = KEY_I,
[KEY_SYM_J] = KEY_J, [KEY_SYM_j] = KEY_J,
[KEY_SYM_K] = KEY_K, [KEY_SYM_k] = KEY_K,
[KEY_SYM_L] = KEY_L, [KEY_SYM_l] = KEY_L,
[KEY_SYM_M] = KEY_M, [KEY_SYM_m] = KEY_M,
[KEY_SYM_N] = KEY_N, [KEY_SYM_n] = KEY_N,
[KEY_SYM_O] = KEY_O, [KEY_SYM_o] = KEY_O,
[KEY_SYM_P] = KEY_P, [KEY_SYM_p] = KEY_P,
[KEY_SYM_Q] = KEY_Q, [KEY_SYM_q] = KEY_Q,
[KEY_SYM_R] = KEY_R, [KEY_SYM_r] = KEY_R,
[KEY_SYM_S] = KEY_S, [KEY_SYM_s] = KEY_S,
[KEY_SYM_T] = KEY_T, [KEY_SYM_t] = KEY_T,
[KEY_SYM_U] = KEY_U, [KEY_SYM_u] = KEY_U,
[KEY_SYM_V] = KEY_V, [KEY_SYM_v] = KEY_V,
[KEY_SYM_W] = KEY_W, [KEY_SYM_w] = KEY_W,
[KEY_SYM_X] = KEY_X, [KEY_SYM_x] = KEY_X,
[KEY_SYM_Y] = KEY_Y, [KEY_SYM_y] = KEY_Y,
[KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z,
};
q->end = q->start + DRIVER_REMOTE_QUEUE_SIZE;
q->reader = q->start;
q->writer = q->start;
q->size = DRIVER_REMOTE_QUEUE_SIZE;
init_waitqueue_head(&q->wait);
static char remote_mouse_name[] = "ibmasm RSA I remote mouse";
static char remote_keybd_name[] = "ibmasm RSA I remote keyboard";
return 0;
}
void ibmasm_free_remote_queue(struct service_processor *sp)
static void print_input(struct remote_input *input)
{
kfree(sp->remote_queue.start);
if (input->type == INPUT_TYPE_MOUSE) {
unsigned char buttons = input->mouse_buttons;
dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n",
input->data.mouse.x, input->data.mouse.y,
(buttons)?" -- buttons:":"",
(buttons & REMOTE_BUTTON_LEFT)?"left ":"",
(buttons & REMOTE_BUTTON_MIDDLE)?"middle ":"",
(buttons & REMOTE_BUTTON_RIGHT)?"right":""
);
} else {
dbg("remote keypress (code, flag, down):"
"%d (0x%x) [0x%x] [0x%x]\n",
input->data.keyboard.key_code,
input->data.keyboard.key_code,
input->data.keyboard.key_flag,
input->data.keyboard.key_down
);
}
}
void ibmasm_advance_reader(struct remote_queue *q, unsigned int n)
static void send_mouse_event(struct input_dev *dev, struct pt_regs *regs,
struct remote_input *input)
{
q->reader += n;
if (q->reader >= q->end)
q->reader -= q->size;
}
unsigned char buttons = input->mouse_buttons;
size_t ibmasm_events_available(struct remote_queue *q)
{
ssize_t diff = q->writer - q->reader;
return (diff >= 0) ? diff : q->end - q->reader;
input_regs(dev, regs);
input_report_abs(dev, ABS_X, input->data.mouse.x);
input_report_abs(dev, ABS_Y, input->data.mouse.y);
input_report_key(dev, BTN_LEFT, buttons & REMOTE_BUTTON_LEFT);
input_report_key(dev, BTN_MIDDLE, buttons & REMOTE_BUTTON_MIDDLE);
input_report_key(dev, BTN_RIGHT, buttons & REMOTE_BUTTON_RIGHT);
input_sync(dev);
}
static int space_free(struct remote_queue *q)
static void send_keyboard_event(struct input_dev *dev, struct pt_regs *regs,
struct remote_input *input)
{