Ok... Here is the patch cleaned up. I have worked on it all week. If anyone can think of a brilliant
idea on the issue where the KNC1 and Kworld cards share the same I2C address for the remote, please respond.
On the probe, kworldatsc is setup to 1,
static int kworldatsc110 = 0; /* Both KNC1 and the Kworld ATSC110 cards use the same i2c address */
/* Special case for Kworld ATSC110 remote */
if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0x30)
{
struct i2c_client c2;
memset (&c2, 0, sizeof(c2));
c2.adapter = c.adapter;
for (c2.addr=127; c2.addr > 0; c2.addr--) {
if (0 == i2c_master_recv(&c2,&buf,0)) {
dprintk(1,"Found another device, at addr 0x%02x\n", c2.addr);
break;
}
}
/* Now do the probe. The controller does not respond
to 0-byte reads, so we use a 1-byte read instead. */
rc = i2c_master_recv(&c,&buf,1);
rc--;
kworldatsc110 = 1;
} else {
rc = i2c_master_recv(&c,&buf,0);
}
so in ir_attach it can tell which card and i2c address to properly use.
case 0x30:
ir->get_key = get_key_knc1;
ir_type = IR_TYPE_OTHER;
if (kworldatsc110 == 1) {
name = "Kworld ATSC110";
ir_codes = ir_codes_kworld_atsc110;
} else {
name = "KNC One";
ir_codes = ir_codes_empty;
}
break;
Jan 13 13:46:21 mythtv kernel: Linux video capture interface: v2.00
Jan 13 13:46:21 mythtv kernel: saa7130/34: v4l2 driver version 0.2.14 loaded
Jan 13 13:46:21 mythtv kernel: saa7133[0]: found at 0000:00:09.0, rev: 240, irq: 18, latency: 32, mmio: 0xe6000000
Jan 13 13:46:21 mythtv kernel: saa7133[0]: subsystem: 17de:7350, board: Kworld ATSC110 [card=90,autodetected]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: board init: gpio is 100
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c i2c attach [addr=0x30,client=i2c IR (Kworld ATSC110)]
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c i2c IR detected ().
Jan 13 13:46:21 mythtv kernel: input: i2c IR (Kworld ATSC110) as /class/input/input1
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c: i2c IR (Kworld ATSC110) detected at i2c-1/1-0030/ir0 [saa7133[0]]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 00: de 17 50 73 ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: tuner 1-0061: chip found @ 0xc2 (saa7133[0])
Jan 13 13:46:21 mythtv kernel: tuner i2c attach [addr=0x61,client=(tuner unset)]
Jan 13 13:46:21 mythtv kernel: tuner 1-0061: type set to 68 (Philips TUV1236D ATSC/NTSC dual in)
Jan 13 13:46:21 mythtv kernel: saa7133[0]: registered device video0 [v4l2]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: registered device vbi0
Jan 13 13:46:21 mythtv kernel: nxt200x: NXT2004 Detected
Jan 13 13:46:21 mythtv kernel: DVB: registering new adapter (saa7133[0]).
Jan 13 13:46:21 mythtv kernel: DVB: registering frontend 0 (Nextwave NXT200X VSB/QAM frontend)...
Jan 13 13:46:30 mythtv kernel: nxt2004: Waiting for firmware upload (dvb-fe-nxt2004.fw)...
Jan 13 13:46:30 mythtv kernel: nxt2004: Waiting for firmware upload(2)...
Jan 13 13:46:31 mythtv kernel: nxt2004: Firmware upload complete
Dwaine
idea on the issue where the KNC1 and Kworld cards share the same I2C address for the remote, please respond.
On the probe, kworldatsc is setup to 1,
static int kworldatsc110 = 0; /* Both KNC1 and the Kworld ATSC110 cards use the same i2c address */
/* Special case for Kworld ATSC110 remote */
if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0x30)
{
struct i2c_client c2;
memset (&c2, 0, sizeof(c2));
c2.adapter = c.adapter;
for (c2.addr=127; c2.addr > 0; c2.addr--) {
if (0 == i2c_master_recv(&c2,&buf,0)) {
dprintk(1,"Found another device, at addr 0x%02x\n", c2.addr);
break;
}
}
/* Now do the probe. The controller does not respond
to 0-byte reads, so we use a 1-byte read instead. */
rc = i2c_master_recv(&c,&buf,1);
rc--;
kworldatsc110 = 1;
} else {
rc = i2c_master_recv(&c,&buf,0);
}
so in ir_attach it can tell which card and i2c address to properly use.
case 0x30:
ir->get_key = get_key_knc1;
ir_type = IR_TYPE_OTHER;
if (kworldatsc110 == 1) {
name = "Kworld ATSC110";
ir_codes = ir_codes_kworld_atsc110;
} else {
name = "KNC One";
ir_codes = ir_codes_empty;
}
break;
Jan 13 13:46:21 mythtv kernel: Linux video capture interface: v2.00
Jan 13 13:46:21 mythtv kernel: saa7130/34: v4l2 driver version 0.2.14 loaded
Jan 13 13:46:21 mythtv kernel: saa7133[0]: found at 0000:00:09.0, rev: 240, irq: 18, latency: 32, mmio: 0xe6000000
Jan 13 13:46:21 mythtv kernel: saa7133[0]: subsystem: 17de:7350, board: Kworld ATSC110 [card=90,autodetected]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: board init: gpio is 100
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c i2c attach [addr=0x30,client=i2c IR (Kworld ATSC110)]
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c i2c IR detected ().
Jan 13 13:46:21 mythtv kernel: input: i2c IR (Kworld ATSC110) as /class/input/input1
Jan 13 13:46:21 mythtv kernel: ir-kbd-i2c: i2c IR (Kworld ATSC110) detected at i2c-1/1-0030/ir0 [saa7133[0]]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 00: de 17 50 73 ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Jan 13 13:46:21 mythtv kernel: tuner 1-0061: chip found @ 0xc2 (saa7133[0])
Jan 13 13:46:21 mythtv kernel: tuner i2c attach [addr=0x61,client=(tuner unset)]
Jan 13 13:46:21 mythtv kernel: tuner 1-0061: type set to 68 (Philips TUV1236D ATSC/NTSC dual in)
Jan 13 13:46:21 mythtv kernel: saa7133[0]: registered device video0 [v4l2]
Jan 13 13:46:21 mythtv kernel: saa7133[0]: registered device vbi0
Jan 13 13:46:21 mythtv kernel: nxt200x: NXT2004 Detected
Jan 13 13:46:21 mythtv kernel: DVB: registering new adapter (saa7133[0]).
Jan 13 13:46:21 mythtv kernel: DVB: registering frontend 0 (Nextwave NXT200X VSB/QAM frontend)...
Jan 13 13:46:30 mythtv kernel: nxt2004: Waiting for firmware upload (dvb-fe-nxt2004.fw)...
Jan 13 13:46:30 mythtv kernel: nxt2004: Waiting for firmware upload(2)...
Jan 13 13:46:31 mythtv kernel: nxt2004: Firmware upload complete
Dwaine
diff -U 3 -H -d -r -N -- a/linux/drivers/media/common/ir-keymaps.c b/linux/drivers/media/common/ir-keymaps.c --- a/linux/drivers/media/common/ir-keymaps.c 2007-01-13 16:59:28.000000000 -0500 +++ b/linux/drivers/media/common/ir-keymaps.c 2007-01-13 17:05:03.000000000 -0500 @@ -1828,3 +1828,57 @@ }; EXPORT_SYMBOL_GPL(ir_codes_tt_1500); + +IR_KEYTAB_TYPE ir_codes_kworld_atsc110[IR_KEYTAB_SIZE] = { + [ 0x0 ] = KEY_1, + [ 0x1 ] = KEY_2, + [ 0x2 ] = KEY_3, + [ 0x3 ] = KEY_4, + [ 0x4 ] = KEY_5, + [ 0x5 ] = KEY_6, + [ 0x6 ] = KEY_7, + [ 0x7 ] = KEY_8, + [ 0x8 ] = KEY_9, + [ 0xa ] = KEY_0, + [ 0x9 ] = KEY_ESC, /* UP ARROW */ + [ 0xc ] = KEY_POWER, /* POWER */ + [ 0x0a ] = KEY_MUTE, /* MUTE */ + [ 0x0b ] = KEY_SEARCH, /* SEARCH */ + [ 0x0d ] = KEY_EPG, /* GUIDE */ + [ 0x1b ] = KEY_RECORD, /* RECORD */ + [ 0x16 ] = KEY_PAUSE, /* PAUSE */ + [ 0x1a ] = KEY_STOP, /* STOP */ + [ 0x1d ] = KEY_VOLUMEDOWN, /* VOLUME- */ + [ 0x1c ] = KEY_VOLUMEUP, /* VOLUME+ */ + [ 0x1f ] = KEY_CHANNELDOWN, /* CHANNEL/PAGE- */ + [ 0x1e ] = KEY_CHANNELUP, /* CHANNEL/PAGE+ */ + [ 0x10 ] = KEY_UP, /* KEY_SCROLLUP */ + [ 0x12 ] = KEY_LEFT, /* KEY_BACK */ + [ 0xe ] = KEY_ENTER, /* KEY_ENTER */ + [ 0x13 ] = KEY_RIGHT, /* KEY_FORWARD */ + [ 0x11 ] = KEY_DOWN, /* KEY_SCROLLDOWN */ + [ 0x14 ] = KEY_MUTE, /* MUTE */ + [ 0x15 ] = KEY_AUDIO, /* STEREO */ + [ 0x16 ] = KEY_VIDEO, /* SOURCE */ + [ 0x17 ] = KEY_ZOOM, /* ZOOM */ + [ 0x18 ] = KEY_PRINT, /* SHUTDOWN */ + [ 0X19 ] = KEY_T, /* TIMESHIFT */ + [ 0x44 ] = KEY_PLAYPAUSE, /* PAUSE/PLAY */ + [ 0x45 ] = KEY_STOP, /* STOP */ + [ 0x40 ] = KEY_REWIND, /* REWIND */ + [ 0x41 ] = KEY_FORWARD, /* FASTFORWARD */ + [ 0x42 ] = KEY_PREVIOUSSONG, /* PREVIOUS */ + [ 0x43 ] = KEY_NEXTSONG, /* NEXT */ + + // buttons a-h + [ 0x48 ] = KEY_A, + [ 0x49 ] = KEY_B, + [ 0x4a ] = KEY_C, + [ 0x4b ] = KEY_D, + [ 0x4c ] = KEY_E, + [ 0x4d ] = KEY_F, + [ 0x4e ] = KEY_G, + [ 0x4f ] = KEY_H +}; + +EXPORT_SYMBOL_GPL(ir_codes_kworld_atsc110); diff -U 3 -H -d -r -N -- a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c --- a/linux/drivers/media/video/ir-kbd-i2c.c 2007-01-13 16:59:28.000000000 -0500 +++ b/linux/drivers/media/video/ir-kbd-i2c.c 2007-01-13 17:37:38.000000000 -0500 @@ -62,6 +62,8 @@ /* ----------------------------------------------------------------------- */ +static int kworldatsc110 = 0; /* Both KNC1 and the Kworld ATSC110 cards use the same i2c address */ + static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char buf[3]; @@ -144,11 +146,14 @@ /* it seems that 0xFE indicates that a button is still hold down, while 0xff indicates that no button is hold - down. 0xfe sequences are sometimes interrupted by 0xFF */ + down. 0xfe and 0x80 sequences are sometimes interrupted by 0xFF */ dprintk(2,"key %02x\n", b); - if (b == 0xff) + /* KNC1 card = 0xfe */ + /* Kworld ATSC110 card = 0x80 */ + + if ((b == 0xfe)||(b & 0x80)) return 0; if (b == 0xfe) @@ -364,10 +369,15 @@ } break; case 0x30: - name = "KNC One"; ir->get_key = get_key_knc1; ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_empty; + if (kworldatsc110 == 1) { + name = "Kworld ATSC110"; + ir_codes = ir_codes_kworld_atsc110; + } else { + name = "KNC One"; + ir_codes = ir_codes_empty; + } break; case 0x7a: case 0x47: @@ -469,8 +479,8 @@ That's why we probe 0x1a (~0x34) first. CB */ - static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; - static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 }; + static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1 }; + static const int probe_saa7134[] = { 0x7a, 0x30, 0x47, 0x71, -1 }; static const int probe_em28XX[] = { 0x30, 0x47, -1 }; const int *probe = NULL; struct i2c_client c; @@ -499,6 +509,30 @@ for (i = 0; -1 != probe[i]; i++) { c.addr = probe[i]; rc = i2c_master_recv(&c,&buf,0); + + /* Special case for Kworld ATSC110 remote */ + if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0x30) + { + struct i2c_client c2; + + memset (&c2, 0, sizeof(c2)); + c2.adapter = c.adapter; + + for (c2.addr=127; c2.addr > 0; c2.addr--) { + if (0 == i2c_master_recv(&c2,&buf,0)) { + dprintk(1,"Found another device, at addr 0x%02x\n", c2.addr); + break; + } + } + + /* Now do the probe. The controller does not respond + to 0-byte reads, so we use a 1-byte read instead. */ + rc = i2c_master_recv(&c,&buf,1); + rc--; + kworldatsc110 = 1; + } else { + rc = i2c_master_recv(&c,&buf,0); + } dprintk(1,"probe 0x%02x @ %s: %s\n", probe[i], adap->name, (0 == rc) ? "yes" : "no"); diff -U 3 -H -d -r -N -- a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c --- a/linux/drivers/media/video/saa7134/saa7134-cards.c 2007-01-13 16:59:28.000000000 -0500 +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c 2007-01-13 17:11:20.000000000 -0500 @@ -4175,6 +4175,9 @@ case SAA7134_BOARD_PINNACLE_PCTV_110i: case SAA7134_BOARD_PINNACLE_PCTV_310i: case SAA7134_BOARD_UPMOST_PURPLE_TV: + case SAA7134_BOARD_KWORLD_ATSC110: + dev->has_remote = SAA7134_REMOTE_I2C; + break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: dev->has_remote = SAA7134_REMOTE_I2C; break; diff -U 3 -H -d -r -N -- a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c --- a/linux/drivers/media/video/saa7134/saa7134-i2c.c 2007-01-13 16:59:28.000000000 -0500 +++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c 2007-01-13 17:12:42.000000000 -0500 @@ -350,6 +350,7 @@ switch (client->addr) { case 0x7a: + case 0x30: case 0x47: case 0x71: { diff -U 3 -H -d -r -N -- a/linux/include/media/ir-common.h b/linux/include/media/ir-common.h --- a/linux/include/media/ir-common.h 2007-01-13 16:59:28.000000000 -0500 +++ b/linux/include/media/ir-common.h 2007-01-13 17:03:46.000000000 -0500 @@ -140,6 +140,7 @@ extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_kworld_atsc110[IR_KEYTAB_SIZE]; #endif
_______________________________________________ linux-dvb mailing list linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb