Talk:Pinnacle PCTV USB2: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
Line 1: Line 1:
== remote control stuff ==
== remote control stuff ==


<pre><nowiki>
static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char buf[3];

/* this stuff is a bit incomplete, the pinnacle pctv usb 2 returns 3 values
0xfe if a button is pressed
0xff if no button is pressed
the second value I don't know ..
the lower 6 bits of the 3rd value might indicate which button got pressed

just one example here what is received if the on/off button gets pressed
0010110100101111 .. 2D2F just pressed on/off
1100010101101111 .. C56F same button held
0000000000111111 .. 3F extract the 6 last bit
0000000000101111 .. 2F
*/

/* poll IR chip */
if (3 != i2c_master_recv(&ir->c,buf,3)) {
dprintk("read error\n");
return -EIO;
}

dprintk("key %02x\n", buf[2]&0x3f);
if (buf[0] == 0xff)
return 0;

*ir_key = buf[2]&0x3f;
*ir_raw = buf[2]&0x3f;

return 1;
}
</nowiki></pre>


thanks to victor homchenko for sending us the keycodes
thanks to victor homchenko for sending us the keycodes

Revision as of 17:18, 15 January 2006

remote control stuff

static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
        unsigned char buf[3];

        /* this stuff is a bit incomplete, the pinnacle pctv usb 2 returns 3 values
           0xfe if a button is pressed
           0xff if no button is pressed
           the second value I don't know ..
           the lower 6 bits of the 3rd value might indicate which button got pressed

           just one example here what is received if the on/off button gets pressed
              0010110100101111 .. 2D2F  just pressed on/off
              1100010101101111 .. C56F  same button held
              0000000000111111 ..   3F  extract the 6 last bit 
              0000000000101111 ..   2F 
 
        */

        /* poll IR chip */
        if (3 != i2c_master_recv(&ir->c,buf,3)) {
                dprintk("read error\n");
                return -EIO;
        }

        dprintk("key %02x\n", buf[2]&0x3f);
        if (buf[0] == 0xff)
                return 0;

        *ir_key = buf[2]&0x3f;
        *ir_raw = buf[2]&0x3f;

        return 1;
}

thanks to victor homchenko for sending us the keycodes

victor@victorhom:~/Soft/TV> perl ./usbanalyze.pl < usbsnoop2.log | grep ' 8f '
000246:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 20 3a	#Button 0 (see picture PCTV_remote.jpg)
000268:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 9f 31	#1
000284:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 3d 32	#2
000304:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe ec 33	#3
000320:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe a8 34	#4
000338:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 79 35	#5
000354:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe db 36	#6
000372:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 0a 37	#7
000390:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 53 38	#8
000420:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 82 39	#9
000456:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 2d 2f	#10
000474:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe fc 2e	#11
000490:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 63 1f	#12
000508:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe cb 2b	#13
000540:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 5e 2d	#14
000556:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe b2 1e	#15
000592:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 85 1b	#16
000610:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 59 0f	#17
000628:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 7e 17	#18
000644:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe c1 1c	#19
000662:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 43 25	#20
000678:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe b5 3c	#21
000694:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 64 3d	#22
000710:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe f1 3b	#23
000726:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 17 3f	#24
000744:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe c6 3e	#25
000760:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 54 1a	#26
000782:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 10 1d	#27
000796:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe f6 19	#26
000826:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe af 16	#29
000856:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 98 13	#30
000888:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 0d 15	#31
000914:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 88 0e	#32
000930:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 2a 0d	#33
000946:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe bf 0b	#34
000964:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 44 07	#35
victor@victorhom:~/Soft/TV> perl ./usbanalyze.pl < usbsnoop_rec_off.log | grep ' 8f '
000236:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 30 27	#"rec" button
000326:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 2d 2f	#"off" button
victor@victorhom:~/Soft/TV> perl ./usbanalyze.pl < usbsnoop_tv_off.log | grep ' 8f '
000232:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe e1 26	#"TV" button
000290:  OUT: c0 02 00 00 8f 00 03 00 <<<  fe 2d 2f 	#"off" button


static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = {
        [ 0x01 ] = KEY_CHANNEL,
        [ 0x02 ] = KEY_SELECT,
        [ 0x03 ] = KEY_MUTE,
        [ 0x04 ] = KEY_POWER,
        [ 0x05 ] = KEY_KP1,
        [ 0x06 ] = KEY_KP2,
        [ 0x07 ] = KEY_KP3,
        [ 0x08 ] = KEY_CHANNELUP,
        [ 0x09 ] = KEY_KP4,
        [ 0x0a ] = KEY_KP5,
        [ 0x0b ] = KEY_KP6,
        [ 0x0c ] = KEY_CHANNELDOWN,
        [ 0x0d ] = KEY_KP7,
        [ 0x0e ] = KEY_KP8,
        [ 0x0f ] = KEY_KP9,
        [ 0x10 ] = KEY_VOLUMEUP,
        [ 0x11 ] = KEY_KP0,
        [ 0x12 ] = KEY_MENU,
        [ 0x13 ] = KEY_PRINT,
        [ 0x14 ] = KEY_VOLUMEDOWN,
        [ 0x16 ] = KEY_PAUSE,
        [ 0x18 ] = KEY_RECORD,
        [ 0x19 ] = KEY_REWIND,
        [ 0x1a ] = KEY_PLAY,
        [ 0x1b ] = KEY_FORWARD,
        [ 0x1c ] = KEY_BACKSPACE,
        [ 0x1e ] = KEY_STOP,
        [ 0x40 ] = KEY_ZOOM,
};