Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271661
b: refs/heads/master
c: a411e83
h: refs/heads/master
i:
  271659: bacce30
v: v3
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed Aug 27, 2011
1 parent efaf5f1 commit f02eeec
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 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: ab1072eba9a635511279c72150b35c1cf95ceda1
refs/heads/master: a411e83944bc48ce274b1bafdb6929846815856c
40 changes: 39 additions & 1 deletion trunk/drivers/media/rc/mceusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ struct mceusb_dev {

bool need_reset; /* flag to issue a device resume cmd */
u8 emver; /* emulator interface version */
u8 num_txports; /* number of transmit ports */
u8 num_rxports; /* number of receive sensors */
u8 txports_cabled; /* bitmask of transmitters with cable */
u8 rxports_active; /* bitmask of active receive sensors */
};

/* MCE Device Command Strings, generally a port and command pair */
Expand All @@ -450,6 +454,7 @@ static char GET_WAKEVERSION[] = {MCE_CMD_PORT_SYS, MCE_CMD_GETWAKEVERSION};
static char GET_UNKNOWN2[] = {MCE_CMD_PORT_IR, MCE_CMD_UNKNOWN2};
static char GET_CARRIER_FREQ[] = {MCE_CMD_PORT_IR, MCE_CMD_GETIRCFS};
static char GET_RX_TIMEOUT[] = {MCE_CMD_PORT_IR, MCE_CMD_GETIRTIMEOUT};
static char GET_NUM_PORTS[] = {MCE_CMD_PORT_IR, MCE_CMD_GETIRNUMPORTS};
static char GET_TX_BITMASK[] = {MCE_CMD_PORT_IR, MCE_CMD_GETIRTXPORTS};
static char GET_RX_SENSOR[] = {MCE_CMD_PORT_IR, MCE_CMD_GETIRRXPORTEN};
/* sub in desired values in lower byte or bytes for full command */
Expand Down Expand Up @@ -543,6 +548,8 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,

switch (cmd) {
case MCE_CMD_NULL:
if (subcmd == MCE_CMD_NULL)
break;
if ((subcmd == MCE_CMD_PORT_SYS) &&
(data1 == MCE_CMD_RESUME))
dev_info(dev, "Device resume requested\n");
Expand Down Expand Up @@ -909,10 +916,20 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
u8 lo = ir->buf_in[index + 2] & 0xff;

switch (ir->buf_in[index]) {
/* the one and only 5-byte return value command */
case MCE_RSP_GETPORTSTATUS:
if ((ir->buf_in[index + 4] & 0xff) == 0x00)
ir->txports_cabled |= 1 << hi;
break;

/* 2-byte return value commands */
case MCE_RSP_EQIRTIMEOUT:
ir->rc->timeout = US_TO_NS((hi << 8 | lo) * MCE_TIME_UNIT);
break;
case MCE_RSP_EQIRNUMPORTS:
ir->num_txports = hi;
ir->num_rxports = lo;
break;

/* 1-byte return value commands */
case MCE_RSP_EQEMVER:
Expand All @@ -923,6 +940,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
break;
case MCE_RSP_EQIRRXPORTEN:
ir->learning_enabled = ((hi & 0x02) == 0x02);
ir->rxports_active = hi;
break;
case MCE_RSP_CMD_ILLEGAL:
ir->need_reset = true;
Expand Down Expand Up @@ -1115,10 +1133,21 @@ static void mceusb_gen2_init(struct mceusb_dev *ir)

static void mceusb_get_parameters(struct mceusb_dev *ir)
{
int i;
unsigned char cmdbuf[3] = { MCE_CMD_PORT_SYS,
MCE_CMD_GETPORTSTATUS, 0x00 };

/* defaults, if the hardware doesn't support querying */
ir->num_txports = 2;
ir->num_rxports = 2;

/* get number of tx and rx ports */
mce_async_out(ir, GET_NUM_PORTS, sizeof(GET_NUM_PORTS));

/* get the carrier and frequency */
mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ));

if (!ir->flags.no_tx)
if (ir->num_txports && !ir->flags.no_tx)
/* get the transmitter bitmask */
mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK));

Expand All @@ -1127,6 +1156,11 @@ static void mceusb_get_parameters(struct mceusb_dev *ir)

/* get receiver sensor setting */
mce_async_out(ir, GET_RX_SENSOR, sizeof(GET_RX_SENSOR));

for (i = 0; i < ir->num_txports; i++) {
cmdbuf[2] = i;
mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
}
}

static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
Expand Down Expand Up @@ -1322,6 +1356,10 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,

dev_info(&intf->dev, "Registered %s with mce emulator interface "
"version %x\n", name, ir->emver);
dev_info(&intf->dev, "%x tx ports (0x%x cabled) and "
"%x rx sensors (0x%x active)\n",
ir->num_txports, ir->txports_cabled,
ir->num_rxports, ir->rxports_active);

return 0;

Expand Down

0 comments on commit f02eeec

Please sign in to comment.