aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 0085567a1421..801c736e9328 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -183,6 +183,58 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
183 return 1; 183 return 1;
184} 184}
185 185
186/* The new pinnacle PCTV remote (with the colored buttons)
187 *
188 * Ricardo Cerqueira <v4l@cerqueira.org>
189 */
190
191int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
192{
193 unsigned char b[4];
194 unsigned int start = 0,parity = 0,code = 0;
195
196 /* poll IR chip */
197 if (4 != i2c_master_recv(&ir->c,b,4)) {
198 dprintk(2,"read error\n");
199 return -EIO;
200 }
201
202 for (start = 0; start<4; start++) {
203 if (b[start] == 0x80) {
204 code=b[(start+3)%4];
205 parity=b[(start+2)%4];
206 }
207 }
208
209 /* Empty Request */
210 if (parity==0)
211 return 0;
212
213 /* Repeating... */
214 if (ir->old == parity)
215 return 0;
216
217
218 ir->old = parity;
219
220 /* Reduce code value to fit inside IR_KEYTAB_SIZE
221 *
222 * this is the only value that results in 42 unique
223 * codes < 128
224 */
225
226 code %= 0x88;
227
228 *ir_raw = code;
229 *ir_key = code;
230
231 dprintk(1,"Pinnacle PCTV key %02x\n", code);
232
233 return 1;
234}
235
236EXPORT_SYMBOL_GPL(get_key_pinnacle);
237
186/* ----------------------------------------------------------------------- */ 238/* ----------------------------------------------------------------------- */
187 239
188static void ir_key_poll(struct IR_i2c *ir) 240static void ir_key_poll(struct IR_i2c *ir)