Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
mceusb.c File Reference
#include <linux/device.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/usb/input.h>
#include <linux/pm_wakeup.h>
#include <media/rc-core.h>

Go to the source code of this file.

Data Structures

struct  mceusb_model
 
struct  mceusb_dev
 

Macros

#define DRIVER_VERSION   "1.92"
 
#define DRIVER_AUTHOR   "Jarod Wilson <[email protected]>"
 
#define DRIVER_DESC
 
#define DRIVER_NAME   "mceusb"
 
#define USB_BUFLEN   32 /* USB reception buffer length */
 
#define USB_CTRL_MSG_SZ   2 /* Size of usb ctrl msg on gen1 hw */
 
#define MCE_G1_INIT_MSGS   40 /* Init messages on gen1 hw to throw out */
 
#define MCE_CMDBUF_SIZE   384 /* MCE Command buffer length */
 
#define MCE_TIME_UNIT   50 /* Approx 50us resolution */
 
#define MCE_CODE_LENGTH   5 /* Normal length of packet (with header) */
 
#define MCE_PACKET_SIZE   4 /* Normal length of packet (without header) */
 
#define MCE_IRDATA_HEADER   0x84 /* Actual header format is 0x80 + num_bytes */
 
#define MCE_IRDATA_TRAILER   0x80 /* End of IR data */
 
#define MCE_TX_HEADER_LENGTH   3 /* # of bytes in the initializing tx header */
 
#define MCE_MAX_CHANNELS   2 /* Two transmitters, hardware dependent? */
 
#define MCE_DEFAULT_TX_MASK   0x03 /* Vals: TX1=0x01, TX2=0x02, ALL=0x03 */
 
#define MCE_PULSE_BIT   0x80 /* Pulse bit, MSB set == PULSE else SPACE */
 
#define MCE_PULSE_MASK   0x7f /* Pulse mask */
 
#define MCE_MAX_PULSE_LENGTH   0x7f /* Longest transmittable pulse symbol */
 
#define MCE_CMD   0x1f
 
#define MCE_PORT_IR   0x4 /* (0x4 << 5) | MCE_CMD = 0x9f */
 
#define MCE_PORT_SYS   0x7 /* (0x7 << 5) | MCE_CMD = 0xff */
 
#define MCE_PORT_SER   0x6 /* 0xc0 thru 0xdf flush & 0x1f bytes */
 
#define MCE_PORT_MASK   0xe0 /* Mask out command bits */
 
#define MCE_CMD_PORT_IR   0x9f /* IR-related cmd/rsp */
 
#define MCE_CMD_PORT_SYS   0xff /* System (non-IR) device cmd/rsp */
 
#define MCE_CMD_RESET   0xfe /* Reset device, 2 bytes */
 
#define MCE_CMD_RESUME   0xaa /* Resume device after error, 2 bytes */
 
#define MCE_CMD_SETIRCFS   0x06 /* Set tx carrier, 4 bytes */
 
#define MCE_CMD_SETIRTIMEOUT   0x0c /* Set timeout, 4 bytes */
 
#define MCE_CMD_SETIRTXPORTS   0x08 /* Set tx ports, 3 bytes */
 
#define MCE_CMD_SETIRRXPORTEN   0x14 /* Set rx ports, 3 bytes */
 
#define MCE_CMD_FLASHLED   0x23 /* Flash receiver LED, 2 bytes */
 
#define MCE_CMD_GETIRCFS   0x07 /* Get carrier */
 
#define MCE_CMD_GETIRTIMEOUT   0x0d /* Get timeout */
 
#define MCE_CMD_GETIRTXPORTS   0x13 /* Get tx ports */
 
#define MCE_CMD_GETIRRXPORTEN   0x15 /* Get rx ports */
 
#define MCE_CMD_GETPORTSTATUS   0x11 /* Get tx port status, 3 bytes */
 
#define MCE_CMD_GETIRNUMPORTS   0x16 /* Get number of ports */
 
