*/
rc->map_name = ir->ir_codes;
rc->allowed_protos = rc_type;
+ rc->enabled_protocols = rc_type;
if (!rc->driver_name)
rc->driver_name = MODULE_NAME;
{
struct jvc_dec *data = &dev->raw->jvc;
- if (!(dev->raw->enabled_protocols & RC_BIT_JVC))
+ if (!(dev->enabled_protocols & RC_BIT_JVC))
return 0;
if (!is_timing_event(ev)) {
struct lirc_codec *lirc = &dev->raw->lirc;
int sample;
- if (!(dev->raw->enabled_protocols & RC_BIT_LIRC))
+ if (!(dev->enabled_protocols & RC_BIT_LIRC))
return 0;
if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
u32 scancode;
unsigned long delay;
- if (!(dev->raw->enabled_protocols & RC_BIT_MCE_KBD))
+ if (!(dev->enabled_protocols & RC_BIT_MCE_KBD))
return 0;
if (!is_timing_event(ev)) {
u8 address, not_address, command, not_command;
bool send_32bits = false;
- if (!(dev->raw->enabled_protocols & RC_BIT_NEC))
+ if (!(dev->enabled_protocols & RC_BIT_NEC))
return 0;
if (!is_timing_event(ev)) {
return -ENOMEM;
dev->raw->dev = dev;
- dev->raw->enabled_protocols = ~0;
+ dev->enabled_protocols = ~0;
rc = kfifo_alloc(&dev->raw->kfifo,
sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE,
GFP_KERNEL);
u8 toggle;
u32 scancode;
- if (!(dev->raw->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X)))
+ if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X)))
return 0;
if (!is_timing_event(ev)) {
if (data->wanted_bits == RC5X_NBITS) {
/* RC5X */
u8 xdata, command, system;
- if (!(dev->raw->enabled_protocols & RC_BIT_RC5X)) {
+ if (!(dev->enabled_protocols & RC_BIT_RC5X)) {
data->state = STATE_INACTIVE;
return 0;
}
} else {
/* RC5 */
u8 command, system;
- if (!(dev->raw->enabled_protocols & RC_BIT_RC5)) {
+ if (!(dev->enabled_protocols & RC_BIT_RC5)) {
data->state = STATE_INACTIVE;
return 0;
}
u8 toggle, command, system;
u32 scancode;
- if (!(dev->raw->enabled_protocols & RC_BIT_RC5_SZ))
+ if (!(dev->enabled_protocols & RC_BIT_RC5_SZ))
return 0;
if (!is_timing_event(ev)) {
u32 scancode;
u8 toggle;
- if (!(dev->raw->enabled_protocols &
+ if (!(dev->enabled_protocols &
(RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 |
RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)))
return 0;
u32 scancode;
u8 address, command, not_command;
- if (!(dev->raw->enabled_protocols & RC_BIT_SANYO))
+ if (!(dev->enabled_protocols & RC_BIT_SANYO))
return 0;
if (!is_timing_event(ev)) {
u32 scancode;
u8 device, subdevice, function;
- if (!(dev->raw->enabled_protocols &
+ if (!(dev->enabled_protocols &
(RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20)))
return 0;
switch (data->count) {
case 12:
- if (!(dev->raw->enabled_protocols & RC_BIT_SONY12)) {
+ if (!(dev->enabled_protocols & RC_BIT_SONY12)) {
data->state = STATE_INACTIVE;
return 0;
}
function = bitrev8((data->bits >> 4) & 0xFE);
break;
case 15:
- if (!(dev->raw->enabled_protocols & RC_BIT_SONY15)) {
+ if (!(dev->enabled_protocols & RC_BIT_SONY15)) {
data->state = STATE_INACTIVE;
return 0;
}
function = bitrev8((data->bits >> 7) & 0xFE);
break;
case 20:
- if (!(dev->raw->enabled_protocols & RC_BIT_SONY20)) {
+ if (!(dev->enabled_protocols & RC_BIT_SONY20)) {
data->state = STATE_INACTIVE;
return 0;
}
ktime_t last_event; /* when last event occurred */
enum raw_event_type last_type; /* last event type */
struct rc_dev *dev; /* pointer to the parent rc_dev */
- u64 enabled_protocols; /* enabled raw protocol decoders */
/* raw decoder state follows */
struct ir_raw_event prev_ev;
mutex_lock(&dev->lock);
- if (dev->driver_type == RC_DRIVER_SCANCODE) {
- enabled = dev->rc_map.rc_type;
+ enabled = dev->enabled_protocols;
+ if (dev->driver_type == RC_DRIVER_SCANCODE)
allowed = dev->allowed_protos;
- } else if (dev->raw) {
- enabled = dev->raw->enabled_protocols;
+ else if (dev->raw)
allowed = ir_raw_get_allowed_protocols();
- } else {
+ else {
mutex_unlock(&dev->lock);
return -ENODEV;
}
u64 type;
u64 mask;
int rc, i, count = 0;
- unsigned long flags;
ssize_t ret;
/* Device is being removed */
mutex_lock(&dev->lock);
- if (dev->driver_type == RC_DRIVER_SCANCODE)
- type = dev->rc_map.rc_type;
- else if (dev->raw)
- type = dev->raw->enabled_protocols;
- else {
+ if (dev->driver_type != RC_DRIVER_SCANCODE && !dev->raw) {
IR_dprintk(1, "Protocol switching not supported\n");
ret = -EINVAL;
goto out;
}
+ type = dev->enabled_protocols;
while ((tmp = strsep((char **) &data, " \n")) != NULL) {
if (!*tmp)
}
}
- if (dev->driver_type == RC_DRIVER_SCANCODE) {
- spin_lock_irqsave(&dev->rc_map.lock, flags);
- dev->rc_map.rc_type = type;
- spin_unlock_irqrestore(&dev->rc_map.lock, flags);
- } else {
- dev->raw->enabled_protocols = type;
- }
-
+ dev->enabled_protocols = type;
IR_dprintk(1, "Current protocol(s): 0x%llx\n",
(long long)type);
/*
* Take the lock here, as the device sysfs node will appear
* when device_add() is called, which may trigger an ir-keytable udev
- * rule, which will in turn call show_protocols and access either
- * dev->rc_map.rc_type or dev->raw->enabled_protocols before it has
- * been initialized.
+ * rule, which will in turn call show_protocols and access
+ * dev->enabled_protocols before it has been initialized.
*/
mutex_lock(&dev->lock);
rc = dev->change_protocol(dev, &rc_type);
if (rc < 0)
goto out_raw;
+ dev->enabled_protocols = rc_type;
}
mutex_unlock(&dev->lock);
* @driver_type: specifies if protocol decoding is done in hardware or software
* @idle: used to keep track of RX state
* @allowed_protos: bitmask with the supported RC_BIT_* protocols
+ * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
* @scanmask: some hardware decoders are not capable of providing the full
* scancode to the application. As this is a hardware limit, we can't do
* anything with it. Yet, as the same keycode table can be used with other
enum rc_driver_type driver_type;
bool idle;
u64 allowed_protos;
+ u64 enabled_protocols;
u32 scanmask;
void *priv;
spinlock_t keylock;