Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250182
b: refs/heads/master
c: 513ea35
h: refs/heads/master
v: v3
  • Loading branch information
Florian Mickler authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 8883fe5 commit 8e20b7d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b47b850116369a474f71c8ee1e7d06dfa9bf5468
refs/heads/master: 513ea35ff9cd332abe650f5da3689bdb41824b43
33 changes: 22 additions & 11 deletions trunk/drivers/media/dvb/dvb-usb/m920x.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
struct m920x_state *m = d->priv;
int i, ret = 0;
u8 rc_state[2];
u8 *rc_state;

rc_state = kmalloc(2, GFP_KERNEL);
if (!rc_state)
return -ENOMEM;

if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
goto unlock;
goto out;

if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
goto unlock;
goto out;

for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) {
Expand All @@ -149,23 +153,23 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
switch(rc_state[0]) {
case 0x80:
*state = REMOTE_NO_KEY_PRESSED;
goto unlock;
goto out;

case 0x88: /* framing error or "invalid code" */
case 0x99:
case 0xc0:
case 0xd8:
*state = REMOTE_NO_KEY_PRESSED;
m->rep_count = 0;
goto unlock;
goto out;

case 0x93:
case 0x92:
case 0x83: /* pinnacle PCTV310e */
case 0x82:
m->rep_count = 0;
*state = REMOTE_KEY_PRESSED;
goto unlock;
goto out;

case 0x91:
case 0x81: /* pinnacle PCTV310e */
Expand All @@ -174,12 +178,12 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
*state = REMOTE_KEY_REPEAT;
else
*state = REMOTE_NO_KEY_PRESSED;
goto unlock;
goto out;

default:
deb("Unexpected rc state %02x\n", rc_state[0]);
*state = REMOTE_NO_KEY_PRESSED;
goto unlock;
goto out;
}
}

Expand All @@ -188,8 +192,8 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)

*state = REMOTE_NO_KEY_PRESSED;

unlock:

out:
kfree(rc_state);
return ret;
}

Expand Down Expand Up @@ -339,13 +343,19 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, in
static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
{
u16 value, index, size;
u8 read[4], *buff;
u8 *read, *buff;
int i, pass, ret = 0;

buff = kmalloc(65536, GFP_KERNEL);
if (buff == NULL)
return -ENOMEM;

read = kmalloc(4, GFP_KERNEL);
if (!read) {
kfree(buff);
return -ENOMEM;
}

if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
goto done;
deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
Expand Down Expand Up @@ -396,6 +406,7 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
deb("firmware uploaded!\n");

done:
kfree(read);
kfree(buff);

return ret;
Expand Down

0 comments on commit 8e20b7d

Please sign in to comment.