#define MCE_CMD_GETWAKESOURCE   0x17 /* Get wake source */
 
#define MCE_CMD_GETEMVER   0x22 /* Get emulator interface version */
 
#define MCE_CMD_GETDEVDETAILS   0x21 /* Get device details (em ver2 only) */
 
#define MCE_CMD_GETWAKESUPPORT   0x20 /* Get wake details (em ver2 only) */
 
#define MCE_CMD_GETWAKEVERSION   0x18 /* Get wake pattern (em ver2 only) */
 
#define MCE_CMD_NOP   0xff /* No operation */
 
#define MCE_RSP_EQIRCFS   0x06 /* tx carrier, 4 bytes */
 
#define MCE_RSP_EQIRTIMEOUT   0x0c /* rx timeout, 4 bytes */
 
#define MCE_RSP_GETWAKESOURCE   0x17 /* wake source, 3 bytes */
 
#define MCE_RSP_EQIRTXPORTS   0x08 /* tx port mask, 3 bytes */
 
#define MCE_RSP_EQIRRXPORTEN   0x14 /* rx port mask, 3 bytes */
 
#define MCE_RSP_GETPORTSTATUS   0x11 /* tx port status, 7 bytes */
 
#define MCE_RSP_EQIRRXCFCNT   0x15 /* rx carrier count, 4 bytes */
 
#define MCE_RSP_EQIRNUMPORTS   0x16 /* number of ports, 4 bytes */
 
#define MCE_RSP_EQWAKESUPPORT   0x20 /* wake capabilities, 3 bytes */
 
#define MCE_RSP_EQWAKEVERSION   0x18 /* wake pattern details, 6 bytes */
 
#define MCE_RSP_EQDEVDETAILS   0x21 /* device capabilities, 3 bytes */
 
#define MCE_RSP_EQEMVER   0x22 /* emulator interface ver, 3 bytes */
 
#define MCE_RSP_FLASHLED   0x23 /* success flashing LED, 2 bytes */
 
#define MCE_RSP_CMD_ILLEGAL   0xfe /* illegal command for port, 2 bytes */
 
#define MCE_RSP_TX_TIMEOUT   0x81 /* tx timed out, 2 bytes */
 
#define MCE_CMD_SIG_END   0x01 /* End of signal */
 
#define MCE_CMD_PING   0x03 /* Ping device */
 
#define MCE_CMD_UNKNOWN   0x04 /* Unknown */
 
#define MCE_CMD_UNKNOWN2   0x05 /* Unknown */
 
#define MCE_CMD_UNKNOWN3   0x09 /* Unknown */
 
#define MCE_CMD_UNKNOWN4   0x0a /* Unknown */
 
#define MCE_CMD_G_REVISION   0x0b /* Get hw/sw revision */
 
#define MCE_CMD_UNKNOWN5   0x0e /* Unknown */
 
#define MCE_CMD_UNKNOWN6   0x0f /* Unknown */
 
#define MCE_CMD_UNKNOWN8   0x19 /* Unknown */
 
#define MCE_CMD_UNKNOWN9   0x1b /* Unknown */
 
#define MCE_CMD_NULL   0x00 /* These show up various places... */
 
#define MCE_COMMAND_IRDATA   0x80
 
#define MCE_PACKET_LENGTH_MASK   0x1f /* Packet length mask */
 
#define mce_dbg(dev, fmt,...)
 
#define SEND_FLAG_IN_PROGRESS   1
 
#define SEND_FLAG_COMPLETE   2
 
#define RECV_FLAG_IN_PROGRESS   3
 
#define RECV_FLAG_COMPLETE   4
 
#define MCEUSB_RX   1
 
#define MCEUSB_TX   2
 
#define VENDOR_PHILIPS   0x0471
 
#define VENDOR_SMK   0x0609
 
#define VENDOR_TATUNG   0x1460
 
#define VENDOR_GATEWAY   0x107b
 
