aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 03:01:53 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:53 -0400
commitb7df3910c1298fee8ed7b9dfd2da74b85df5539c (patch)
tree1948ee697c23a384dd0be625ebeee13062d73882 /drivers/media/dvb/dvb-usb
parent76b7cddfd576331761e945a508254abad11039e9 (diff)
[PATCH] drivers/media: convert to dynamic input_dev allocation
Input: convert drivers/media to dynamic input_dev allocation This is required for input_dev sysfs integration Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c50
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h3
2 files changed, 30 insertions, 23 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index fc7800f1743e..e5c6d9835e06 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -39,9 +39,9 @@ static void dvb_usb_read_remote_control(void *data)
39 d->last_event = event; 39 d->last_event = event;
40 case REMOTE_KEY_REPEAT: 40 case REMOTE_KEY_REPEAT:
41 deb_rc("key repeated\n"); 41 deb_rc("key repeated\n");
42 input_event(&d->rc_input_dev, EV_KEY, d->last_event, 1); 42 input_event(d->rc_input_dev, EV_KEY, event, 1);
43 input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); 43 input_event(d->rc_input_dev, EV_KEY, d->last_event, 0);
44 input_sync(&d->rc_input_dev); 44 input_sync(d->rc_input_dev);
45 break; 45 break;
46 default: 46 default:
47 break; 47 break;
@@ -53,8 +53,8 @@ static void dvb_usb_read_remote_control(void *data)
53 deb_rc("NO KEY PRESSED\n"); 53 deb_rc("NO KEY PRESSED\n");
54 if (d->last_state != REMOTE_NO_KEY_PRESSED) { 54 if (d->last_state != REMOTE_NO_KEY_PRESSED) {
55 deb_rc("releasing event %d\n",d->last_event); 55 deb_rc("releasing event %d\n",d->last_event);
56 input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); 56 input_event(d->rc_input_dev, EV_KEY, d->last_event, 0);
57 input_sync(&d->rc_input_dev); 57 input_sync(d->rc_input_dev);
58 } 58 }
59 d->last_state = REMOTE_NO_KEY_PRESSED; 59 d->last_state = REMOTE_NO_KEY_PRESSED;
60 d->last_event = 0; 60 d->last_event = 0;
@@ -63,8 +63,8 @@ static void dvb_usb_read_remote_control(void *data)
63 deb_rc("KEY PRESSED\n"); 63 deb_rc("KEY PRESSED\n");
64 deb_rc("pressing event %d\n",event); 64 deb_rc("pressing event %d\n",event);
65 65
66 input_event(&d->rc_input_dev, EV_KEY, event, 1); 66 input_event(d->rc_input_dev, EV_KEY, event, 1);
67 input_sync(&d->rc_input_dev); 67 input_sync(d->rc_input_dev);
68 68
69 d->last_event = event; 69 d->last_event = event;
70 d->last_state = REMOTE_KEY_PRESSED; 70 d->last_state = REMOTE_KEY_PRESSED;
@@ -73,8 +73,8 @@ static void dvb_usb_read_remote_control(void *data)
73 deb_rc("KEY_REPEAT\n"); 73 deb_rc("KEY_REPEAT\n");
74 if (d->last_state != REMOTE_NO_KEY_PRESSED) { 74 if (d->last_state != REMOTE_NO_KEY_PRESSED) {
75 deb_rc("repeating event %d\n",d->last_event); 75 deb_rc("repeating event %d\n",d->last_event);
76 input_event(&d->rc_input_dev, EV_KEY, d->last_event, 2); 76 input_event(d->rc_input_dev, EV_KEY, d->last_event, 2);
77 input_sync(&d->rc_input_dev); 77 input_sync(d->rc_input_dev);
78 d->last_state = REMOTE_KEY_REPEAT; 78 d->last_state = REMOTE_KEY_REPEAT;
79 } 79 }
80 default: 80 default:
@@ -89,24 +89,30 @@ schedule:
89int dvb_usb_remote_init(struct dvb_usb_device *d) 89int dvb_usb_remote_init(struct dvb_usb_device *d)
90{ 90{
91 int i; 91 int i;
92
92 if (d->props.rc_key_map == NULL || 93 if (d->props.rc_key_map == NULL ||
93 d->props.rc_query == NULL || 94 d->props.rc_query == NULL ||
94 dvb_usb_disable_rc_polling) 95 dvb_usb_disable_rc_polling)
95 return 0; 96 return 0;
96 97
97 /* Initialise the remote-control structures.*/ 98 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
98 init_input_dev(&d->rc_input_dev); 99 strlcpy(d->rc_phys, "/ir0", sizeof(d->rc_phys));
100
101 d->rc_input_dev = input_allocate_device();
102 if (!d->rc_input_dev)
103 return -ENOMEM;
99 104
100 d->rc_input_dev.evbit[0] = BIT(EV_KEY); 105 d->rc_input_dev->evbit[0] = BIT(EV_KEY);
101 d->rc_input_dev.keycodesize = sizeof(unsigned char); 106 d->rc_input_dev->keycodesize = sizeof(unsigned char);
102 d->rc_input_dev.keycodemax = KEY_MAX; 107 d->rc_input_dev->keycodemax = KEY_MAX;
103 d->rc_input_dev.name = "IR-receiver inside an USB DVB receiver"; 108 d->rc_input_dev->name = "IR-receiver inside an USB DVB receiver";
109 d->rc_input_dev->phys = d->rc_phys;
104 110
105 /* set the bits for the keys */ 111 /* set the bits for the keys */
106 deb_rc("key map size: %d\n",d->props.rc_key_map_size); 112 deb_rc("key map size: %d\n", d->props.rc_key_map_size);
107 for (i = 0; i < d->props.rc_key_map_size; i++) { 113 for (i = 0; i < d->props.rc_key_map_size; i++) {
108 deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); 114 deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i);
109 set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); 115 set_bit(d->props.rc_key_map[i].event, d->rc_input_dev->keybit);
110 } 116 }
111 117
112 /* Start the remote-control polling. */ 118 /* Start the remote-control polling. */
@@ -114,14 +120,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
114 d->props.rc_interval = 100; /* default */ 120 d->props.rc_interval = 100; /* default */
115 121
116 /* setting these two values to non-zero, we have to manage key repeats */ 122 /* setting these two values to non-zero, we have to manage key repeats */
117 d->rc_input_dev.rep[REP_PERIOD] = d->props.rc_interval; 123 d->rc_input_dev->rep[REP_PERIOD] = d->props.rc_interval;
118 d->rc_input_dev.rep[REP_DELAY] = d->props.rc_interval + 150; 124 d->rc_input_dev->rep[REP_DELAY] = d->props.rc_interval + 150;
119 125
120 input_register_device(&d->rc_input_dev); 126 input_register_device(d->rc_input_dev);
121 127
122 INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); 128 INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d);
123 129
124 info("schedule remote query interval to %d msecs.",d->props.rc_interval); 130 info("schedule remote query interval to %d msecs.", d->props.rc_interval);
125 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); 131 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval));
126 132
127 d->state |= DVB_USB_STATE_REMOTE; 133 d->state |= DVB_USB_STATE_REMOTE;
@@ -134,7 +140,7 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d)
134 if (d->state & DVB_USB_STATE_REMOTE) { 140 if (d->state & DVB_USB_STATE_REMOTE) {
135 cancel_delayed_work(&d->rc_query_work); 141 cancel_delayed_work(&d->rc_query_work);
136 flush_scheduled_work(); 142 flush_scheduled_work();
137 input_unregister_device(&d->rc_input_dev); 143 input_unregister_device(d->rc_input_dev);
138 } 144 }
139 d->state &= ~DVB_USB_STATE_REMOTE; 145 d->state &= ~DVB_USB_STATE_REMOTE;
140 return 0; 146 return 0;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 0e4f1035b0dd..b4a1a98006c7 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -300,7 +300,8 @@ struct dvb_usb_device {
300 int (*fe_init) (struct dvb_frontend *); 300 int (*fe_init) (struct dvb_frontend *);
301 301
302 /* remote control */ 302 /* remote control */
303 struct input_dev rc_input_dev; 303 struct input_dev *rc_input_dev;
304 char rc_phys[64];
304 struct work_struct rc_query_work; 305 struct work_struct rc_query_work;
305 u32 last_event; 306 u32 last_event;
306 int last_state; 307 int last_state;