Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357466
b: refs/heads/master
c: c6a3ea5
h: refs/heads/master
v: v3
  • Loading branch information
Sean Young authored and Mauro Carvalho Chehab committed Feb 5, 2013
1 parent 6cce069 commit acb9de7
Show file tree
Hide file tree
Showing 2 changed files with 16 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: d0aab6564d12add07572141ceb34c60046e93ac3
refs/heads/master: c6a3ea570e5d0ca20069cce5d537c845128b70f4
25 changes: 15 additions & 10 deletions trunk/drivers/media/rc/iguanair.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct iguanair {
char phys[64];
};

#define CMD_NOP 0x00
#define CMD_GET_VERSION 0x01
#define CMD_GET_BUFSIZE 0x11
#define CMD_GET_FEATURES 0x10
Expand Down Expand Up @@ -196,6 +197,10 @@ static void iguanair_irq_out(struct urb *urb)

if (urb->status)
dev_dbg(ir->dev, "Error: out urb status = %d\n", urb->status);

/* if we sent an nop packet, do not expect a response */
if (urb->status == 0 && ir->packet->header.cmd == CMD_NOP)
complete(&ir->completion);
}

static int iguanair_send(struct iguanair *ir, unsigned size)
Expand All @@ -219,10 +224,17 @@ static int iguanair_get_features(struct iguanair *ir)
{
int rc;

/*
* On cold boot, the iguanair initializes on the first packet
* received but does not process that packet. Send an empty
* packet.
*/
ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = CMD_GET_VERSION;
ir->packet->header.cmd = CMD_NOP;
iguanair_send(ir, sizeof(ir->packet->header));

ir->packet->header.cmd = CMD_GET_VERSION;
rc = iguanair_send(ir, sizeof(ir->packet->header));
if (rc) {
dev_info(ir->dev, "failed to get version\n");
Expand Down Expand Up @@ -255,29 +267,22 @@ static int iguanair_get_features(struct iguanair *ir)
ir->packet->header.cmd = CMD_GET_FEATURES;

rc = iguanair_send(ir, sizeof(ir->packet->header));
if (rc) {
if (rc)
dev_info(ir->dev, "failed to get features\n");
goto out;
}

out:
return rc;
}

static int iguanair_receiver(struct iguanair *ir, bool enable)
{
int rc;

ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = enable ? CMD_RECEIVER_ON : CMD_RECEIVER_OFF;

if (enable)
ir_raw_event_reset(ir->rc);

rc = iguanair_send(ir, sizeof(ir->packet->header));

return rc;
return iguanair_send(ir, sizeof(ir->packet->header));
}

/*
Expand Down

0 comments on commit acb9de7

Please sign in to comment.