#define VENDOR_SHUTTLE   0x1308
 
#define VENDOR_SHUTTLE2   0x051c
 
#define VENDOR_MITSUMI   0x03ee
 
#define VENDOR_TOPSEED   0x1784
 
#define VENDOR_RICAVISION   0x179d
 
#define VENDOR_ITRON   0x195d
 
#define VENDOR_FIC   0x1509
 
#define VENDOR_LG   0x043e
 
#define VENDOR_MICROSOFT   0x045e
 
#define VENDOR_FORMOSA   0x147a
 
#define VENDOR_FINTEK   0x1934
 
#define VENDOR_PINNACLE   0x2304
 
#define VENDOR_ECS   0x1019
 
#define VENDOR_WISTRON   0x0fb8
 
#define VENDOR_COMPRO   0x185b
 
#define VENDOR_NORTHSTAR   0x04eb
 
#define VENDOR_REALTEK   0x0bda
 
#define VENDOR_TIVO   0x105a
 
#define VENDOR_CONEXANT   0x0572
 
#define VENDOR_TWISTEDMELON   0x2596
 

Enumerations

enum  mceusb_model_type {
  MCE_GEN2 = 0, MCE_GEN1, MCE_GEN3, MCE_GEN2_TX_INV,
  POLARIS_EVK, CX_HYBRID_TV, MULTIFUNCTION, TIVO_KIT,
  MCE_GEN2_NO_TX
}
 

