Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294870
b: refs/heads/master
c: 711e139
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Jan 21, 2012
1 parent 7cb1bc6 commit 891eade
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 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: a2c35d346d9e9555db930f9035d0e628bf7f3393
refs/heads/master: 711e1398d3131fd83aee0a35d450c6e1a809bfb2
27 changes: 17 additions & 10 deletions trunk/drivers/media/dvb/dvb-usb/az6007.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ static struct rc_map_table rc_map_az6007_table[] = {
/* remote control stuff (does not work with my box) */
static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
{
struct az6007_device_state *st = d->priv;
struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
u8 key[10];
int i;

/*
Expand All @@ -212,9 +212,9 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
*/
return 0;

az6007_read(d, AZ6007_READ_IR, 0, 0, key, 10);
az6007_read(d, AZ6007_READ_IR, 0, 0, st->data, 10);

if (key[1] == 0x44) {
if (st->data[1] == 0x44) {
*state = REMOTE_NO_KEY_PRESSED;
return 0;
}
Expand All @@ -228,11 +228,11 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
* 88 80 7e 0d f2 ff 00 82 63 82 (another NEC-extended based IR)
* I suspect that the IR data is at bytes 1 to 4, and byte 5 is parity
*/
deb_rc("remote query key: %x %d\n", key[1], key[1]);
print_hex_dump_bytes("Remote: ", DUMP_PREFIX_NONE, key, 10);
deb_rc("remote query key: %x %d\n", st->data[1], st->data[1]);
print_hex_dump_bytes("Remote: ", DUMP_PREFIX_NONE, st->data, 10);

for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
if (rc5_custom(&keymap[i]) == key[1]) {
if (rc5_custom(&keymap[i]) == st->data[1]) {
*event = keymap[i].keycode;
*state = REMOTE_KEY_PRESSED;

Expand All @@ -244,8 +244,11 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)

static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
{
struct az6007_device_state *st = d->priv;
int ret;
ret = az6007_read(d, AZ6007_READ_DATA, 6, 0, mac, 6);

ret = az6007_read(d, AZ6007_READ_DATA, 6, 0, st->data, 6);
memcpy(mac, st->data, sizeof(mac));

if (ret > 0)
deb_info("%s: mac is %02x:%02x:%02x:%02x:%02x:%02x\n",
Expand Down Expand Up @@ -464,7 +467,11 @@ int az6007_identify_state(struct usb_device *udev,
struct dvb_usb_device_description **desc, int *cold)
{
int ret;
u8 mac[6];
u8 *mac;

mac = kmalloc(6, GFP_ATOMIC);
if (!mac)
return -ENOMEM;

/* Try to read the mac address */
ret = __az6007_read(udev, AZ6007_READ_DATA, 6, 0, mac, 6);
Expand All @@ -473,6 +480,8 @@ int az6007_identify_state(struct usb_device *udev,
else
*cold = 1;

kfree(mac);

if (*cold) {
__az6007_write(udev, 0x09, 1, 0, NULL, 0);
__az6007_write(udev, 0x00, 0, 0, NULL, 0);
Expand All @@ -488,8 +497,6 @@ static struct dvb_usb_device_properties az6007_properties;
static int az6007_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(intf);

return dvb_usb_device_init(intf, &az6007_properties,
THIS_MODULE, NULL, adapter_nr);
}
Expand Down

0 comments on commit 891eade

Please sign in to comment.