--- old/ati_remote.c 2006-09-12 01:26:21.673963000 -0400 +++ new/ati_remote.c 2006-09-17 15:09:24.027232000 -0400 @@ -142,8 +142,9 @@ #define SEND_FLAG_COMPLETE 2 /* Device initialization strings */ -static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; -static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; +static char init1[] = {0x80, 0x05, 0x1b, 0x15, 0x14, 0x20, 0x24, 0x15}; +static char init2[] = {0x83, 0x03}; +static char init3[] = {0x84, 0xd7, 0x020}; /* Acceleration curve for directional control pad */ static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; @@ -156,7 +157,7 @@ * behaviour. * (HZ / 20) == 50 ms and works well for me. */ -#define FILTER_TIME (HZ / 20) +#define FILTER_TIME 60 static DECLARE_MUTEX(disconnect_sem); @@ -273,6 +274,7 @@ {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */ {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */ {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */ + {KIND_FILTERED, 0xf1, 0x2c, EV_KEY, KEY_I, 1}, /* i */ {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */ {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */ {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */ @@ -407,12 +409,20 @@ /* * Decide if the table entry matches the remote input. */ - if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) && - ((((ati_remote_tbl[i].data1 >> 4) - - (d1 >> 4) + rem) & 0x0f) == 0x0f) && - (ati_remote_tbl[i].data2 == d2)) + if (((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f) && + (((ati_remote_tbl[i].data1 >> 4) - (d1 >> 4) + rem) & 0x0f) == 0x0f) || + ((ati_remote_tbl[i].data1 & 0x0f) == ((d1 | 0x80) & 0x0f) && (((ati_remote_tbl[i].data1 >> 4) - ((d1 | 0x80) >> 4) + rem) & 0x0f) == 0x0f)) && + ati_remote_tbl[i].data2 == d2 + ) || + ((ati_remote_tbl[i].data1 & 0x0f) == ((d1 | 0x80) & 0x0f) && + (((ati_remote_tbl[i].data1 >> 4) - ((d1 | 0x80) >> 4) + rem) & 0x0f) == 0x0f && + (ati_remote_tbl[i].data2 == (d2 ^ 0x80)) + ) || + ((ati_remote_tbl[i].data1 & 0x0f) == ((d1 ^ 0x80) & 0x0f) && + (((ati_remote_tbl[i].data1 >> 4) - ((d1 ^ 0x80) >> 4) + rem) & 0x0f) == 0x0f && + (ati_remote_tbl[i].data2 == (d2 ^ 0x80)) + )) return i; - } return -1; } @@ -429,7 +439,7 @@ int remote_num; /* Deal with strange looking inputs */ - if ( (urb->actual_length != 4) || (data[0] != 0x14) || + if ( (urb->actual_length != 4) || (data[0] != 0x14 && data[0] != 0x15) || ((data[3] & 0x0f) != 0x00) ) { ati_remote_dump(data, urb->actual_length); return; @@ -458,6 +468,34 @@ remote_num, data[1], data[2], index, ati_remote_tbl[index].code); if (ati_remote_tbl[index].kind == KIND_LITERAL) { + if (data[0] == 0x15) { + if ((ati_remote->old_data[0] == data[1]) && + (ati_remote->old_data[1] == data[2]) && + ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { + ati_remote->repeat_count++; + } else { + ati_remote->repeat_count = 0; + } + + ati_remote->old_data[0] = data[1]; + ati_remote->old_data[1] = data[2]; + ati_remote->old_jiffies = jiffies; + + if ((ati_remote->repeat_count > 0) + && (ati_remote->repeat_count < 3)) + return; + + if (ati_remote->repeat_count >= 3) { + input_regs(dev, regs); + input_event(dev, ati_remote_tbl[index].type, + ati_remote_tbl[index].code, + 0); + input_sync(dev); + ati_remote->repeat_count = 0; + return; + } + } + input_regs(dev, regs); input_event(dev, ati_remote_tbl[index].type, ati_remote_tbl[index].code, @@ -683,8 +721,9 @@ ati_remote->out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; /* send initialization strings */ - if ((ati_remote_sendpacket(ati_remote, 0x8004, init1)) || - (ati_remote_sendpacket(ati_remote, 0x8007, init2))) { + if ((ati_remote_sendpacket(ati_remote, 0x8007, init1)) || + (ati_remote_sendpacket(ati_remote, 0x8002, init2)) || + (ati_remote_sendpacket(ati_remote, 0x8003, init3))) { dev_err(&ati_remote->interface->dev, "Initializing ati_remote hardware failed.\n"); return -EIO;