Functions

 module_usb_driver (mceusb_dev_driver)
 
 MODULE_DESCRIPTION (DRIVER_DESC)
 
 MODULE_AUTHOR (DRIVER_AUTHOR)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DEVICE_TABLE (usb, mceusb_dev_table)
 
 module_param (debug, bool, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (debug,"Debug enabled or not")
 

Macro Definition Documentation

#define DRIVER_AUTHOR   "Jarod Wilson <[email protected]>"

Definition at line 49 of file mceusb.c.

#define DRIVER_DESC
Value:
"Windows Media Center Ed. eHome Infrared Transceiver " \
"device driver"

Definition at line 50 of file mceusb.c.

#define DRIVER_NAME   "mceusb"

Definition at line 52 of file mceusb.c.

#define DRIVER_VERSION   "1.92"

Definition at line 48 of file mceusb.c.

#define MCE_CMD   0x1f

Definition at line 84 of file mceusb.c.

#define MCE_CMD_FLASHLED   0x23 /* Flash receiver LED, 2 bytes */

Definition at line 101 of file mceusb.c.

#define MCE_CMD_G_REVISION   0x0b /* Get hw/sw revision */

Definition at line 145 of file mceusb.c.

#define MCE_CMD_GETDEVDETAILS   0x21 /* Get device details (em ver2 only) */

Definition at line 112 of file mceusb.c.

#define MCE_CMD_GETEMVER   0x22 /* Get emulator interface version */

Definition at line 111 of file mceusb.c.

#define MCE_CMD_GETIRCFS   0x07 /* Get carrier */

Definition at line 104 of file mceusb.c.

#define MCE_CMD_GETIRNUMPORTS   0x16 /* Get number of ports */

Definition at line 109 of file mceusb.c.

#define MCE_CMD_GETIRRXPORTEN   0x15 /* Get rx ports */

Definition at line 107 of file mceusb.c.

#define MCE_CMD_GETIRTIMEOUT   0x0d /* Get timeout */

Definition at line 105 of file mceusb.c.

#define MCE_CMD_GETIRTXPORTS   0x13 /* Get tx ports */

Definition at line 106 of file mceusb.c.

#define MCE_CMD_GETPORTSTATUS   0x11 /* Get tx port status, 3 bytes */

Definition at line 108 of file mceusb.c.

#define MCE_CMD_GETWAKESOURCE   0x17 /* Get wake source */

Definition at line 110 of file mceusb.c.

#define MCE_CMD_GETWAKESUPPORT   0x20 /* Get wake details (em ver2 only) */

Definition at line 113 of file mceusb.c.

#define MCE_CMD_GETWAKEVERSION   0x18 /* Get wake pattern (em ver2 only) */

Definition at line 114 of file mceusb.c.

#define MCE_CMD_NOP   0xff /* No operation */

Definition at line 117 of file mceusb.c.

#define MCE_CMD_NULL   0x00 /* These show up various places... */

Definition at line 150 of file mceusb.c.

#define MCE_CMD_PING   0x03 /* Ping device */

Definition at line 140 of file mceusb.c.

#define MCE_CMD_PORT_IR   0x9f /* IR-related cmd/rsp */

Definition at line 91 of file mceusb.c.

#define MCE_CMD_PORT_SYS   0xff /* System (non-IR) device cmd/rsp */

Definition at line 92 of file mceusb.c.

#define MCE_CMD_RESET   0xfe /* Reset device, 2 bytes */

Definition at line 95 of file mceusb.c.

#define MCE_CMD_RESUME   0xaa /* Resume device after error, 2 bytes */

Definition at line 96 of file mceusb.c.

#define MCE_CMD_SETIRCFS   0x06 /* Set tx carrier, 4 bytes */

Definition at line 97 of file mceusb.c.

#define MCE_CMD_SETIRRXPORTEN   0x14 /* Set rx ports, 3 bytes */

Definition at line 100 of file mceusb.c.

#define MCE_CMD_SETIRTIMEOUT   0x0c /* Set timeout, 4 bytes */

Definition at line 98 of file mceusb.c.

#define MCE_CMD_SETIRTXPORTS   0x08 /* Set tx ports, 3 bytes */

Definition at line 99 of file mceusb.c.

#define MCE_CMD_SIG_END   0x01 /* End of signal */

Definition at line 139 of file mceusb.c.

#define MCE_CMD_UNKNOWN   0x04 /* Unknown */

Definition at line 141 of file mceusb.c.

#define MCE_CMD_UNKNOWN2   0x05 /* Unknown */

Definition at line 142 of file mceusb.c.

#define MCE_CMD_UNKNOWN3   0x09 /* Unknown */

Definition at line 143 of file mceusb.c.

#define MCE_CMD_UNKNOWN4   0x0a /* Unknown */

Definition at line 144 of file mceusb.c.

#define MCE_CMD_UNKNOWN5   0x0e /* Unknown */

Definition at line 146 of file mceusb.c.

#define MCE_CMD_UNKNOWN6   0x0f /* Unknown */

Definition at line 147 of file mceusb.c.

#define MCE_CMD_UNKNOWN8   0x19 /* Unknown */

Definition at line 148 of file mceusb.c.

#define MCE_CMD_UNKNOWN9   0x1b /* Unknown */

Definition at line 149 of file mceusb.c.

#define MCE_CMDBUF_SIZE   384 /* MCE Command buffer length */

Definition at line 59 of file mceusb.c.

#define MCE_CODE_LENGTH   5 /* Normal length of packet (with header) */

Definition at line 61 of file mceusb.c.

#define MCE_COMMAND_IRDATA   0x80

Definition at line 154 of file mceusb.c.

#define mce_dbg (   dev,
  fmt,
  ... 
)
Value:
do { \
if (debug) \
dev_info(dev, fmt, ## __VA_ARGS__); \
} while (0)

Definition at line 164 of file mceusb.c.

#define MCE_DEFAULT_TX_MASK   0x03 /* Vals: TX1=0x01, TX2=0x02, ALL=0x03 */

Definition at line 67 of file mceusb.c.

#define MCE_G1_INIT_MSGS   40 /* Init messages on gen1 hw to throw out */

Definition at line 56 of file mceusb.c.

#define MCE_IRDATA_HEADER   0x84 /* Actual header format is 0x80 + num_bytes */

Definition at line 63 of file mceusb.c.

#define MCE_IRDATA_TRAILER   0x80 /* End of IR data */

Definition at line 64 of file mceusb.c.

#define MCE_MAX_CHANNELS   2 /* Two transmitters, hardware dependent? */

Definition at line 66 of file mceusb.c.

#define MCE_MAX_PULSE_LENGTH   0x7f /* Longest transmittable pulse symbol */

Definition at line 70 of file mceusb.c.

#define MCE_PACKET_LENGTH_MASK   0x1f /* Packet length mask */

Definition at line 155 of file mceusb.c.

#define MCE_PACKET_SIZE   4 /* Normal length of packet (without header) */

Definition at line 62 of file mceusb.c.

#define MCE_PORT_IR   0x4 /* (0x4 << 5) | MCE_CMD = 0x9f */

Definition at line 85 of file mceusb.c.

#define MCE_PORT_MASK   0xe0 /* Mask out command bits */

Definition at line 88 of file mceusb.c.

#define MCE_PORT_SER   0x6 /* 0xc0 thru 0xdf flush & 0x1f bytes */

Definition at line 87 of file mceusb.c.

#define MCE_PORT_SYS   0x7 /* (0x7 << 5) | MCE_CMD = 0xff */

Definition at line 86 of file mceusb.c.

#define MCE_PULSE_BIT   0x80 /* Pulse bit, MSB set == PULSE else SPACE */

Definition at line 68 of file mceusb.c.

#define MCE_PULSE_MASK   0x7f /* Pulse mask */

Definition at line 69 of file mceusb.c.

#define MCE_RSP_CMD_ILLEGAL   0xfe /* illegal command for port, 2 bytes */

Definition at line 135 of file mceusb.c.

#define MCE_RSP_EQDEVDETAILS   0x21 /* device capabilities, 3 bytes */

Definition at line 130 of file mceusb.c.

#define MCE_RSP_EQEMVER   0x22 /* emulator interface ver, 3 bytes */

Definition at line 131 of file mceusb.c.

#define MCE_RSP_EQIRCFS   0x06 /* tx carrier, 4 bytes */

Definition at line 120 of file mceusb.c.

#define MCE_RSP_EQIRNUMPORTS   0x16 /* number of ports, 4 bytes */

Definition at line 127 of file mceusb.c.

#define MCE_RSP_EQIRRXCFCNT   0x15 /* rx carrier count, 4 bytes */

Definition at line 126 of file mceusb.c.

#define MCE_RSP_EQIRRXPORTEN   0x14 /* rx port mask, 3 bytes */

Definition at line 124 of file mceusb.c.

#define MCE_RSP_EQIRTIMEOUT   0x0c /* rx timeout, 4 bytes */

Definition at line 121 of file mceusb.c.

#define MCE_RSP_EQIRTXPORTS   0x08 /* tx port mask, 3 bytes */

Definition at line 123 of file mceusb.c.

#define MCE_RSP_EQWAKESUPPORT   0x20 /* wake capabilities, 3 bytes */

Definition at line 128 of file mceusb.c.

#define MCE_RSP_EQWAKEVERSION   0x18 /* wake pattern details, 6 bytes */

Definition at line 129 of file mceusb.c.

#define MCE_RSP_FLASHLED   0x23 /* success flashing LED, 2 bytes */

Definition at line 132 of file mceusb.c.

#define MCE_RSP_GETPORTSTATUS   0x11 /* tx port status, 7 bytes */

Definition at line 125 of file mceusb.c.

#define MCE_RSP_GETWAKESOURCE   0x17 /* wake source, 3 bytes */

Definition at line 122 of file mceusb.c.

#define MCE_RSP_TX_TIMEOUT   0x81 /* tx timed out, 2 bytes */

Definition at line 136 of file mceusb.c.

#define MCE_TIME_UNIT   50 /* Approx 50us resolution */

Definition at line 60 of file mceusb.c.

#define MCE_TX_HEADER_LENGTH   3 /* # of bytes in the initializing tx header */

Definition at line 65 of file mceusb.c.

#define MCEUSB_RX   1

Definition at line 176 of file mceusb.c.

#define MCEUSB_TX   2

Definition at line 177 of file mceusb.c.

#define RECV_FLAG_COMPLETE   4

Definition at line 174 of file mceusb.c.

#define RECV_FLAG_IN_PROGRESS   3

Definition at line 173 of file mceusb.c.

#define SEND_FLAG_COMPLETE   2

Definition at line 172 of file mceusb.c.

#define SEND_FLAG_IN_PROGRESS   1

Definition at line 171 of file mceusb.c.

#define USB_BUFLEN   32 /* USB reception buffer length */

Definition at line 54 of file mceusb.c.

#define USB_CTRL_MSG_SZ   2 /* Size of usb ctrl msg on gen1 hw */

Definition at line 55 of file mceusb.c.

#define VENDOR_COMPRO   0x185b

Definition at line 197 of file mceusb.c.

#define VENDOR_CONEXANT   0x0572

Definition at line 201 of file mceusb.c.

#define VENDOR_ECS   0x1019

Definition at line 195 of file mceusb.c.

#define VENDOR_FIC   0x1509

Definition at line 189 of file mceusb.c.

#define VENDOR_FINTEK   0x1934

Definition at line 193 of file mceusb.c.

#define VENDOR_FORMOSA   0x147a

Definition at line 192 of file mceusb.c.

#define VENDOR_GATEWAY   0x107b

Definition at line 182 of file mceusb.c.

#define VENDOR_ITRON   0x195d

Definition at line 188 of file mceusb.c.

#define VENDOR_LG   0x043e

Definition at line 190 of file mceusb.c.

#define VENDOR_MICROSOFT   0x045e

Definition at line 191 of file mceusb.c.

#define VENDOR_MITSUMI   0x03ee

Definition at line 185 of file mceusb.c.

#define VENDOR_NORTHSTAR   0x04eb

Definition at line 198 of file mceusb.c.

#define VENDOR_PHILIPS   0x0471

Definition at line 179 of file mceusb.c.

#define VENDOR_PINNACLE   0x2304

Definition at line 194 of file mceusb.c.

#define VENDOR_REALTEK   0x0bda

Definition at line 199 of file mceusb.c.

#define VENDOR_RICAVISION   0x179d

Definition at line 187 of file mceusb.c.

#define VENDOR_SHUTTLE   0x1308

Definition at line 183 of file mceusb.c.

#define VENDOR_SHUTTLE2   0x051c

Definition at line 184 of file mceusb.c.

#define VENDOR_SMK   0x0609

Definition at line 180 of file mceusb.c.

#define VENDOR_TATUNG   0x1460

Definition at line 181 of file mceusb.c.

#define VENDOR_TIVO   0x105a

Definition at line 200 of file mceusb.c.

#define VENDOR_TOPSEED   0x1784

Definition at line 186 of file mceusb.c.

#define VENDOR_TWISTEDMELON   0x2596

Definition at line 202 of file mceusb.c.

#define VENDOR_WISTRON   0x0fb8

Definition at line 196 of file mceusb.c.

Enumeration Type Documentation

Enumerator:
MCE_GEN2 
MCE_GEN1 
MCE_GEN3 
MCE_GEN2_TX_INV 
POLARIS_EVK 
CX_HYBRID_TV 
MULTIFUNCTION 
TIVO_KIT 
MCE_GEN2_NO_TX 

Definition at line 204 of file mceusb.c.

Function Documentation

MODULE_AUTHOR ( DRIVER_AUTHOR  )
MODULE_DESCRIPTION ( DRIVER_DESC  )
MODULE_DEVICE_TABLE ( usb  ,
mceusb_dev_table   
)
MODULE_LICENSE ( "GPL"  )
module_param ( debug  ,
bool  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( debug  ,
"Debug enabled or not"   
)
module_usb_driver ( mceusb_dev_driver  )