aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/ibmasmfs.c
diff options
context:
space:
mode:
authorMax Asbock <masbock@us.ibm.com>2005-06-21 20:16:34 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 22:07:35 -0400
commit278d72ae8803ffcd16070c95fe1d53f4466dc741 (patch)
tree6cee233065ff15a42dfa86b7b159c4b06bb01b3f /drivers/misc/ibmasm/ibmasmfs.c
parentb8acb808468a88a188d7c5aba3681c583a5785f9 (diff)
[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: Vernon Mauery <vernux@us.ibm.com> Signed-off-by: Max Asbock <masbock@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/misc/ibmasm/ibmasmfs.c')
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c89
1 files changed, 0 insertions, 89 deletions
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index c87ef7d82b70..ca839162e4f7 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -37,9 +37,7 @@
37 * | |-- event 37 * | |-- event
38 * | |-- reverse_heartbeat 38 * | |-- reverse_heartbeat
39 * | `-- remote_video 39 * | `-- remote_video
40 * | |-- connected
41 * | |-- depth 40 * | |-- depth
42 * | |-- events
43 * | |-- height 41 * | |-- height
44 * | `-- width 42 * | `-- width
45 * . 43 * .
@@ -50,9 +48,7 @@
50 * |-- event 48 * |-- event
51 * |-- reverse_heartbeat 49 * |-- reverse_heartbeat
52 * `-- remote_video 50 * `-- remote_video
53 * |-- connected
54 * |-- depth 51 * |-- depth
55 * |-- events
56 * |-- height 52 * |-- height
57 * `-- width 53 * `-- width
58 * 54 *
@@ -75,14 +71,6 @@
75 * remote_video/width: control remote display settings 71 * remote_video/width: control remote display settings
76 * write: set value 72 * write: set value
77 * read: read value 73 * read: read value
78 *
79 * remote_video/connected
80 * read: return "1" if web browser VNC java applet is connected,
81 * "0" otherwise
82 *
83 * remote_video/events
84 * read: sleep until a remote mouse or keyboard event occurs, then return
85 * then event.
86 */ 74 */
87 75
88#include <linux/fs.h> 76#include <linux/fs.h>
@@ -593,75 +581,6 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
593 return count; 581 return count;
594} 582}
595 583
596static int remote_event_file_open(struct inode *inode, struct file *file)
597{
598 struct service_processor *sp;
599 unsigned long flags;
600 struct remote_queue *q;
601
602 file->private_data = inode->u.generic_ip;
603 sp = file->private_data;
604 q = &sp->remote_queue;
605
606 /* allow only one event reader */
607 spin_lock_irqsave(&sp->lock, flags);
608 if (q->open) {
609 spin_unlock_irqrestore(&sp->lock, flags);
610 return -EBUSY;
611 }
612 q->open = 1;
613 spin_unlock_irqrestore(&sp->lock, flags);
614
615 enable_mouse_interrupts(sp);
616
617 return 0;
618}
619
620static int remote_event_file_close(struct inode *inode, struct file *file)
621{
622 struct service_processor *sp = file->private_data;
623
624 disable_mouse_interrupts(sp);
625 wake_up_interruptible(&sp->remote_queue.wait);
626 sp->remote_queue.open = 0;
627
628 return 0;
629}
630
631static ssize_t remote_event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
632{
633 struct service_processor *sp = file->private_data;
634 struct remote_queue *q = &sp->remote_queue;
635 size_t data_size;
636 struct remote_event *reader = q->reader;
637 size_t num_events;
638
639 if (*offset < 0)
640 return -EINVAL;
641 if (count == 0 || count > 1024)
642 return 0;
643 if (*offset != 0)
644 return 0;
645
646 if (wait_event_interruptible(q->wait, q->reader != q->writer))
647 return -ERESTARTSYS;
648
649 /* only get multiples of struct remote_event */
650 num_events = min((count/sizeof(struct remote_event)), ibmasm_events_available(q));
651 if (!num_events)
652 return 0;
653
654 data_size = num_events * sizeof(struct remote_event);
655
656 if (copy_to_user(buf, reader, data_size))
657 return -EFAULT;
658
659 ibmasm_advance_reader(q, num_events);
660
661 return data_size;
662}
663
664
665static struct file_operations command_fops = { 584static struct file_operations command_fops = {
666 .open = command_file_open, 585 .open = command_file_open,
667 .release = command_file_close, 586 .release = command_file_close,
@@ -690,12 +609,6 @@ static struct file_operations remote_settings_fops = {
690 .write = remote_settings_file_write, 609 .write = remote_settings_file_write,
691}; 610};
692 611
693static struct file_operations remote_event_fops = {
694 .open = remote_event_file_open,
695 .release = remote_event_file_close,
696 .read = remote_event_file_read,
697};
698
699 612
700static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root) 613static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
701{ 614{
@@ -721,7 +634,5 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
721 ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR); 634 ibmasmfs_create_file(sb, remote_dir, "width", &remote_settings_fops, (void *)display_width(sp), S_IRUSR|S_IWUSR);
722 ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR); 635 ibmasmfs_create_file(sb, remote_dir, "height", &remote_settings_fops, (void *)display_height(sp), S_IRUSR|S_IWUSR);
723 ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR); 636 ibmasmfs_create_file(sb, remote_dir, "depth", &remote_settings_fops, (void *)display_depth(sp), S_IRUSR|S_IWUSR);
724 ibmasmfs_create_file(sb, remote_dir, "connected", &remote_settings_fops, (void *)vnc_status(sp), S_IRUSR);
725 ibmasmfs_create_file(sb, remote_dir, "events", &remote_event_fops, (void *)sp, S_IRUSR);
726 } 637 }
727} 638}