rc-core: my current patchqueue
Subsystems (6)
David Härdeman
maintainercover rc-core: my current patchqueue
The following series is what's in my current patch queue for rc-core.
It only been lightly tested so far and it's based on the "for_v2.6.39" branch, but I still wanted to send it to the list so that I can get some feedback while I refresh the patches to "for_v2.6.40" and do more testing.
The most interesting change is that the scancode that is passed to/from the EVIOC[GS]KEYCODE_V2 ioctl has been extended so that this struct:
struct input_keymap_entry {
__u8 flags;
__u8 len;
__u16 index;
__u32 keycode;
__u8 scancode[32];
};Is parsed like this:
struct rc_scancode {
__u16 protocol;
__u16 reserved[3];
__u64 scancode;
}
struct rc_keymap_entry {
__u8 flags;
__u8 len;
__u16 index;
__u32 keycode;
union {
struct rc_scancode rc;
__u8 raw[32];
};
};Which allows the protocol to be specified along with the scancode.
Some heuristics are in place to guess the correct protocol when it is missing (i.e. when the legacy ioctl's are used or when the new ioctl's are used but with a shorter len).
The advantage is that rc-core doesn't throw away its knowledge of the protocol used to generate a given scancode. This also means that e.g. merging the rc5 and streamzap decoders is made easier (see one of the last patches in this series). In addition, it makes it possible to have mixed-protocol keytables, should anyone wish to do that.
This unfortunately means that every keymap had to be changed as well which is the reason for the large number of lines changed in the combined diffstat (the number of lines changed would probably be in the hundreds rather than thousands if keymaps were excluded).
Comments?
---
David Härdeman (10):
rc-core: int to bool conversion for winbond-cir
rc-core: add TX support to the winbond-cir driver
rc-core: use ir_raw_event_store_with_filter in winbond-cir
rc-core: add trailing silence in rc-loopback tx
rc-core: add separate defines for protocol bitmaps and numbers
rc-core: don't throw away protocol information
rc-core: use the full 32 bits for NEC scancodes
rc-core: merge rc5 and streamzap decoders
rc-core: lirc use unsigned int
rc-core: move timeout and checks to lirc
drivers/media/dvb/dm1105/dm1105.c | 3 drivers/media/dvb/dvb-usb/af9015.c | 34 +- drivers/media/dvb/dvb-usb/anysee.c | 4 drivers/media/dvb/dvb-usb/dib0700_core.c | 10 drivers/media/dvb/dvb-usb/dib0700_devices.c | 126 +++--- drivers/media/dvb/dvb-usb/dvb-usb.h | 2 drivers/media/dvb/dvb-usb/lmedm04.c | 2 drivers/media/dvb/dvb-usb/technisat-usb2.c | 2 drivers/media/dvb/dvb-usb/ttusb2.c | 4 drivers/media/dvb/mantis/mantis_input.c | 117 +++-- drivers/media/dvb/siano/smsir.c | 2 drivers/media/dvb/ttpci/budget-ci.c | 7 drivers/media/rc/Kconfig | 12 - drivers/media/rc/Makefile | 1 drivers/media/rc/ene_ir.c | 6 drivers/media/rc/ene_ir.h | 2 drivers/media/rc/imon.c | 35 +- drivers/media/rc/ir-jvc-decoder.c | 6 drivers/media/rc/ir-lirc-codec.c | 46 ++ drivers/media/rc/ir-nec-decoder.c | 32 - drivers/media/rc/ir-raw.c | 2 drivers/media/rc/ir-rc5-decoder.c | 62 ++- drivers/media/rc/ir-rc5-sz-decoder.c | 153 ------- drivers/media/rc/ir-rc6-decoder.c | 6 drivers/media/rc/ir-sony-decoder.c | 17 + drivers/media/rc/ite-cir.c | 7 drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 89 ++-- drivers/media/rc/keymaps/rc-alink-dtu-m.c | 37 +- drivers/media/rc/keymaps/rc-anysee.c | 89 ++-- drivers/media/rc/keymaps/rc-apac-viewcomp.c | 65 +-- drivers/media/rc/keymaps/rc-asus-pc39.c | 79 ++-- drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 49 +- drivers/media/rc/keymaps/rc-avermedia-a16d.c | 69 ++- drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 109 ++--- drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 69 ++- drivers/media/rc/keymaps/rc-avermedia-m135a.c | 187 ++++---- .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 89 ++-- drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 55 +- drivers/media/rc/keymaps/rc-avermedia.c | 73 ++- drivers/media/rc/keymaps/rc-avertv-303.c | 73 ++- drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 107 ++--- drivers/media/rc/keymaps/rc-behold-columbus.c | 73 ++- drivers/media/rc/keymaps/rc-behold.c | 69 ++- drivers/media/rc/keymaps/rc-budget-ci-old.c | 91 ++-- drivers/media/rc/keymaps/rc-cinergy-1400.c | 75 ++- drivers/media/rc/keymaps/rc-cinergy.c | 73 ++- drivers/media/rc/keymaps/rc-dib0700-nec.c | 141 +++--- drivers/media/rc/keymaps/rc-dib0700-rc5.c | 361 ++++++++-------- drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 99 ++-- drivers/media/rc/keymaps/rc-digittrade.c | 57 +-- drivers/media/rc/keymaps/rc-dm1105-nec.c | 63 +-- drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 65 +-- drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 107 ++--- drivers/media/rc/keymaps/rc-em-terratec.c | 57 +-- drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 59 +-- drivers/media/rc/keymaps/rc-encore-enltv.c | 131 +++--- drivers/media/rc/keymaps/rc-encore-enltv2.c | 79 ++-- drivers/media/rc/keymaps/rc-evga-indtube.c | 33 + drivers/media/rc/keymaps/rc-eztv.c | 89 ++-- drivers/media/rc/keymaps/rc-flydvb.c | 65 +-- drivers/media/rc/keymaps/rc-flyvideo.c | 53 +- drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 105 ++--- drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 63 +-- drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 65 +-- drivers/media/rc/keymaps/rc-gotview7135.c | 69 ++- drivers/media/rc/keymaps/rc-hauppauge.c | 287 ++++++------- drivers/media/rc/keymaps/rc-imon-mce.c | 173 ++++---- drivers/media/rc/keymaps/rc-imon-pad.c | 215 +++++----- drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 87 ++-- drivers/media/rc/keymaps/rc-kaiomy.c | 65 +-- drivers/media/rc/keymaps/rc-kworld-315u.c | 65 +-- .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 71 ++- drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 101 ++--- drivers/media/rc/keymaps/rc-lirc.c | 1 drivers/media/rc/keymaps/rc-lme2510.c | 133 +++--- drivers/media/rc/keymaps/rc-manli.c | 97 ++-- drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 37 +- drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 65 +-- drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 89 ++-- drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 49 +- drivers/media/rc/keymaps/rc-nebula.c | 111 ++--- .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 121 +++-- drivers/media/rc/keymaps/rc-norwood.c | 69 +-- drivers/media/rc/keymaps/rc-npgtech.c | 71 ++- drivers/media/rc/keymaps/rc-pctv-sedna.c | 65 +-- drivers/media/rc/keymaps/rc-pinnacle-color.c | 107 ++--- drivers/media/rc/keymaps/rc-pinnacle-grey.c | 83 ++-- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 51 +- drivers/media/rc/keymaps/rc-pixelview-002t.c | 53 +- drivers/media/rc/keymaps/rc-pixelview-mk12.c | 63 +-- drivers/media/rc/keymaps/rc-pixelview-new.c | 63 +-- drivers/media/rc/keymaps/rc-pixelview.c | 77 ++- .../media/rc/keymaps/rc-powercolor-real-angel.c | 71 ++- drivers/media/rc/keymaps/rc-proteus-2309.c | 49 +- drivers/media/rc/keymaps/rc-purpletv.c | 71 ++- drivers/media/rc/keymaps/rc-pv951.c | 63 +-- drivers/media/rc/keymaps/rc-rc6-mce.c | 151 +++---- .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 57 +-- drivers/media/rc/keymaps/rc-streamzap.c | 75 ++- drivers/media/rc/keymaps/rc-tbs-nec.c | 69 ++- drivers/media/rc/keymaps/rc-technisat-usb2.c | 67 +-- drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 95 ++-- drivers/media/rc/keymaps/rc-terratec-slim-2.c | 37 +- drivers/media/rc/keymaps/rc-terratec-slim.c | 57 +-- drivers/media/rc/keymaps/rc-tevii-nec.c | 95 ++-- drivers/media/rc/keymaps/rc-total-media-in-hand.c | 71 ++- drivers/media/rc/keymaps/rc-trekstor.c | 57 +-- drivers/media/rc/keymaps/rc-tt-1500.c | 79 ++-- drivers/media/rc/keymaps/rc-twinhan1027.c | 107 ++--- drivers/media/rc/keymaps/rc-videomate-m1f.c | 103 ++--- drivers/media/rc/keymaps/rc-videomate-s350.c | 89 ++-- drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 93 ++-- drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 57 +-- drivers/media/rc/keymaps/rc-winfast.c | 113 +++-- drivers/media/rc/mceusb.c | 30 - drivers/media/rc/nuvoton-cir.c | 14 - drivers/media/rc/rc-core-priv.h | 9 drivers/media/rc/rc-loopback.c | 33 - drivers/media/rc/rc-main.c | 248 ++++++++--- drivers/media/rc/streamzap.c | 12 - drivers/media/rc/winbond-cir.c | 442 ++++++++++++++++---- drivers/media/video/bt8xx/bttv-input.c | 10 drivers/media/video/cx18/cx18-i2c.c | 2 drivers/media/video/cx231xx/cx231xx-input.c | 2 drivers/media/video/cx23885/cx23885-input.c | 4 drivers/media/video/cx88/cx88-input.c | 18 - drivers/media/video/em28xx/em28xx-cards.c | 17 + drivers/media/video/em28xx/em28xx-input.c | 38 +- drivers/media/video/em28xx/em28xx.h | 1 drivers/media/video/hdpvr/hdpvr-i2c.c | 2 drivers/media/video/ir-kbd-i2c.c | 26 + drivers/media/video/ivtv/ivtv-i2c.c | 8 drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 4 drivers/media/video/saa7134/saa7134-input.c | 8 drivers/staging/tm6000/tm6000-cards.c | 2 drivers/staging/tm6000/tm6000-input.c | 46 +- include/media/rc-core.h | 30 + include/media/rc-map.h | 62 ++- 138 files changed, 4735 insertions(+), 4609 deletions(-) delete mode 100644 drivers/media/rc/ir-rc5-sz-decoder.c
Signature · 1 line
David Härdeman
David Härdeman
maintainerPATCH 1/10 rc-core: int to bool conversion for winbond-cir
Using bool instead of an int helps readability a bit.
--- drivers/media/rc/winbond-cir.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/media/rc/winbond-cir.c +8 -8
@@ -382,7 +382,7 @@ wbcir_shutdown(struct pnp_dev *device) {struct device *dev = &device->dev;struct wbcir_data *data =pnp_get_drvdata (device); -int do_wake =1 ; +bool do_wake = true;u8 match[11 ];u8 mask[11 ];u8 rc6_csl =0 ;
@@ -392,14 +392,14 @@ wbcir_shutdown(struct pnp_dev *device)memset (mask,0 ,sizeof (mask));if (wake_sc ==INVALID_SCANCODE || !device_may_wakeup (dev)) { - do_wake =0 ; + do_wake = false; goto finish; }switch (protocol) {case IR_PROTOCOL_RC5 :if (wake_sc >0xFFF ) { - do_wake =0 ; + do_wake = false;dev_err (dev,"RC5 - Invalid wake scancode\n" );break ; }
@@ -418,7 +418,7 @@ wbcir_shutdown(struct pnp_dev *device)case IR_PROTOCOL_NEC :if (wake_sc >0xFFFFFF ) { - do_wake =0 ; + do_wake = false;dev_err (dev,"NEC - Invalid wake scancode\n" );break ; }
@@ -440,7 +440,7 @@ wbcir_shutdown(struct pnp_dev *device)if (wake_rc6mode ==0 ) {if (wake_sc >0xFFFF ) { - do_wake =0 ; + do_wake = false;dev_err (dev,"RC6 - Invalid wake scancode\n" );break ; }
@@ -496,7 +496,7 @@ wbcir_shutdown(struct pnp_dev *device) }else if (wake_sc <=0x007FFFFF ) { rc6_csl =60 ; }else { - do_wake =0 ; + do_wake = false;dev_err (dev,"RC6 - Invalid wake scancode\n" );break ; }
@@ -508,14 +508,14 @@ wbcir_shutdown(struct pnp_dev *device) mask[i++] =0x0F ; }else { - do_wake =0 ; + do_wake = false;dev_err (dev,"RC6 - Invalid wake mode\n" ); }break ;default : - do_wake =0 ; + do_wake = false;break ; }
David Härdeman
maintainerPATCH 2/10 rc-core: add TX support to the winbond-cir driver
In reply to David HärdemanThis patch adds preliminary IR TX capabilities to the winbond-cir driver.
--- drivers/media/rc/winbond-cir.c | 431 +++++++++++++++++++++++++++++++++------- 1 files changed, 356 insertions(+), 75 deletions(-)
drivers/media/rc/winbond-cir.c +356 -75
@@ -19,11 +19,12 @@* o DSDT dumps * * Supported features: +* o IR Receive +* o IR Transmit * o Wake-On-CIR functionality * * To do: * o Learning -* o IR Transmit * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -50,6 +51,8 @@#include <linux/io.h> #include <linux/bitrev.h> #include <linux/slab.h> +#include <linux/wait.h> +#include <linux/sched.h> #include <media/rc-core.h> #define DRVNAME "winbond-cir"
@@ -118,14 +121,24 @@#define WBCIR_IRQ_NONE 0x00/* RX data bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */ #define WBCIR_IRQ_RX 0x01 +/* TX data low bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */ +#define WBCIR_IRQ_TX_LOW 0x02/* Over/Under-flow bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */ #define WBCIR_IRQ_ERR 0x04 +/* TX data empty bit for WBCEIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */ +#define WBCIR_IRQ_TX_EMPTY 0x20/* Led enable/disable bit for WBCIR_REG_ECEIR_CTS */ #define WBCIR_LED_ENABLE 0x80/* RX data available bit for WBCIR_REG_SP3_LSR */ #define WBCIR_RX_AVAIL 0x01 +/* RX data overrun error bit for WBCIR_REG_SP3_LSR */ +#define WBCIR_RX_OVERRUN 0x02 +/* TX End-Of-Transmission bit for WBCIR_REG_SP3_ASCR */ +#define WBCIR_TX_EOT 0x04/* RX disable bit for WBCIR_REG_SP3_ASCR */ #define WBCIR_RX_DISABLE 0x20 +/* TX data underrun error bit for WBCIR_REG_SP3_ASCR */ +#define WBCIR_TX_UNDERRUN 0x40/* Extended mode enable bit for WBCIR_REG_SP3_EXCR1 */ #define WBCIR_EXT_ENABLE 0x01/* Select compare register in WBCIR_REG_WCEIR_INDEX (bits 5 & 6) */
@@ -154,6 +167,21 @@ enum wbcir_protocol { IR_PROTOCOL_RC6 = 0x2, }; +/* Possible states for IR reception */ +enum wbcir_rxstate { +WBCIR_RXSTATE_INACTIVE =0 , +WBCIR_RXSTATE_ACTIVE , +WBCIR_RXSTATE_ERROR +}; + +/* Possible states for IR transmission */ +enum wbcir_txstate { +WBCIR_TXSTATE_INACTIVE =0 , +WBCIR_TXSTATE_ACTIVE , +WBCIR_TXSTATE_DONE , +WBCIR_TXSTATE_ERROR +}; +/* Misc */ #define WBCIR_NAME "Winbond CIR"#define WBCIR_ID_FAMILY 0xF1/* Family ID for the WPCD376I */
@@ -166,22 +194,29 @@ enum wbcir_protocol {/* Per-device data */ struct wbcir_data {spinlock_t spinlock; +struct rc_dev *dev; +struct led_classdev led;unsigned long wbase;/* Wake-Up Baseaddr */ unsigned long ebase;/* Enhanced Func. Baseaddr */ unsigned long sbase;/* Serial Port Baseaddr */ unsigned int irq;/* Serial Port IRQ */ +u8 irqmask; -struct rc_dev *dev; - +/* RX state */ +enum wbcir_rxstate rxstate;struct led_trigger *rxtrigger; -struct led_trigger *txtrigger; -struct led_classdev led; +struct ir_raw_event rxev; -/* RX irdata state */ -bool irdata_active; -bool irdata_error; -struct ir_raw_event ev; +/* TX state */ +enum wbcir_txstate txstate; +struct led_trigger *txtrigger; +u32 txlen; +u32 txoff; +u32 *txbuf; +wait_queue_head_t txwaitq; +u8 txmask; +u32 txcarrier; };static enum wbcir_protocol protocol =IR_PROTOCOL_RC6 ;
@@ -193,6 +228,10 @@ static int invert; /* default = 0 */module_param (invert, bool,0444 );MODULE_PARM_DESC (invert,"Invert the signal from the IR receiver" ); +static int txandrx;/* default = 0 */ +module_param (txandrx, bool,0444 ); +MODULE_PARM_DESC (invert,"Allow simultaneous TX and RX" ); +static unsigned int wake_sc =0x800F040C ;module_param (wake_sc, uint,0644 );MODULE_PARM_DESC (wake_sc,"Scancode of the power-on IR command" );
@@ -228,6 +267,17 @@ wbcir_select_bank(struct wbcir_data *data, enum wbcir_bank bank)outb (bank, data->sbase +WBCIR_REG_SP3_BSR ); } +static inline void +wbcir_set_irqmask (struct wbcir_data *data,u8 irqmask) +{ +if (data->irqmask == irqmask) +return ; + +wbcir_select_bank (data,WBCIR_BANK_0 ); +outb (irqmask, data->sbase +WBCIR_REG_SP3_IER ); + data->irqmask = irqmask; +} +static enum led_brightness wbcir_led_brightness_get (struct led_classdev *led_cdev) {
@@ -279,39 +329,15 @@ wbcir_to_rc6cells(u8 val)* *****************************************************************************/ -static irqreturn_t -wbcir_irq_handler (int irqno,void *cookie) +static void +wbcir_irq_rx (struct wbcir_data *data,struct pnp_dev *device) { -struct pnp_dev *device = cookie; -struct wbcir_data *data =pnp_get_drvdata (device); -unsigned long flags;u8 irdata[8 ]; -u8 disable = true; -u8 status; -int i; - -spin_lock_irqsave (&data->spinlock, flags); - -wbcir_select_bank (data,WBCIR_BANK_0 ); - - status =inb (data->sbase +WBCIR_REG_SP3_EIR ); - -if (!(status & (WBCIR_IRQ_RX |WBCIR_IRQ_ERR ))) { -spin_unlock_irqrestore (&data->spinlock, flags); -return IRQ_NONE ; - } - -/* Check for e.g. buffer overflow */ -if (status &WBCIR_IRQ_ERR ) { - data->irdata_error = true; -ir_raw_event_reset (data->dev); - } - -if (!(status &WBCIR_IRQ_RX )) - goto out; +bool disable = true; +unsigned int i; -if (!data->irdata_active) { - data->irdata_active = true; +if (data->rxstate ==WBCIR_RXSTATE_INACTIVE ) { + data->rxstate =WBCIR_RXSTATE_ACTIVE ;led_trigger_event (data->rxtrigger,LED_FULL ); }
@@ -325,28 +351,29 @@ wbcir_irq_handler(int irqno, void *cookie)if (irdata[i] !=0xFF && irdata[i] !=0x00 ) disable = false; -if (data->irdata_error) +if (data->rxstate ==WBCIR_RXSTATE_ERROR )continue ; pulse = irdata[i] &0x80 ? false : true; duration = (irdata[i] &0x7F ) *10000 ;/* ns */ -if (data->ev.pulse != pulse) { -if (data->ev.duration !=0 ) { -ir_raw_event_store (data->dev, &data->ev); - data->ev.duration =0 ; +if (data->rxev.pulse != pulse) { +if (data->rxev.duration !=0 ) { +ir_raw_event_store (data->dev, &data->rxev); + data->rxev.duration =0 ; } - data->ev.pulse = pulse; + data->rxev.pulse = pulse; } - data->ev.duration += duration; + data->rxev.duration += duration; }if (disable) { -if (data->ev.duration !=0 && !data->irdata_error) { -ir_raw_event_store (data->dev, &data->ev); - data->ev.duration =0 ; +if (data->rxev.duration !=0 && + data->rxstate !=WBCIR_RXSTATE_ERROR ) { +ir_raw_event_store (data->dev, &data->rxev); + data->rxev.duration =0 ; }/* Set RXINACTIVE */
@@ -357,19 +384,264 @@ wbcir_irq_handler(int irqno, void *cookie)inb (data->sbase +WBCIR_REG_SP3_RXDATA );ir_raw_event_reset (data->dev); - data->irdata_error = false; - data->irdata_active = false;led_trigger_event (data->rxtrigger,LED_OFF ); + data->rxstate =WBCIR_RXSTATE_INACTIVE ; }ir_raw_event_handle (data->dev); +} + +static void +wbcir_irq_tx (struct wbcir_data *data) +{ +unsigned int space; +unsigned int used; +u8 bytes[16 ]; +u8 byte; + +if (!data->txbuf) +return ; + +switch (data->txstate) { +case WBCIR_TXSTATE_INACTIVE : +/* TX FIFO empty */ + space =16 ; +led_trigger_event (data->txtrigger,LED_FULL ); +break ; +case WBCIR_TXSTATE_ACTIVE : +/* TX FIFO low (3 bytes or less) */ + space =13 ; +break ; +case WBCIR_TXSTATE_ERROR : + space =0 ; +break ; +default : +return ; + } + +/* +* TX data is run-length coded in bytes: YXXXXXXX +* Y = space (1) or pulse (0) +* X = duration, encoded as (X + 1) * 10us (i.e 10 to 1280 us) +*/ +for (used =0 ; used < space && data->txoff != data->txlen; used++) { +if (data->txbuf[data->txoff] ==0 ) { + data->txoff++; +continue ; + } + byte =min ((u32 )0x80 , data->txbuf[data->txoff]); + data->txbuf[data->txoff] -= byte; + byte--; + byte |= (data->txoff %2 ?0x80 :0x00 );/* pulse/space */ + bytes[used] = byte; + } + +while (data->txbuf[data->txoff] ==0 && data->txoff != data->txlen) + data->txoff++; + +if (used ==0 ) { +/* Finished */ +if (data->txstate ==WBCIR_TXSTATE_ERROR ) +/* Clear TX underrun bit */ +outb (WBCIR_TX_UNDERRUN , data->sbase +WBCIR_REG_SP3_ASCR ); +else + data->txstate =WBCIR_TXSTATE_DONE ; +wbcir_set_irqmask (data,WBCIR_IRQ_RX |WBCIR_IRQ_ERR ); +led_trigger_event (data->txtrigger,LED_OFF ); +wake_up (&data->txwaitq); + }else if (data->txoff == data->txlen) { +/* At the end of transmission, tell the hw before last byte */ +outsb (data->sbase +WBCIR_REG_SP3_TXDATA , bytes, used -1 ); +outb (WBCIR_TX_EOT , data->sbase +WBCIR_REG_SP3_ASCR ); +outb (bytes[used -1 ], data->sbase +WBCIR_REG_SP3_TXDATA ); +wbcir_set_irqmask (data,WBCIR_IRQ_RX |WBCIR_IRQ_ERR | +WBCIR_IRQ_TX_EMPTY ); + }else { +/* More data to follow... */ +outsb (data->sbase +WBCIR_REG_SP3_RXDATA , bytes, used); +if (data->txstate ==WBCIR_TXSTATE_INACTIVE ) { +wbcir_set_irqmask (data,WBCIR_IRQ_RX |WBCIR_IRQ_ERR | +WBCIR_IRQ_TX_LOW ); + data->txstate =WBCIR_TXSTATE_ACTIVE ; + } + } +} + +static irqreturn_t +wbcir_irq_handler (int irqno,void *cookie) +{ +struct pnp_dev *device = cookie; +struct wbcir_data *data =pnp_get_drvdata (device); +unsigned long flags; +u8 status; + +spin_lock_irqsave (&data->spinlock, flags); +wbcir_select_bank (data,WBCIR_BANK_0 ); + status =inb (data->sbase +WBCIR_REG_SP3_EIR ); + status &= data->irqmask; + +if (!status) { +spin_unlock_irqrestore (&data->spinlock, flags); +return IRQ_NONE ; + } + +if (status &WBCIR_IRQ_ERR ) { +/* RX overflow? (read clears bit) */ +if (inb (data->sbase +WBCIR_REG_SP3_LSR ) &WBCIR_RX_OVERRUN ) { + data->rxstate =WBCIR_RXSTATE_ERROR ; +ir_raw_event_reset (data->dev); + } + +/* TX underflow? */ +if (inb (data->sbase +WBCIR_REG_SP3_ASCR ) &WBCIR_TX_UNDERRUN ) + data->txstate =WBCIR_TXSTATE_ERROR ; + } + +if (status &WBCIR_IRQ_RX ) +wbcir_irq_rx (data, device); + +if (status & (WBCIR_IRQ_TX_LOW |WBCIR_IRQ_TX_EMPTY )) +wbcir_irq_tx (data); -out:spin_unlock_irqrestore (&data->spinlock, flags);return IRQ_HANDLED ; } +/***************************************************************************** +* +* RC-CORE INTERFACE FUNCTIONS +* +*****************************************************************************/ + +static int +wbcir_txcarrier (struct rc_dev *dev,u32 carrier) +{ +struct wbcir_data *data = dev->priv; +unsigned long flags; +u8 val; +u32 freq; + + freq =DIV_ROUND_CLOSEST (carrier,1000 ); +if (freq <30 || freq >60 ) +return -EINVAL ; + +switch (freq) { +case 58 : +case 59 : +case 60 : + val = freq -58 ; + freq *=1000 ; +break ; +case 57 : + val = freq -27 ; + freq =56900 ; +break ; +default : + val = freq -27 ; + freq *=1000 ; +break ; + } + +spin_lock_irqsave (&data->spinlock, flags); +if (data->txstate !=WBCIR_TXSTATE_INACTIVE ) { +spin_unlock_irqrestore (&data->spinlock, flags); +return -EBUSY ; + } + +if (data->txcarrier != freq) { +wbcir_select_bank (data,WBCIR_BANK_7 ); +wbcir_set_bits (data->sbase +WBCIR_REG_SP3_IRTXMC , val,0x1F ); + data->txcarrier = freq; + } + +spin_unlock_irqrestore (&data->spinlock, flags); +return 0 ; +} + +static int +wbcir_txmask (struct rc_dev *dev,u32 mask) +{ +struct wbcir_data *data = dev->priv; +unsigned long flags; +u8 val; + +/* Four outputs, only one output can be enabled at a time */ +switch (mask) { +case 0x1 : + val =0x0 ; +break ; +case 0x2 : + val =0x1 ; +break ; +case 0x4 : + val =0x2 ; +break ; +case 0x8 : + val =0x3 ; +break ; +default : +return -EINVAL ; + } + +spin_lock_irqsave (&data->spinlock, flags); +if (data->txstate !=WBCIR_TXSTATE_INACTIVE ) { +spin_unlock_irqrestore (&data->spinlock, flags); +return -EBUSY ; + } + +if (data->txmask != mask) { +wbcir_set_bits (data->ebase +WBCIR_REG_ECEIR_CTS , val,0x0c ); + data->txmask = mask; + } + +spin_unlock_irqrestore (&data->spinlock, flags); +return 0 ; +} + +static int +wbcir_tx (struct rc_dev *dev,int *buf,u32 bufsize) +{ +struct wbcir_data *data = dev->priv; +u32 count; +unsigned i; +unsigned long flags; + +/* bufsize has been sanity checked by the caller */ + count = bufsize /sizeof (int ); + +/* Not sure if this is possible, but better safe than sorry */ +spin_lock_irqsave (&data->spinlock, flags); +if (data->txstate !=WBCIR_TXSTATE_INACTIVE ) { +spin_unlock_irqrestore (&data->spinlock, flags); +return -EBUSY ; + } + +/* Convert values to multiples of 10us */ +for (i =0 ; i < count; i++) + buf[i] =DIV_ROUND_CLOSEST (buf[i],10 ); + +/* Fill the TX fifo once, the irq handler will do the rest */ + data->txbuf = buf; + data->txlen = count; + data->txoff =0 ; +wbcir_irq_tx (data); + +/* Wait for the TX to complete */ +while (data->txstate ==WBCIR_TXSTATE_ACTIVE ) { +spin_unlock_irqrestore (&data->spinlock, flags); +wait_event (data->txwaitq, data->txstate !=WBCIR_TXSTATE_ACTIVE ); +spin_lock_irqsave (&data->spinlock, flags); + } + +/* We're done */ +if (data->txstate ==WBCIR_TXSTATE_ERROR ) + count = -EAGAIN ; + data->txstate =WBCIR_TXSTATE_INACTIVE ; + data->txbuf =NULL ; +spin_unlock_irqrestore (&data->spinlock, flags); +return count; +}/***************************************************************************** *
@@ -551,21 +823,18 @@ finish:wbcir_set_bits (data->wbase +WBCIR_REG_WCEIR_CTL ,0x00 ,0x01 ); } -/* Disable interrupts */ -wbcir_select_bank (data,WBCIR_BANK_0 ); -outb (WBCIR_IRQ_NONE , data->sbase +WBCIR_REG_SP3_IER ); - -/* Disable LED */ - data->irdata_active = false; -led_trigger_event (data->rxtrigger,LED_OFF ); -/* * ACPI will set the HW disable bit for SP3 which means that the * output signals are left in an undefined state which may cause * spurious interrupts which we need to ignore until the hardware * is reinitialized. */ +wbcir_set_irqmask (data,WBCIR_IRQ_NONE );disable_irq (data->irq); + +/* Disable LED */ +led_trigger_event (data->rxtrigger,LED_OFF ); +led_trigger_event (data->txtrigger,LED_OFF ); } static int
@@ -581,8 +850,7 @@ wbcir_init_hw(struct wbcir_data *data)u8 tmp;/* Disable interrupts */ -wbcir_select_bank (data,WBCIR_BANK_0 ); -outb (WBCIR_IRQ_NONE , data->sbase +WBCIR_REG_SP3_IER ); +wbcir_set_irqmask (data,WBCIR_IRQ_NONE );/* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */ tmp = protocol <<4 ;
@@ -606,10 +874,11 @@ wbcir_init_hw(struct wbcir_data *data)outb (0x00 , data->ebase +WBCIR_REG_ECEIR_CCTL );/* -* Clear IR LED, set SP3 clock to 24Mhz +* Clear IR LED, set SP3 clock to 24Mhz, set TX mask to IRTX1, * set SP3_IRRX_SW to binary 01, helpfully not documented */ outb (0x10 , data->ebase +WBCIR_REG_ECEIR_CTS ); + data->txmask =0x1 ;/* Enable extended mode */ wbcir_select_bank (data,WBCIR_BANK_2 );
@@ -647,18 +916,21 @@ wbcir_init_hw(struct wbcir_data *data)wbcir_select_bank (data,WBCIR_BANK_4 );outb (0x00 , data->sbase +WBCIR_REG_SP3_IRCR1 ); -/* Enable MSR interrupt, Clear AUX_IRX */ +/* Disable MSR interrupt, clear AUX_IRX, mask RX during TX? */ wbcir_select_bank (data,WBCIR_BANK_5 ); -outb (0x00 , data->sbase +WBCIR_REG_SP3_IRCR2 ); +outb (txandrx ?0x03 :0x02 , data->sbase +WBCIR_REG_SP3_IRCR2 );/* Disable CRC */ wbcir_select_bank (data,WBCIR_BANK_6 );outb (0x20 , data->sbase +WBCIR_REG_SP3_IRCR3 ); -/* Set RX/TX (de)modulation freq, not really used */ +/* Set RX demodulation freq, not really used */ wbcir_select_bank (data,WBCIR_BANK_7 );outb (0xF2 , data->sbase +WBCIR_REG_SP3_IRRXDC ); + +/* Set TX modulation, 36kHz, 7us pulse width */ outb (0x69 , data->sbase +WBCIR_REG_SP3_IRTXMC ); + data->txcarrier =36000 ;/* Set invert and pin direction */ if (invert)
@@ -673,16 +945,23 @@ wbcir_init_hw(struct wbcir_data *data)/* Clear AUX status bits */ outb (0xE0 , data->sbase +WBCIR_REG_SP3_ASCR ); -/* Clear IR decoding state */ - data->irdata_active = false; -led_trigger_event (data->rxtrigger,LED_OFF ); - data->irdata_error = false; - data->ev.duration =0 ; +/* Clear RX state */ + data->rxstate =WBCIR_RXSTATE_INACTIVE ; + data->rxev.duration =0 ;ir_raw_event_reset (data->dev);ir_raw_event_handle (data->dev); +/* +* Check TX state, if we did a suspend/resume cycle while TX was +* active, we will have a process waiting in txwaitq. +*/ +if (data->txstate ==WBCIR_TXSTATE_ACTIVE ) { + data->txstate =WBCIR_TXSTATE_ERROR ; +wake_up (&data->txwaitq); + } +/* Enable interrupts */ -outb (WBCIR_IRQ_RX |WBCIR_IRQ_ERR , data->sbase +WBCIR_REG_SP3_IER ); +wbcir_set_irqmask (data,WBCIR_IRQ_RX |WBCIR_IRQ_ERR ); } static int
@@ -719,6 +998,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)pnp_set_drvdata (device, data);spin_lock_init (&data->spinlock); +init_waitqueue_head (&data->txwaitq); data->ebase =pnp_port_start (device,0 ); data->wbase =pnp_port_start (device,1 ); data->sbase =pnp_port_start (device,2 );
@@ -799,6 +1079,9 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) data->dev->input_id.product =WBCIR_ID_FAMILY ; data->dev->input_id.version =WBCIR_ID_CHIP ; data->dev->map_name =RC_MAP_RC6_MCE ; + data->dev->s_tx_mask = wbcir_txmask; + data->dev->s_tx_carrier = wbcir_txcarrier; + data->dev->tx_ir = wbcir_tx; data->dev->priv = data; data->dev->dev.parent = &device->dev;
@@ -841,9 +1124,7 @@ wbcir_remove(struct pnp_dev *device)struct wbcir_data *data =pnp_get_drvdata (device);/* Disable interrupts */ -wbcir_select_bank (data,WBCIR_BANK_0 ); -outb (WBCIR_IRQ_NONE , data->sbase +WBCIR_REG_SP3_IER ); - +wbcir_set_irqmask (data,WBCIR_IRQ_NONE );free_irq (data->irq, device);/* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
David Härdeman
maintainerPATCH 3/10 rc-core: use ir_raw_event_store_with_filter in winbond-cir
In reply to David HärdemanUsing ir_raw_event_store_with_filter() saves about 20 lines of code.
--- drivers/media/rc/winbond-cir.c | 63 +++++++++++++--------------------------- 1 files changed, 21 insertions(+), 42 deletions(-)
drivers/media/rc/winbond-cir.c +21 -42
@@ -330,60 +330,38 @@ wbcir_to_rc6cells(u8 val)*****************************************************************************/ static void -wbcir_irq_rx (struct wbcir_data *data,struct pnp_dev *device) +wbcir_idle_rx (struct rc_dev *dev,bool idle) { -u8 irdata[8 ]; -bool disable = true; -unsigned int i; +struct wbcir_data *data = dev->priv; -if (data->rxstate ==WBCIR_RXSTATE_INACTIVE ) { +if (!idle && data->rxstate ==WBCIR_RXSTATE_INACTIVE ) { data->rxstate =WBCIR_RXSTATE_ACTIVE ;led_trigger_event (data->rxtrigger,LED_FULL ); } -/* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ -insb (data->sbase +WBCIR_REG_SP3_RXDATA , &irdata[0 ],8 ); - -for (i =0 ; i <8 ; i++) { -u8 pulse; -u32 duration; +if (idle && data->rxstate !=WBCIR_RXSTATE_INACTIVE ) +/* Tell hardware to go idle by setting RXINACTIVE */ +outb (WBCIR_RX_DISABLE , data->sbase +WBCIR_REG_SP3_ASCR ); +} -if (irdata[i] !=0xFF && irdata[i] !=0x00 ) - disable = false; +static void +wbcir_irq_rx (struct wbcir_data *data,struct pnp_dev *device) +{ +u8 irdata; +DEFINE_IR_RAW_EVENT (rawir); +/* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ +while (inb (data->sbase +WBCIR_REG_SP3_LSR ) &WBCIR_RX_AVAIL ) { + irdata =inb (data->sbase +WBCIR_REG_SP3_RXDATA );if (data->rxstate ==WBCIR_RXSTATE_ERROR )continue ; - - pulse = irdata[i] &0x80 ? false : true; - duration = (irdata[i] &0x7F ) *10000 ;/* ns */ - -if (data->rxev.pulse != pulse) { -if (data->rxev.duration !=0 ) { -ir_raw_event_store (data->dev, &data->rxev); - data->rxev.duration =0 ; - } - - data->rxev.pulse = pulse; - } - - data->rxev.duration += duration; + rawir.pulse = irdata &0x80 ? false : true; + rawir.duration =US_TO_NS ((irdata &0x7F ) *10 ); +ir_raw_event_store_with_filter (data->dev, &rawir); } -if (disable) { -if (data->rxev.duration !=0 && - data->rxstate !=WBCIR_RXSTATE_ERROR ) { -ir_raw_event_store (data->dev, &data->rxev); - data->rxev.duration =0 ; - } - -/* Set RXINACTIVE */ -outb (WBCIR_RX_DISABLE , data->sbase +WBCIR_REG_SP3_ASCR ); - -/* Drain the FIFO */ -while (inb (data->sbase +WBCIR_REG_SP3_LSR ) &WBCIR_RX_AVAIL ) -inb (data->sbase +WBCIR_REG_SP3_RXDATA ); - -ir_raw_event_reset (data->dev); +/* Check if we should go idle */ +if (data->dev->idle) {led_trigger_event (data->rxtrigger,LED_OFF ); data->rxstate =WBCIR_RXSTATE_INACTIVE ; }
@@ -1079,6 +1057,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) data->dev->input_id.product =WBCIR_ID_FAMILY ; data->dev->input_id.version =WBCIR_ID_CHIP ; data->dev->map_name =RC_MAP_RC6_MCE ; + data->dev->s_idle = wbcir_idle_rx; data->dev->s_tx_mask = wbcir_txmask; data->dev->s_tx_carrier = wbcir_txcarrier; data->dev->tx_ir = wbcir_tx;
David Härdeman
maintainerPATCH 4/10 rc-core: add trailing silence in rc-loopback tx
In reply to David HärdemanIf an IR command is sent (using the LIRC userspace) to rc-loopback which doesn't include a trailing space, the result is that the message won't be completely decoded. In addition, "leftovers" from a previous transmission can be left until the next one. Fix this by faking a long silence after the end of TX data.
--- drivers/media/rc/rc-loopback.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/media/rc/rc-loopback.c +6 -0
@@ -146,6 +146,12 @@ static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n)if (rawir.duration)ir_raw_event_store_with_filter (dev, &rawir); } + +/* Fake a silence long enough to cause us to go idle */ + rawir.pulse = false; + rawir.duration = dev->timeout; +ir_raw_event_store_with_filter (dev, &rawir); +ir_raw_event_handle (dev); out:
David Härdeman
maintainerPATCH 5/10 rc-core: add separate defines for protocol bitmaps and numbers
In reply to David HärdemanThe RC_TYPE_* defines are currently used both where a single protocol is expected and where a bitmap of protocols is expected. This patch tries to separate the two in preparation for the following patches.
--- drivers/media/dvb/dvb-usb/af9015.c | 12 +- drivers/media/dvb/dvb-usb/anysee.c | 2 drivers/media/dvb/dvb-usb/dib0700_core.c | 8 + drivers/media/dvb/dvb-usb/dib0700_devices.c | 116 ++++++++++---------- drivers/media/dvb/dvb-usb/technisat-usb2.c | 2 drivers/media/dvb/dvb-usb/ttusb2.c | 2 drivers/media/dvb/mantis/mantis_input.c | 2 drivers/media/dvb/siano/smsir.c | 2 drivers/media/rc/ene_ir.c | 2 drivers/media/rc/imon.c | 26 ++-- drivers/media/rc/ir-jvc-decoder.c | 4 - drivers/media/rc/ir-lirc-codec.c | 4 - drivers/media/rc/ir-nec-decoder.c | 4 - drivers/media/rc/ir-rc5-decoder.c | 12 ++ drivers/media/rc/ir-rc5-sz-decoder.c | 4 - drivers/media/rc/ir-rc6-decoder.c | 4 - drivers/media/rc/ir-sony-decoder.c | 17 +++ drivers/media/rc/ite-cir.c | 2 drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 2 drivers/media/rc/keymaps/rc-alink-dtu-m.c | 2 drivers/media/rc/keymaps/rc-anysee.c | 2 drivers/media/rc/keymaps/rc-apac-viewcomp.c | 2 drivers/media/rc/keymaps/rc-asus-pc39.c | 2 drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 2 drivers/media/rc/keymaps/rc-avermedia-a16d.c | 2 drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 2 drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 2 drivers/media/rc/keymaps/rc-avermedia-m135a.c | 2 .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 2 drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 2 drivers/media/rc/keymaps/rc-avermedia.c | 2 drivers/media/rc/keymaps/rc-avertv-303.c | 2 drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 2 drivers/media/rc/keymaps/rc-behold-columbus.c | 2 drivers/media/rc/keymaps/rc-behold.c | 2 drivers/media/rc/keymaps/rc-budget-ci-old.c | 2 drivers/media/rc/keymaps/rc-cinergy-1400.c | 2 drivers/media/rc/keymaps/rc-cinergy.c | 2 drivers/media/rc/keymaps/rc-dib0700-nec.c | 2 drivers/media/rc/keymaps/rc-dib0700-rc5.c | 2 drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 2 drivers/media/rc/keymaps/rc-digittrade.c | 2 drivers/media/rc/keymaps/rc-dm1105-nec.c | 2 drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 2 drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 2 drivers/media/rc/keymaps/rc-em-terratec.c | 2 drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 2 drivers/media/rc/keymaps/rc-encore-enltv.c | 2 drivers/media/rc/keymaps/rc-encore-enltv2.c | 2 drivers/media/rc/keymaps/rc-evga-indtube.c | 2 drivers/media/rc/keymaps/rc-eztv.c | 2 drivers/media/rc/keymaps/rc-flydvb.c | 2 drivers/media/rc/keymaps/rc-flyvideo.c | 2 drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 2 drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 2 drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 2 drivers/media/rc/keymaps/rc-gotview7135.c | 2 drivers/media/rc/keymaps/rc-hauppauge.c | 2 drivers/media/rc/keymaps/rc-imon-mce.c | 2 drivers/media/rc/keymaps/rc-imon-pad.c | 2 drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 2 drivers/media/rc/keymaps/rc-kaiomy.c | 2 drivers/media/rc/keymaps/rc-kworld-315u.c | 2 .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 2 drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 2 drivers/media/rc/keymaps/rc-lirc.c | 2 drivers/media/rc/keymaps/rc-lme2510.c | 2 drivers/media/rc/keymaps/rc-manli.c | 2 drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 2 drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 2 drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 2 drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 2 drivers/media/rc/keymaps/rc-nebula.c | 2 .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 2 drivers/media/rc/keymaps/rc-norwood.c | 2 drivers/media/rc/keymaps/rc-npgtech.c | 2 drivers/media/rc/keymaps/rc-pctv-sedna.c | 2 drivers/media/rc/keymaps/rc-pinnacle-color.c | 2 drivers/media/rc/keymaps/rc-pinnacle-grey.c | 2 drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 2 drivers/media/rc/keymaps/rc-pixelview-002t.c | 2 drivers/media/rc/keymaps/rc-pixelview-mk12.c | 2 drivers/media/rc/keymaps/rc-pixelview-new.c | 2 drivers/media/rc/keymaps/rc-pixelview.c | 2 .../media/rc/keymaps/rc-powercolor-real-angel.c | 2 drivers/media/rc/keymaps/rc-proteus-2309.c | 2 drivers/media/rc/keymaps/rc-purpletv.c | 2 drivers/media/rc/keymaps/rc-pv951.c | 2 drivers/media/rc/keymaps/rc-rc6-mce.c | 2 .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 2 drivers/media/rc/keymaps/rc-streamzap.c | 2 drivers/media/rc/keymaps/rc-tbs-nec.c | 2 drivers/media/rc/keymaps/rc-technisat-usb2.c | 2 drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 2 drivers/media/rc/keymaps/rc-terratec-slim-2.c | 2 drivers/media/rc/keymaps/rc-terratec-slim.c | 2 drivers/media/rc/keymaps/rc-tevii-nec.c | 2 drivers/media/rc/keymaps/rc-total-media-in-hand.c | 2 drivers/media/rc/keymaps/rc-trekstor.c | 2 drivers/media/rc/keymaps/rc-tt-1500.c | 2 drivers/media/rc/keymaps/rc-twinhan1027.c | 2 drivers/media/rc/keymaps/rc-videomate-m1f.c | 2 drivers/media/rc/keymaps/rc-videomate-s350.c | 2 drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 2 drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 2 drivers/media/rc/keymaps/rc-winfast.c | 2 drivers/media/rc/mceusb.c | 2 drivers/media/rc/nuvoton-cir.c | 2 drivers/media/rc/rc-loopback.c | 2 drivers/media/rc/rc-main.c | 21 ++-- drivers/media/rc/streamzap.c | 2 drivers/media/video/cx18/cx18-i2c.c | 2 drivers/media/video/cx231xx/cx231xx-input.c | 2 drivers/media/video/cx23885/cx23885-input.c | 4 - drivers/media/video/cx88/cx88-input.c | 8 + drivers/media/video/em28xx/em28xx-input.c | 10 +- drivers/media/video/hdpvr/hdpvr-i2c.c | 2 drivers/media/video/ir-kbd-i2c.c | 14 +- drivers/media/video/ivtv/ivtv-i2c.c | 8 + drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 4 - drivers/media/video/saa7134/saa7134-input.c | 2 drivers/staging/tm6000/tm6000-input.c | 14 +- include/media/rc-map.h | 41 +++++-- 123 files changed, 291 insertions(+), 250 deletions(-)
drivers/media/dvb/dvb-usb/af9015.c +6 -6
@@ -1365,11 +1365,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = RC_TYPE_NEC, + .protocol = RC_BIT_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = RC_TYPE_NEC, + .allowed_protos = RC_BIT_NEC, }, .i2c_algo = &af9015_i2c_algo,
@@ -1493,11 +1493,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = RC_TYPE_NEC, + .protocol = RC_BIT_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = RC_TYPE_NEC, + .allowed_protos = RC_BIT_NEC, }, .i2c_algo = &af9015_i2c_algo,
@@ -1605,11 +1605,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = RC_TYPE_NEC, + .protocol = RC_BIT_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = RC_TYPE_NEC, + .allowed_protos = RC_BIT_NEC, }, .i2c_algo = &af9015_i2c_algo,
drivers/media/dvb/dvb-usb/anysee.c +1 -1
@@ -476,7 +476,7 @@ static struct dvb_usb_device_properties anysee_properties = { .rc.core = { .rc_codes = RC_MAP_ANYSEE, - .protocol = RC_TYPE_OTHER, + .protocol = RC_BIT_OTHER, .module_name = "anysee", .rc_query = anysee_rc_query, .rc_interval = 250, /* windows driver uses 500ms */
drivers/media/dvb/dvb-usb/dib0700_core.c +4 -4
@@ -514,11 +514,11 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type)int new_proto, ret;/* Set the IR mode */ -if (rc_type ==RC_TYPE_RC5 ) +if (rc_type ==RC_BIT_RC5 ) new_proto =1 ; -else if (rc_type ==RC_TYPE_NEC ) +else if (rc_type ==RC_BIT_NEC ) new_proto =0 ; -else if (rc_type ==RC_TYPE_RC6 ) { +else if (rc_type ==RC_BIT_RC6 ) {if (st->fw_version <0x10200 )return -EINVAL ;
@@ -597,7 +597,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) purb->actual_length);switch (d->props.rc.core.protocol) { -case RC_TYPE_NEC : +case RC_BIT_NEC : toggle =0 ;/* NEC protocol sends repeat code as 0 0 0 FF */
drivers/media/dvb/dvb-usb/dib0700_devices.c +58 -58
236 lines not on this page · raw message
drivers/media/dvb/dvb-usb/technisat-usb2.c +1 -1
@@ -729,7 +729,7 @@ static struct dvb_usb_device_properties technisat_usb2_devices = { .rc_codes = RC_MAP_TECHNISAT_USB2, .module_name = "technisat-usb2", .rc_query = technisat_usb2_rc_query, - .allowed_protos = RC_TYPE_ALL, + .allowed_protos = RC_BIT_ALL, .driver_type = RC_DRIVER_IR_RAW, } };
drivers/media/dvb/dvb-usb/ttusb2.c +1 -1
@@ -377,7 +377,7 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = { .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ .rc_codes = RC_MAP_TT_1500, .rc_query = tt3650_rc_query, - .allowed_protos = RC_TYPE_UNKNOWN, + .allowed_protos = RC_BIT_UNKNOWN, }, .num_adapters = 1,
drivers/media/dvb/mantis/mantis_input.c +1 -1
@@ -99,7 +99,7 @@ static struct rc_map_list ir_mantis_map = { .map = { .scan = mantis_ir_table, .size = ARRAY_SIZE(mantis_ir_table), - .rc_type = RC_TYPE_UNKNOWN, + .rc_type = RC_BIT_UNKNOWN, .name = RC_MAP_MANTIS, } };
drivers/media/dvb/siano/smsir.c +1 -1
@@ -88,7 +88,7 @@ int sms_ir_init(struct smscore_device_t *coredev) dev->priv = coredev; dev->driver_type =RC_DRIVER_IR_RAW ; - dev->allowed_protos =RC_TYPE_ALL ; + dev->allowed_protos =RC_BIT_ALL ; dev->map_name =sms_get_board (board_id)->rc_codes; dev->driver_name =MODULE_NAME ;
drivers/media/rc/ene_ir.c +1 -1
@@ -1056,7 +1056,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) learning_mode_force = false; rdev->driver_type =RC_DRIVER_IR_RAW ; - rdev->allowed_protos =RC_TYPE_ALL ; + rdev->allowed_protos =RC_BIT_ALL ; rdev->priv = dev; rdev->open = ene_open; rdev->close = ene_close;
drivers/media/rc/imon.c +13 -13
@@ -1005,17 +1005,17 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) "this device does not support\n");switch (rc_type) { -case RC_TYPE_RC6 : +case RC_BIT_RC6 :dev_dbg (dev,"Configuring IR receiver for MCE protocol\n" ); ir_proto_packet[0 ] =0x01 ;break ; -case RC_TYPE_UNKNOWN : -case RC_TYPE_OTHER : +case RC_BIT_UNKNOWN : +case RC_BIT_OTHER :dev_dbg (dev,"Configuring IR receiver for iMON protocol\n" );if (!pad_stabilize)dev_dbg (dev,"PAD stabilize functionality disabled\n" );/* ir_proto_packet[0] = 0x00; // already the default */ - rc_type =RC_TYPE_OTHER ; + rc_type =RC_BIT_OTHER ;break ;default : dev_warn(dev, "Unsupported IR protocol specified, overriding "
@@ -1023,7 +1023,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)if (!pad_stabilize)dev_dbg (dev,"PAD stabilize functionality disabled\n" );/* ir_proto_packet[0] = 0x00; // already the default */ - rc_type =RC_TYPE_OTHER ; + rc_type =RC_BIT_OTHER ;break ; }
@@ -1305,7 +1305,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) rel_x = buf[2 ]; rel_y = buf[3 ]; -if (ictx->rc_type ==RC_TYPE_OTHER && pad_stabilize) { +if (ictx->rc_type ==RC_BIT_OTHER && pad_stabilize) {if ((buf[1 ] ==0 ) && ((rel_x !=0 ) || (rel_y !=0 ))) { dir =stabilize ((int )rel_x, (int )rel_y, timeout, threshold);
@@ -1372,7 +1372,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) buf[0 ] =0x01 ; buf[1 ] = buf[4 ] = buf[5 ] = buf[6 ] = buf[7 ] =0 ; -if (ictx->rc_type ==RC_TYPE_OTHER && pad_stabilize) { +if (ictx->rc_type ==RC_BIT_OTHER && pad_stabilize) { dir =stabilize ((int )rel_x, (int )rel_y, timeout, threshold);if (!dir) {
@@ -1494,7 +1494,7 @@ static void imon_incoming_packet(struct imon_context *ictx, kc =imon_panel_key_lookup (scancode); }else { scancode =be32_to_cpu (*((u32 *)buf)); -if (ictx->rc_type ==RC_TYPE_RC6 ) { +if (ictx->rc_type ==RC_BIT_RC6 ) { ktype =IMON_KEY_IMON ;if (buf[0 ] ==0x80 ) ktype =IMON_KEY_MCE ;
@@ -1708,7 +1708,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) {u8 ffdc_cfg_byte = ictx->usb_rx_buf[6 ];u8 detected_display_type =IMON_DISPLAY_TYPE_NONE ; -u64 allowed_protos =RC_TYPE_OTHER ; +u64 allowed_protos =RC_BIT_OTHER ;switch (ffdc_cfg_byte) {/* iMON Knob, no display, iMON IR + vol knob */
@@ -1737,13 +1737,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx)case 0x9e :dev_info (ictx->dev,"0xffdc iMON VFD, MCE IR" ); detected_display_type =IMON_DISPLAY_TYPE_VFD ; - allowed_protos =RC_TYPE_RC6 ; + allowed_protos =RC_BIT_RC6 ;break ;/* iMON LCD, MCE IR */ case 0x9f :dev_info (ictx->dev,"0xffdc iMON LCD, MCE IR" ); detected_display_type =IMON_DISPLAY_TYPE_LCD ; - allowed_protos =RC_TYPE_RC6 ; + allowed_protos =RC_BIT_RC6 ;break ;default : dev_info(ictx->dev, "Unknown 0xffdc device, "
@@ -1834,7 +1834,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) rdev->priv = ictx; rdev->driver_type =RC_DRIVER_SCANCODE ; - rdev->allowed_protos =RC_TYPE_OTHER |RC_TYPE_RC6 ;/* iMON PAD or MCE */ + rdev->allowed_protos =RC_BIT_OTHER |RC_BIT_RC6 ;/* iMON PAD or MCE */ rdev->change_protocol = imon_ir_change_protocol; rdev->driver_name =MOD_NAME ;
@@ -1852,7 +1852,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)imon_set_display_type (ictx); -if (ictx->rc_type ==RC_TYPE_RC6 ) +if (ictx->rc_type ==RC_BIT_RC6 ) rdev->map_name =RC_MAP_IMON_MCE ;else rdev->map_name =RC_MAP_IMON_PAD ;
drivers/media/rc/ir-jvc-decoder.c +2 -2
@@ -46,7 +46,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev) {struct jvc_dec *data = &dev->raw->jvc; -if (!(dev->raw->enabled_protocols &RC_TYPE_JVC )) +if (!(dev->raw->enabled_protocols &RC_BIT_JVC ))return 0 ;if (!is_timing_event (ev)) {
@@ -173,7 +173,7 @@ out: }static struct ir_raw_handler jvc_handler = { - .protocols =RC_TYPE_JVC , + .protocols =RC_BIT_JVC , .decode = ir_jvc_decode, };
drivers/media/rc/ir-lirc-codec.c +2 -2
@@ -34,7 +34,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)struct lirc_codec *lirc = &dev->raw->lirc;int sample; -if (!(dev->raw->enabled_protocols &RC_TYPE_LIRC )) +if (!(dev->raw->enabled_protocols &RC_BIT_LIRC ))return 0 ;if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
@@ -378,7 +378,7 @@ static int ir_lirc_unregister(struct rc_dev *dev) }static struct ir_raw_handler lirc_handler = { - .protocols =RC_TYPE_LIRC , + .protocols =RC_BIT_LIRC , .decode = ir_lirc_decode, .raw_register = ir_lirc_register, .raw_unregister = ir_lirc_unregister,
drivers/media/rc/ir-nec-decoder.c +2 -2
@@ -51,7 +51,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)u8 address, not_address, command, not_command;bool send_32bits = false; -if (!(dev->raw->enabled_protocols &RC_TYPE_NEC )) +if (!(dev->raw->enabled_protocols &RC_BIT_NEC ))return 0 ;if (!is_timing_event (ev)) {
@@ -200,7 +200,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) }static struct ir_raw_handler nec_handler = { - .protocols =RC_TYPE_NEC , + .protocols =RC_BIT_NEC , .decode = ir_nec_decode, };
drivers/media/rc/ir-rc5-decoder.c +10 -2
@@ -51,7 +51,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)u8 toggle;u32 scancode; -if (!(dev->raw->enabled_protocols &RC_TYPE_RC5 )) +if (!(dev->raw->enabled_protocols & (RC_BIT_RC5 |RC_BIT_RC5X )))return 0 ;if (!is_timing_event (ev)) {
@@ -126,6 +126,10 @@ again:if (data->wanted_bits ==RC5X_NBITS ) {/* RC5X */ +if (!(dev->raw->enabled_protocols &RC_BIT_RC5X )) { + data->state =STATE_INACTIVE ; +return 0 ; + }u8 xdata, command, system; xdata = (data->bits &0x0003F ) >>0 ; command = (data->bits &0x00FC0 ) >>6 ;
@@ -139,6 +143,10 @@ again: }else {/* RC5 */ +if (!(dev->raw->enabled_protocols &RC_BIT_RC5 )) { + data->state =STATE_INACTIVE ; +return 0 ; + }u8 command, system; command = (data->bits &0x0003F ) >>0 ; system = (data->bits &0x007C0 ) >>6 ;
@@ -163,7 +171,7 @@ out: }static struct ir_raw_handler rc5_handler = { - .protocols =RC_TYPE_RC5 , + .protocols =RC_BIT_RC5 |RC_BIT_RC5X , .decode = ir_rc5_decode, };
drivers/media/rc/ir-rc5-sz-decoder.c +2 -2
@@ -47,7 +47,7 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev)u8 toggle, command, system;u32 scancode; -if (!(dev->raw->enabled_protocols &RC_TYPE_RC5_SZ )) +if (!(dev->raw->enabled_protocols &RC_BIT_RC5_SZ ))return 0 ;if (!is_timing_event (ev)) {
@@ -127,7 +127,7 @@ out: }static struct ir_raw_handler rc5_sz_handler = { - .protocols =RC_TYPE_RC5_SZ , + .protocols =RC_BIT_RC5_SZ , .decode = ir_rc5_sz_decode, };
drivers/media/rc/ir-rc6-decoder.c +2 -2
@@ -81,7 +81,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)u32 scancode;u8 toggle; -if (!(dev->raw->enabled_protocols &RC_TYPE_RC6 )) +if (!(dev->raw->enabled_protocols &RC_BIT_RC6 ))return 0 ;if (!is_timing_event (ev)) {
@@ -255,7 +255,7 @@ out: }static struct ir_raw_handler rc6_handler = { - .protocols =RC_TYPE_RC6 , + .protocols =RC_BIT_RC6 , .decode = ir_rc6_decode, };
drivers/media/rc/ir-sony-decoder.c +15 -2
@@ -44,7 +44,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)u32 scancode;u8 device, subdevice, function; -if (!(dev->raw->enabled_protocols &RC_TYPE_SONY )) +if (!(dev->raw->enabled_protocols & + (RC_BIT_SONY12 |RC_BIT_SONY15 |RC_BIT_SONY20 )))return 0 ;if (!is_timing_event (ev)) {
@@ -122,16 +123,28 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)switch (data->count) {case 12 : +if (!(dev->raw->enabled_protocols &RC_BIT_SONY12 )) { + data->state =STATE_INACTIVE ; +return 0 ; + } device =bitrev8 ((data->bits <<3 ) &0xF8 ); subdevice =0 ; function =bitrev8 ((data->bits >>4 ) &0xFE );break ;case 15 : +if (!(dev->raw->enabled_protocols &RC_BIT_SONY15 )) { + data->state =STATE_INACTIVE ; +return 0 ; + } device =bitrev8 ((data->bits >>0 ) &0xFF ); subdevice =0 ; function =bitrev8 ((data->bits >>7 ) &0xFD );break ;case 20 : +if (!(dev->raw->enabled_protocols &RC_BIT_SONY20 )) { + data->state =STATE_INACTIVE ; +return 0 ; + } device =bitrev8 ((data->bits >>5 ) &0xF8 ); subdevice =bitrev8 ((data->bits >>0 ) &0xFF ); function =bitrev8 ((data->bits >>12 ) &0xFE );
@@ -156,7 +169,7 @@ out: }static struct ir_raw_handler sony_handler = { - .protocols =RC_TYPE_SONY , + .protocols =RC_BIT_SONY12 |RC_BIT_SONY15 |RC_BIT_SONY20 , .decode = ir_sony_decode, };
drivers/media/rc/ite-cir.c +1 -1
@@ -1578,7 +1578,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id/* set up ir-core props */ rdev->priv = itdev; rdev->driver_type =RC_DRIVER_IR_RAW ; - rdev->allowed_protos =RC_TYPE_ALL ; + rdev->allowed_protos =RC_BIT_ALL ; rdev->open = ite_open; rdev->close = ite_close; rdev->s_idle = ite_s_idle;
drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c +1 -1
@@ -67,7 +67,7 @@ static struct rc_map_list adstech_dvb_t_pci_map = { .map = { .scan = adstech_dvb_t_pci, .size = ARRAY_SIZE(adstech_dvb_t_pci), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ADSTECH_DVB_T_PCI, } };
drivers/media/rc/keymaps/rc-alink-dtu-m.c +1 -1
@@ -46,7 +46,7 @@ static struct rc_map_list alink_dtu_m_map = { .map = { .scan = alink_dtu_m, .size = ARRAY_SIZE(alink_dtu_m), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_ALINK_DTU_M, } };
drivers/media/rc/keymaps/rc-anysee.c +1 -1
@@ -71,7 +71,7 @@ static struct rc_map_list anysee_map = { .map = { .scan = anysee, .size = ARRAY_SIZE(anysee), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_ANYSEE, } };
drivers/media/rc/keymaps/rc-apac-viewcomp.c +1 -1
@@ -58,7 +58,7 @@ static struct rc_map_list apac_viewcomp_map = { .map = { .scan = apac_viewcomp, .size = ARRAY_SIZE(apac_viewcomp), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_APAC_VIEWCOMP, } };
drivers/media/rc/keymaps/rc-asus-pc39.c +1 -1
@@ -69,7 +69,7 @@ static struct rc_map_list asus_pc39_map = { .map = { .scan = asus_pc39, .size = ARRAY_SIZE(asus_pc39), - .rc_type = RC_TYPE_RC5, + .rc_type = RC_BIT_RC5, .name = RC_MAP_ASUS_PC39, } };
drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c +1 -1
@@ -47,7 +47,7 @@ static struct rc_map_list ati_tv_wonder_hd_600_map = { .map = { .scan = ati_tv_wonder_hd_600, .size = ARRAY_SIZE(ati_tv_wonder_hd_600), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ATI_TV_WONDER_HD_600, } };
drivers/media/rc/keymaps/rc-avermedia-a16d.c +1 -1
@@ -53,7 +53,7 @@ static struct rc_map_list avermedia_a16d_map = { .map = { .scan = avermedia_a16d, .size = ARRAY_SIZE(avermedia_a16d), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_A16D, } };
drivers/media/rc/keymaps/rc-avermedia-cardbus.c +1 -1
@@ -75,7 +75,7 @@ static struct rc_map_list avermedia_cardbus_map = { .map = { .scan = avermedia_cardbus, .size = ARRAY_SIZE(avermedia_cardbus), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_CARDBUS, } };
drivers/media/rc/keymaps/rc-avermedia-dvbt.c +1 -1
@@ -56,7 +56,7 @@ static struct rc_map_list avermedia_dvbt_map = { .map = { .scan = avermedia_dvbt, .size = ARRAY_SIZE(avermedia_dvbt), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_DVBT, } };
drivers/media/rc/keymaps/rc-avermedia-m135a.c +1 -1
@@ -125,7 +125,7 @@ static struct rc_map_list avermedia_m135a_map = { .map = { .scan = avermedia_m135a, .size = ARRAY_SIZE(avermedia_m135a), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_AVERMEDIA_M135A, } };
drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c +1 -1
@@ -73,7 +73,7 @@ static struct rc_map_list avermedia_m733a_rm_k6_map = { .map = { .scan = avermedia_m733a_rm_k6, .size = ARRAY_SIZE(avermedia_m733a_rm_k6), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_AVERMEDIA_M733A_RM_K6, } };
drivers/media/rc/keymaps/rc-avermedia-rm-ks.c +1 -1
@@ -57,7 +57,7 @@ static struct rc_map_list avermedia_rm_ks_map = { .map = { .scan = avermedia_rm_ks, .size = ARRAY_SIZE(avermedia_rm_ks), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_AVERMEDIA_RM_KS, } };
drivers/media/rc/keymaps/rc-avermedia.c +1 -1
@@ -64,7 +64,7 @@ static struct rc_map_list avermedia_map = { .map = { .scan = avermedia, .size = ARRAY_SIZE(avermedia), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA, } };
drivers/media/rc/keymaps/rc-avertv-303.c +1 -1
@@ -63,7 +63,7 @@ static struct rc_map_list avertv_303_map = { .map = { .scan = avertv_303, .size = ARRAY_SIZE(avertv_303), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERTV_303, } };
drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c +1 -1
@@ -80,7 +80,7 @@ static struct rc_map_list azurewave_ad_tu700_map = { .map = { .scan = azurewave_ad_tu700, .size = ARRAY_SIZE(azurewave_ad_tu700), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_AZUREWAVE_AD_TU700, } };
drivers/media/rc/keymaps/rc-behold-columbus.c +1 -1
@@ -86,7 +86,7 @@ static struct rc_map_list behold_columbus_map = { .map = { .scan = behold_columbus, .size = ARRAY_SIZE(behold_columbus), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_BEHOLD_COLUMBUS, } };
drivers/media/rc/keymaps/rc-behold.c +1 -1
@@ -119,7 +119,7 @@ static struct rc_map_list behold_map = { .map = { .scan = behold, .size = ARRAY_SIZE(behold), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_BEHOLD, } };
drivers/media/rc/keymaps/rc-budget-ci-old.c +1 -1
@@ -71,7 +71,7 @@ static struct rc_map_list budget_ci_old_map = { .map = { .scan = budget_ci_old, .size = ARRAY_SIZE(budget_ci_old), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_BUDGET_CI_OLD, } };
drivers/media/rc/keymaps/rc-cinergy-1400.c +1 -1
@@ -62,7 +62,7 @@ static struct rc_map_list cinergy_1400_map = { .map = { .scan = cinergy_1400, .size = ARRAY_SIZE(cinergy_1400), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_CINERGY_1400, } };
drivers/media/rc/keymaps/rc-cinergy.c +1 -1
@@ -56,7 +56,7 @@ static struct rc_map_list cinergy_map = { .map = { .scan = cinergy, .size = ARRAY_SIZE(cinergy), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_CINERGY, } };
drivers/media/rc/keymaps/rc-dib0700-nec.c +1 -1
@@ -102,7 +102,7 @@ static struct rc_map_list dib0700_nec_map = { .map = { .scan = dib0700_nec_table, .size = ARRAY_SIZE(dib0700_nec_table), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_DIB0700_NEC_TABLE, } };
drivers/media/rc/keymaps/rc-dib0700-rc5.c +1 -1
@@ -213,7 +213,7 @@ static struct rc_map_list dib0700_rc5_map = { .map = { .scan = dib0700_rc5_table, .size = ARRAY_SIZE(dib0700_rc5_table), - .rc_type = RC_TYPE_RC5, + .rc_type = RC_BIT_RC5, .name = RC_MAP_DIB0700_RC5_TABLE, } };
drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c +1 -1
@@ -76,7 +76,7 @@ static struct rc_map_list digitalnow_tinytwin_map = { .map = { .scan = digitalnow_tinytwin, .size = ARRAY_SIZE(digitalnow_tinytwin), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_DIGITALNOW_TINYTWIN, } };
drivers/media/rc/keymaps/rc-digittrade.c +1 -1
@@ -60,7 +60,7 @@ static struct rc_map_list digittrade_map = { .map = { .scan = digittrade, .size = ARRAY_SIZE(digittrade), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_DIGITTRADE, } };
drivers/media/rc/keymaps/rc-dm1105-nec.c +1 -1
@@ -54,7 +54,7 @@ static struct rc_map_list dm1105_nec_map = { .map = { .scan = dm1105_nec, .size = ARRAY_SIZE(dm1105_nec), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DM1105_NEC, } };
drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c +1 -1
@@ -56,7 +56,7 @@ static struct rc_map_list dntv_live_dvb_t_map = { .map = { .scan = dntv_live_dvb_t, .size = ARRAY_SIZE(dntv_live_dvb_t), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DNTV_LIVE_DVB_T, } };
drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c +1 -1
@@ -75,7 +75,7 @@ static struct rc_map_list dntv_live_dvbt_pro_map = { .map = { .scan = dntv_live_dvbt_pro, .size = ARRAY_SIZE(dntv_live_dvbt_pro), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DNTV_LIVE_DVBT_PRO, } };
drivers/media/rc/keymaps/rc-em-terratec.c +1 -1
@@ -47,7 +47,7 @@ static struct rc_map_list em_terratec_map = { .map = { .scan = em_terratec, .size = ARRAY_SIZE(em_terratec), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EM_TERRATEC, } };
drivers/media/rc/keymaps/rc-encore-enltv-fm53.c +1 -1
@@ -59,7 +59,7 @@ static struct rc_map_list encore_enltv_fm53_map = { .map = { .scan = encore_enltv_fm53, .size = ARRAY_SIZE(encore_enltv_fm53), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV_FM53, } };
drivers/media/rc/keymaps/rc-encore-enltv.c +1 -1
@@ -90,7 +90,7 @@ static struct rc_map_list encore_enltv_map = { .map = { .scan = encore_enltv, .size = ARRAY_SIZE(encore_enltv), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV, } };
drivers/media/rc/keymaps/rc-encore-enltv2.c +1 -1
@@ -68,7 +68,7 @@ static struct rc_map_list encore_enltv2_map = { .map = { .scan = encore_enltv2, .size = ARRAY_SIZE(encore_enltv2), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV2, } };
drivers/media/rc/keymaps/rc-evga-indtube.c +1 -1
@@ -39,7 +39,7 @@ static struct rc_map_list evga_indtube_map = { .map = { .scan = evga_indtube, .size = ARRAY_SIZE(evga_indtube), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EVGA_INDTUBE, } };
drivers/media/rc/keymaps/rc-eztv.c +1 -1
@@ -74,7 +74,7 @@ static struct rc_map_list eztv_map = { .map = { .scan = eztv, .size = ARRAY_SIZE(eztv), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EZTV, } };
drivers/media/rc/keymaps/rc-flydvb.c +1 -1
@@ -55,7 +55,7 @@ static struct rc_map_list flydvb_map = { .map = { .scan = flydvb, .size = ARRAY_SIZE(flydvb), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FLYDVB, } };
drivers/media/rc/keymaps/rc-flyvideo.c +1 -1
@@ -48,7 +48,7 @@ static struct rc_map_list flyvideo_map = { .map = { .scan = flyvideo, .size = ARRAY_SIZE(flyvideo), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FLYVIDEO, } };
drivers/media/rc/keymaps/rc-fusionhdtv-mce.c +1 -1
@@ -76,7 +76,7 @@ static struct rc_map_list fusionhdtv_mce_map = { .map = { .scan = fusionhdtv_mce, .size = ARRAY_SIZE(fusionhdtv_mce), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FUSIONHDTV_MCE, } };
drivers/media/rc/keymaps/rc-gadmei-rm008z.c +1 -1
@@ -59,7 +59,7 @@ static struct rc_map_list gadmei_rm008z_map = { .map = { .scan = gadmei_rm008z, .size = ARRAY_SIZE(gadmei_rm008z), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GADMEI_RM008Z, } };
drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c +1 -1
@@ -62,7 +62,7 @@ static struct rc_map_list genius_tvgo_a11mce_map = { .map = { .scan = genius_tvgo_a11mce, .size = ARRAY_SIZE(genius_tvgo_a11mce), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GENIUS_TVGO_A11MCE, } };
drivers/media/rc/keymaps/rc-gotview7135.c +1 -1
@@ -57,7 +57,7 @@ static struct rc_map_list gotview7135_map = { .map = { .scan = gotview7135, .size = ARRAY_SIZE(gotview7135), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GOTVIEW7135, } };
drivers/media/rc/keymaps/rc-hauppauge.c +1 -1
@@ -219,7 +219,7 @@ static struct rc_map_list rc5_hauppauge_new_map = { .map = { .scan = rc5_hauppauge_new, .size = ARRAY_SIZE(rc5_hauppauge_new), - .rc_type = RC_TYPE_RC5, + .rc_type = RC_BIT_RC5, .name = RC_MAP_HAUPPAUGE, } };
drivers/media/rc/keymaps/rc-imon-mce.c +1 -1
@@ -120,7 +120,7 @@ static struct rc_map_list imon_mce_map = { .scan = imon_mce, .size = ARRAY_SIZE(imon_mce), /* its RC6, but w/a hardware decoder */ - .rc_type = RC_TYPE_RC6, + .rc_type = RC_BIT_RC6, .name = RC_MAP_IMON_MCE, } };
drivers/media/rc/keymaps/rc-imon-pad.c +1 -1
@@ -134,7 +134,7 @@ static struct rc_map_list imon_pad_map = { .scan = imon_pad, .size = ARRAY_SIZE(imon_pad), /* actual protocol details unknown, hardware decoder */ - .rc_type = RC_TYPE_OTHER, + .rc_type = RC_BIT_OTHER, .name = RC_MAP_IMON_PAD, } };
drivers/media/rc/keymaps/rc-iodata-bctv7e.c +1 -1
@@ -66,7 +66,7 @@ static struct rc_map_list iodata_bctv7e_map = { .map = { .scan = iodata_bctv7e, .size = ARRAY_SIZE(iodata_bctv7e), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_IODATA_BCTV7E, } };
drivers/media/rc/keymaps/rc-kaiomy.c +1 -1
@@ -65,7 +65,7 @@ static struct rc_map_list kaiomy_map = { .map = { .scan = kaiomy, .size = ARRAY_SIZE(kaiomy), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_KAIOMY, } };
drivers/media/rc/keymaps/rc-kworld-315u.c +1 -1
@@ -61,7 +61,7 @@ static struct rc_map_list kworld_315u_map = { .map = { .scan = kworld_315u, .size = ARRAY_SIZE(kworld_315u), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_KWORLD_315U, } };
drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c +1 -1
@@ -77,7 +77,7 @@ static struct rc_map_list kworld_plus_tv_analog_map = { .map = { .scan = kworld_plus_tv_analog, .size = ARRAY_SIZE(kworld_plus_tv_analog), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_KWORLD_PLUS_TV_ANALOG, } };
drivers/media/rc/keymaps/rc-leadtek-y04g0051.c +1 -1
@@ -77,7 +77,7 @@ static struct rc_map_list leadtek_y04g0051_map = { .map = { .scan = leadtek_y04g0051, .size = ARRAY_SIZE(leadtek_y04g0051), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_LEADTEK_Y04G0051, } };
drivers/media/rc/keymaps/rc-lirc.c +1 -1
@@ -19,7 +19,7 @@ static struct rc_map_list lirc_map = { .map = { .scan = lirc, .size = ARRAY_SIZE(lirc), - .rc_type = RC_TYPE_LIRC, + .rc_type = RC_BIT_LIRC, .name = RC_MAP_LIRC, } };
drivers/media/rc/keymaps/rc-lme2510.c +1 -1
@@ -88,7 +88,7 @@ static struct rc_map_list lme2510_map = { .map = { .scan = lme2510_rc, .size = ARRAY_SIZE(lme2510_rc), - .rc_type = RC_TYPE_UNKNOWN, + .rc_type = RC_BIT_UNKNOWN, .name = RC_MAP_LME2510, } };
drivers/media/rc/keymaps/rc-manli.c +1 -1
@@ -112,7 +112,7 @@ static struct rc_map_list manli_map = { .map = { .scan = manli, .size = ARRAY_SIZE(manli), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MANLI, } };
drivers/media/rc/keymaps/rc-msi-digivox-ii.c +1 -1
@@ -45,7 +45,7 @@ static struct rc_map_list msi_digivox_ii_map = { .map = { .scan = msi_digivox_ii, .size = ARRAY_SIZE(msi_digivox_ii), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_MSI_DIGIVOX_II, } };
drivers/media/rc/keymaps/rc-msi-digivox-iii.c +1 -1
@@ -63,7 +63,7 @@ static struct rc_map_list msi_digivox_iii_map = { .map = { .scan = msi_digivox_iii, .size = ARRAY_SIZE(msi_digivox_iii), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_MSI_DIGIVOX_III, } };
drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c +1 -1
@@ -101,7 +101,7 @@ static struct rc_map_list msi_tvanywhere_plus_map = { .map = { .scan = msi_tvanywhere_plus, .size = ARRAY_SIZE(msi_tvanywhere_plus), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MSI_TVANYWHERE_PLUS, } };
drivers/media/rc/keymaps/rc-msi-tvanywhere.c +1 -1
@@ -47,7 +47,7 @@ static struct rc_map_list msi_tvanywhere_map = { .map = { .scan = msi_tvanywhere, .size = ARRAY_SIZE(msi_tvanywhere), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MSI_TVANYWHERE, } };
drivers/media/rc/keymaps/rc-nebula.c +1 -1
@@ -74,7 +74,7 @@ static struct rc_map_list nebula_map = { .map = { .scan = nebula, .size = ARRAY_SIZE(nebula), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NEBULA, } };
drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c +1 -1
@@ -83,7 +83,7 @@ static struct rc_map_list nec_terratec_cinergy_xs_map = { .map = { .scan = nec_terratec_cinergy_xs, .size = ARRAY_SIZE(nec_terratec_cinergy_xs), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_NEC_TERRATEC_CINERGY_XS, } };
drivers/media/rc/keymaps/rc-norwood.c +1 -1
@@ -63,7 +63,7 @@ static struct rc_map_list norwood_map = { .map = { .scan = norwood, .size = ARRAY_SIZE(norwood), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NORWOOD, } };
drivers/media/rc/keymaps/rc-npgtech.c +1 -1
@@ -58,7 +58,7 @@ static struct rc_map_list npgtech_map = { .map = { .scan = npgtech, .size = ARRAY_SIZE(npgtech), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NPGTECH, } };
drivers/media/rc/keymaps/rc-pctv-sedna.c +1 -1
@@ -58,7 +58,7 @@ static struct rc_map_list pctv_sedna_map = { .map = { .scan = pctv_sedna, .size = ARRAY_SIZE(pctv_sedna), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PCTV_SEDNA, } };
drivers/media/rc/keymaps/rc-pinnacle-color.c +1 -1
@@ -72,7 +72,7 @@ static struct rc_map_list pinnacle_color_map = { .map = { .scan = pinnacle_color, .size = ARRAY_SIZE(pinnacle_color), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_COLOR, } };
drivers/media/rc/keymaps/rc-pinnacle-grey.c +1 -1
@@ -67,7 +67,7 @@ static struct rc_map_list pinnacle_grey_map = { .map = { .scan = pinnacle_grey, .size = ARRAY_SIZE(pinnacle_grey), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_GREY, } };
drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c +1 -1
@@ -51,7 +51,7 @@ static struct rc_map_list pinnacle_pctv_hd_map = { .map = { .scan = pinnacle_pctv_hd, .size = ARRAY_SIZE(pinnacle_pctv_hd), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_PCTV_HD, } };
drivers/media/rc/keymaps/rc-pixelview-002t.c +1 -1
@@ -55,7 +55,7 @@ static struct rc_map_list pixelview_map = { .map = { .scan = pixelview_002t, .size = ARRAY_SIZE(pixelview_002t), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_PIXELVIEW_002T, } };
drivers/media/rc/keymaps/rc-pixelview-mk12.c +1 -1
@@ -61,7 +61,7 @@ static struct rc_map_list pixelview_map = { .map = { .scan = pixelview_mk12, .size = ARRAY_SIZE(pixelview_mk12), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_PIXELVIEW_MK12, } };
drivers/media/rc/keymaps/rc-pixelview-new.c +1 -1
@@ -61,7 +61,7 @@ static struct rc_map_list pixelview_new_map = { .map = { .scan = pixelview_new, .size = ARRAY_SIZE(pixelview_new), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PIXELVIEW_NEW, } };
drivers/media/rc/keymaps/rc-pixelview.c +1 -1
@@ -60,7 +60,7 @@ static struct rc_map_list pixelview_map = { .map = { .scan = pixelview, .size = ARRAY_SIZE(pixelview), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PIXELVIEW, } };
drivers/media/rc/keymaps/rc-powercolor-real-angel.c +1 -1
@@ -59,7 +59,7 @@ static struct rc_map_list powercolor_real_angel_map = { .map = { .scan = powercolor_real_angel, .size = ARRAY_SIZE(powercolor_real_angel), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_POWERCOLOR_REAL_ANGEL, } };
drivers/media/rc/keymaps/rc-proteus-2309.c +1 -1
@@ -47,7 +47,7 @@ static struct rc_map_list proteus_2309_map = { .map = { .scan = proteus_2309, .size = ARRAY_SIZE(proteus_2309), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PROTEUS_2309, } };
drivers/media/rc/keymaps/rc-purpletv.c +1 -1
@@ -59,7 +59,7 @@ static struct rc_map_list purpletv_map = { .map = { .scan = purpletv, .size = ARRAY_SIZE(purpletv), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PURPLETV, } };
drivers/media/rc/keymaps/rc-pv951.c +1 -1
@@ -56,7 +56,7 @@ static struct rc_map_list pv951_map = { .map = { .scan = pv951, .size = ARRAY_SIZE(pv951), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PV951, } };
drivers/media/rc/keymaps/rc-rc6-mce.c +1 -1
@@ -97,7 +97,7 @@ static struct rc_map_list rc6_mce_map = { .map = { .scan = rc6_mce, .size = ARRAY_SIZE(rc6_mce), - .rc_type = RC_TYPE_RC6, + .rc_type = RC_BIT_RC6, .name = RC_MAP_RC6_MCE, } };
drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c +1 -1
@@ -56,7 +56,7 @@ static struct rc_map_list real_audio_220_32_keys_map = { .map = { .scan = real_audio_220_32_keys, .size = ARRAY_SIZE(real_audio_220_32_keys), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_REAL_AUDIO_220_32_KEYS, } };
drivers/media/rc/keymaps/rc-streamzap.c +1 -1
@@ -60,7 +60,7 @@ static struct rc_map_list streamzap_map = { .map = { .scan = streamzap, .size = ARRAY_SIZE(streamzap), - .rc_type = RC_TYPE_RC5_SZ, + .rc_type = RC_BIT_RC5_SZ, .name = RC_MAP_STREAMZAP, } };
drivers/media/rc/keymaps/rc-tbs-nec.c +1 -1
@@ -53,7 +53,7 @@ static struct rc_map_list tbs_nec_map = { .map = { .scan = tbs_nec, .size = ARRAY_SIZE(tbs_nec), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TBS_NEC, } };
drivers/media/rc/keymaps/rc-technisat-usb2.c +1 -1
@@ -71,7 +71,7 @@ static struct rc_map_list technisat_usb2_map = { .map = { .scan = technisat_usb2, .size = ARRAY_SIZE(technisat_usb2), - .rc_type = RC_TYPE_RC5, + .rc_type = RC_BIT_RC5, .name = RC_MAP_TECHNISAT_USB2, } };
drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c +1 -1
@@ -70,7 +70,7 @@ static struct rc_map_list terratec_cinergy_xs_map = { .map = { .scan = terratec_cinergy_xs, .size = ARRAY_SIZE(terratec_cinergy_xs), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TERRATEC_CINERGY_XS, } };
drivers/media/rc/keymaps/rc-terratec-slim-2.c +1 -1
@@ -50,7 +50,7 @@ static struct rc_map_list terratec_slim_2_map = { .map = { .scan = terratec_slim_2, .size = ARRAY_SIZE(terratec_slim_2), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_TERRATEC_SLIM_2, } };
drivers/media/rc/keymaps/rc-terratec-slim.c +1 -1
@@ -57,7 +57,7 @@ static struct rc_map_list terratec_slim_map = { .map = { .scan = terratec_slim, .size = ARRAY_SIZE(terratec_slim), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_TERRATEC_SLIM, } };
drivers/media/rc/keymaps/rc-tevii-nec.c +1 -1
@@ -66,7 +66,7 @@ static struct rc_map_list tevii_nec_map = { .map = { .scan = tevii_nec, .size = ARRAY_SIZE(tevii_nec), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TEVII_NEC, } };
drivers/media/rc/keymaps/rc-total-media-in-hand.c +1 -1
@@ -63,7 +63,7 @@ static struct rc_map_list total_media_in_hand_map = { .map = { .scan = total_media_in_hand, .size = ARRAY_SIZE(total_media_in_hand), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_TOTAL_MEDIA_IN_HAND, } };
drivers/media/rc/keymaps/rc-trekstor.c +1 -1
@@ -58,7 +58,7 @@ static struct rc_map_list trekstor_map = { .map = { .scan = trekstor, .size = ARRAY_SIZE(trekstor), - .rc_type = RC_TYPE_NEC, + .rc_type = RC_BIT_NEC, .name = RC_MAP_TREKSTOR, } };
drivers/media/rc/keymaps/rc-tt-1500.c +1 -1
@@ -60,7 +60,7 @@ static struct rc_map_list tt_1500_map = { .map = { .scan = tt_1500, .size = ARRAY_SIZE(tt_1500), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TT_1500, } };
drivers/media/rc/keymaps/rc-twinhan1027.c +1 -1
@@ -65,7 +65,7 @@ static struct rc_map_list twinhan_vp1027_map = { .map = { .scan = twinhan_vp1027, .size = ARRAY_SIZE(twinhan_vp1027), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TWINHAN_VP1027_DVBS, } };
drivers/media/rc/keymaps/rc-videomate-m1f.c +1 -1
@@ -70,7 +70,7 @@ static struct rc_map_list videomate_m1f_map = { .map = { .scan = videomate_m1f, .size = ARRAY_SIZE(videomate_m1f), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_VIDEOMATE_M1F, } };
drivers/media/rc/keymaps/rc-videomate-s350.c +1 -1
@@ -63,7 +63,7 @@ static struct rc_map_list videomate_s350_map = { .map = { .scan = videomate_s350, .size = ARRAY_SIZE(videomate_s350), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_VIDEOMATE_S350, } };
drivers/media/rc/keymaps/rc-videomate-tv-pvr.c +1 -1
@@ -65,7 +65,7 @@ static struct rc_map_list videomate_tv_pvr_map = { .map = { .scan = videomate_tv_pvr, .size = ARRAY_SIZE(videomate_tv_pvr), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_VIDEOMATE_TV_PVR, } };
drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c +1 -1
@@ -60,7 +60,7 @@ static struct rc_map_list winfast_usbii_deluxe_map = { .map = { .scan = winfast_usbii_deluxe, .size = ARRAY_SIZE(winfast_usbii_deluxe), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_WINFAST_USBII_DELUXE, } };
drivers/media/rc/keymaps/rc-winfast.c +1 -1
@@ -80,7 +80,7 @@ static struct rc_map_list winfast_map = { .map = { .scan = winfast, .size = ARRAY_SIZE(winfast), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_WINFAST, } };
drivers/media/rc/mceusb.c +1 -1
@@ -1067,7 +1067,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) rc->dev.parent = dev; rc->priv = ir; rc->driver_type =RC_DRIVER_IR_RAW ; - rc->allowed_protos =RC_TYPE_ALL ; + rc->allowed_protos =RC_BIT_ALL ; rc->timeout =US_TO_NS (1000 );if (!ir->flags.no_tx) { rc->s_tx_mask = mceusb_set_tx_mask;
drivers/media/rc/nuvoton-cir.c +1 -1
@@ -1064,7 +1064,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)/* Set up the rc device */ rdev->priv = nvt; rdev->driver_type =RC_DRIVER_IR_RAW ; - rdev->allowed_protos =RC_TYPE_ALL ; + rdev->allowed_protos =RC_BIT_ALL ; rdev->open = nvt_open; rdev->close = nvt_close; rdev->tx_ir = nvt_tx_ir;
drivers/media/rc/rc-loopback.c +1 -1
@@ -214,7 +214,7 @@ static int __init loop_init(void) rc->map_name =RC_MAP_EMPTY ; rc->priv = &loopdev; rc->driver_type =RC_DRIVER_IR_RAW ; - rc->allowed_protos =RC_TYPE_ALL ; + rc->allowed_protos =RC_BIT_ALL ; rc->timeout =100 *1000 *1000 ;/* 100 ms */ rc->min_timeout =1 ; rc->max_timeout =UINT_MAX ;
drivers/media/rc/rc-main.c +12 -9
@@ -102,7 +102,7 @@ static struct rc_map_list empty_map = { .map = { .scan = empty, .size = ARRAY_SIZE(empty), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EMPTY, } };
@@ -725,14 +725,17 @@ static struct {u64 type;char *name; } proto_names[] = { - { RC_TYPE_UNKNOWN, "unknown" }, - { RC_TYPE_RC5, "rc-5" }, - { RC_TYPE_NEC, "nec" }, - { RC_TYPE_RC6, "rc-6" }, - { RC_TYPE_JVC, "jvc" }, - { RC_TYPE_SONY, "sony" }, - { RC_TYPE_RC5_SZ, "rc-5-sz" }, - { RC_TYPE_LIRC, "lirc" }, + { RC_BIT_OTHER, "other" }, + { RC_BIT_RC5, "rc-5" }, + { RC_BIT_RC5X, "rc-5-x" }, + { RC_BIT_RC5_SZ, "rc-5-sz" }, + { RC_BIT_RC6, "rc-6" }, + { RC_BIT_JVC, "jvc" }, + { RC_BIT_SONY12, "sony12" }, + { RC_BIT_SONY15, "sony15" }, + { RC_BIT_SONY20, "sony20" }, + { RC_BIT_NEC, "nec" }, + { RC_BIT_LIRC, "lirc" }, }; #define PROTO_NONE "none"
drivers/media/rc/streamzap.c +1 -1
@@ -322,7 +322,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) rdev->dev.parent = dev; rdev->priv = sz; rdev->driver_type =RC_DRIVER_IR_RAW ; - rdev->allowed_protos =RC_TYPE_ALL ; + rdev->allowed_protos =RC_BIT_ALL ; rdev->driver_name =DRIVER_NAME ; rdev->map_name =RC_MAP_STREAMZAP ;
drivers/media/video/cx18/cx18-i2c.c +1 -1
@@ -98,7 +98,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,case CX18_HW_Z8F0811_IR_RX_HAUP : init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP_XVR ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name = cx->card_name; info.platform_data = init_data;break ;
drivers/media/video/cx231xx/cx231xx-input.c +1 -1
@@ -95,7 +95,7 @@ int cx231xx_ir_init(struct cx231xx *dev)/* The i2c micro-controller only outputs the cmd part of NEC protocol */ dev->init_data.rc_dev->scanmask =0xff ; dev->init_data.rc_dev->driver_name ="cx231xx" ; - dev->init_data.type =RC_TYPE_NEC ; + dev->init_data.type =RC_BIT_NEC ; info.addr =0x30 ;/* Load and bind ir-kbd-i2c */
drivers/media/video/cx23885/cx23885-input.c +2 -2
@@ -262,14 +262,14 @@ int cx23885_input_init(struct cx23885_dev *dev)case CX23885_BOARD_HAUPPAUGE_HVR1250 :/* Integrated CX2388[58] IR controller */ driver_type =RC_DRIVER_IR_RAW ; - allowed_protos =RC_TYPE_ALL ; + allowed_protos =RC_BIT_ALL ;/* The grey Hauppauge RC-5 remote */ rc_map =RC_MAP_HAUPPAUGE ;break ;case CX23885_BOARD_TEVII_S470 :/* Integrated CX23885 IR controller */ driver_type =RC_DRIVER_IR_RAW ; - allowed_protos =RC_TYPE_ALL ; + allowed_protos =RC_BIT_ALL ;/* A guess at the remote */ rc_map =RC_MAP_TEVII_NEC ;break ;
drivers/media/video/cx88/cx88-input.c +4 -4
@@ -244,7 +244,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)struct cx88_IR *ir;struct rc_dev *dev;char *ir_codes =NULL ; -u64 rc_type =RC_TYPE_OTHER ; +u64 rc_type =RC_BIT_OTHER ;int err = -ENOMEM ;u32 hardware_mask =0 ;/* For devices with a hardware mask, when * used with a full-code IR table
@@ -408,7 +408,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)break ;case CX88_BOARD_TWINHAN_VP1027_DVBS : ir_codes =RC_MAP_TWINHAN_VP1027_DVBS ; - rc_type =RC_TYPE_NEC ; + rc_type =RC_BIT_NEC ; ir->sampling =0xff00 ;/* address */ break ; }
@@ -584,7 +584,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)case CX88_BOARD_LEADTEK_PVR2000 : addr_list = pvr2000_addr_list; core->init_data.name ="cx88 Leadtek PVR 2000 remote" ; - core->init_data.type =RC_TYPE_UNKNOWN ; + core->init_data.type =RC_BIT_UNKNOWN ; core->init_data.get_key = get_key_pvr2000; core->init_data.ir_codes =RC_MAP_EMPTY ;break ;
@@ -605,7 +605,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)/* Hauppauge XVR */ core->init_data.name ="cx88 Hauppauge XVR remote" ; core->init_data.ir_codes =RC_MAP_HAUPPAUGE ; - core->init_data.type =RC_TYPE_RC5 ; + core->init_data.type =RC_BIT_RC5 ; core->init_data.internal_get_key_func =IR_KBD_GET_KEY_HAUP_XVR ; info.platform_data = &core->init_data;
drivers/media/video/em28xx/em28xx-input.c +5 -5
@@ -352,14 +352,14 @@ int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type)/* Adjust xclk based o IR table for RC5/NEC tables */ -if (rc_type ==RC_TYPE_RC5 ) { +if (rc_type ==RC_BIT_RC5 ) { dev->board.xclk |=EM28XX_XCLK_IR_RC5_MODE ; ir->full_code =1 ; - }else if (rc_type ==RC_TYPE_NEC ) { + }else if (rc_type ==RC_BIT_NEC ) { dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE ; ir_config =EM2874_IR_NEC ; ir->full_code =1 ; - }else if (rc_type !=RC_TYPE_UNKNOWN ) + }else if (rc_type !=RC_BIT_UNKNOWN ) rc = -EINVAL ; em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk,
@@ -408,14 +408,14 @@ int em28xx_ir_init(struct em28xx *dev)* em2874 supports more protocols. For now, let's just announce * the two protocols that were already tested */ - rc->allowed_protos =RC_TYPE_RC5 |RC_TYPE_NEC ; + rc->allowed_protos =RC_BIT_RC5 |RC_BIT_NEC ; rc->priv = ir; rc->change_protocol = em28xx_ir_change_protocol; rc->open = em28xx_ir_start; rc->close = em28xx_ir_stop;/* By default, keep protocol field untouched */ - err =em28xx_ir_change_protocol (rc,RC_TYPE_UNKNOWN ); + err =em28xx_ir_change_protocol (rc,RC_BIT_UNKNOWN );if (err) goto err_out_free;
drivers/media/video/hdpvr/hdpvr-i2c.c +1 -1
@@ -54,7 +54,7 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev)/* Our default information for ir-kbd-i2c.c to use */ init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP_XVR ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name ="HD-PVR" ; init_data->polling_interval =405 ;/* ms, duplicated from Windows */ hdpvr_ir_rx_i2c_board_info.platform_data = init_data;
drivers/media/video/ir-kbd-i2c.c +7 -7
@@ -276,7 +276,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) {char *ir_codes =NULL ;const char *name =NULL ; -u64 rc_type =RC_TYPE_UNKNOWN ; +u64 rc_type =RC_BIT_UNKNOWN ;struct IR_i2c *ir;struct rc_dev *rc =NULL ;struct i2c_adapter *adap = client->adapter;
@@ -295,7 +295,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)case 0x64 : name ="Pixelview" ; ir->get_key = get_key_pixelview; - rc_type =RC_TYPE_OTHER ; + rc_type =RC_BIT_OTHER ; ir_codes =RC_MAP_EMPTY ;break ;case 0x18 :
@@ -303,31 +303,31 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)case 0x1a : name ="Hauppauge" ; ir->get_key = get_key_haup; - rc_type =RC_TYPE_RC5 ; + rc_type =RC_BIT_RC5 ; ir_codes =RC_MAP_HAUPPAUGE ;break ;case 0x30 : name ="KNC One" ; ir->get_key = get_key_knc1; - rc_type =RC_TYPE_OTHER ; + rc_type =RC_BIT_OTHER ; ir_codes =RC_MAP_EMPTY ;break ;case 0x6b : name ="FusionHDTV" ; ir->get_key = get_key_fusionhdtv; - rc_type =RC_TYPE_RC5 ; + rc_type =RC_BIT_RC5 ; ir_codes =RC_MAP_FUSIONHDTV_MCE ;break ;case 0x40 : name ="AVerMedia Cardbus remote" ; ir->get_key = get_key_avermedia_cardbus; - rc_type =RC_TYPE_OTHER ; + rc_type =RC_BIT_OTHER ; ir_codes =RC_MAP_AVERMEDIA_CARDBUS ;break ;case 0x71 : name ="Hauppauge/Zilog Z8" ; ir->get_key = get_key_haup_xvr; - rc_type =RC_TYPE_RC5 ; + rc_type =RC_BIT_RC5 ; ir_codes =RC_MAP_HAUPPAUGE ;break ; }
drivers/media/video/ivtv/ivtv-i2c.c +4 -4
@@ -200,21 +200,21 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) init_data->ir_codes =RC_MAP_AVERMEDIA_CARDBUS ; init_data->internal_get_key_func =IR_KBD_GET_KEY_AVERMEDIA_CARDBUS ; - init_data->type =RC_TYPE_OTHER ; + init_data->type =RC_BIT_OTHER ; init_data->name ="AVerMedia AVerTV card" ;break ;case IVTV_HW_I2C_IR_RX_HAUP_EXT :case IVTV_HW_I2C_IR_RX_HAUP_INT : init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name = itv->card_name;break ;case IVTV_HW_Z8F0811_IR_RX_HAUP :/* Default to grey remote */ init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP_XVR ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name = itv->card_name;break ;case IVTV_HW_I2C_IR_RX_ADAPTEC :
@@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) init_data->name = itv->card_name;/* FIXME: The protocol and RC_MAP needs to be corrected */ init_data->ir_codes =RC_MAP_EMPTY ; - init_data->type =RC_TYPE_UNKNOWN ; + init_data->type =RC_BIT_UNKNOWN ;break ; }
drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +2 -2
@@ -580,7 +580,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)case PVR2_IR_SCHEME_29XXX :/* Original 29xxx device */ init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name = hdw->hdw_desc->description; init_data->polling_interval =100 ;/* ms From ir-kbd-i2c */ /* IR Receiver */
@@ -595,7 +595,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)case PVR2_IR_SCHEME_24XXX_MCE :/* 24xxx MCE device */ init_data->ir_codes =RC_MAP_HAUPPAUGE ; init_data->internal_get_key_func =IR_KBD_GET_KEY_HAUP_XVR ; - init_data->type =RC_TYPE_RC5 ; + init_data->type =RC_BIT_RC5 ; init_data->name = hdw->hdw_desc->description;/* IR Receiver */ info.addr =0x71 ;
drivers/media/video/saa7134/saa7134-input.c +1 -1
@@ -914,7 +914,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name ="BeholdTV" ; dev->init_data.get_key = get_key_beholdm6xx; dev->init_data.ir_codes =RC_MAP_BEHOLD ; - dev->init_data.type =RC_TYPE_NEC ; + dev->init_data.type =RC_BIT_NEC ; info.addr =0x2d ;break ;case SAA7134_BOARD_AVERMEDIA_CARDBUS_501 :
drivers/staging/tm6000/tm6000-input.c +7 -7
@@ -97,7 +97,7 @@ static int tm6000_ir_config(struct tm6000_IR *ir)int rc;switch (ir->rc_type) { -case RC_TYPE_NEC : +case RC_BIT_NEC :/* Setup IR decoder for NEC standard 12MHz system clock */ /* IR_LEADER_CNT = 0.9ms */ tm6000_set_reg (dev,TM6010_REQ07_RD8_IR_LEADER1 ,0xaa );
@@ -174,10 +174,10 @@ static int default_polling_getkey(struct tm6000_IR *ir,if (&dev->int_in) {switch (ir->rc_type) { -case RC_TYPE_RC5 : +case RC_BIT_RC5 : poll_result->rc_data = ir->urb_data[0 ];break ; -case RC_TYPE_NEC : +case RC_BIT_NEC :if (ir->urb_data[1 ] == ((ir->key_addr >>8 ) &0xff )) { poll_result->rc_data = ir->urb_data[0 ] | ir->urb_data[1 ] <<8 ;
@@ -194,7 +194,7 @@ static int default_polling_getkey(struct tm6000_IR *ir,tm6000_set_reg (dev,REQ_04_EN_DISABLE_MCU_INT ,2 ,1 );msleep (10 ); -if (ir->rc_type ==RC_TYPE_RC5 ) { +if (ir->rc_type ==RC_BIT_RC5 ) { rc =tm6000_read_write_usb (dev,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,REQ_02_GET_IR_CODE ,0 ,0 , buf,1 );
@@ -291,7 +291,7 @@ int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type)if (!ir)return 0 ; -if ((rc->rc_map.scan) && (rc_type ==RC_TYPE_NEC )) +if ((rc->rc_map.scan) && (rc_type ==RC_BIT_NEC )) ir->key_addr = ((rc->rc_map.scan[0 ].scancode >>8 ) &0xffff ); ir->get_key = default_polling_getkey;
@@ -383,7 +383,7 @@ int tm6000_ir_init(struct tm6000_core *dev) ir->rc = rc;/* input einrichten */ - rc->allowed_protos =RC_TYPE_RC5 |RC_TYPE_NEC ; + rc->allowed_protos =RC_BIT_RC5 |RC_BIT_NEC ; rc->priv = ir; rc->change_protocol = tm6000_ir_change_protocol; rc->open = tm6000_ir_start;
@@ -401,7 +401,7 @@ int tm6000_ir_init(struct tm6000_core *dev)usb_make_path (dev->udev, ir->phys,sizeof (ir->phys));strlcat (ir->phys,"/input0" ,sizeof (ir->phys)); -tm6000_ir_change_protocol (rc,RC_TYPE_UNKNOWN ); +tm6000_ir_change_protocol (rc,RC_BIT_UNKNOWN ); rc->input_name = ir->name; rc->input_phys = ir->phys;
include/media/rc-map.h +29 -12
48 lines not on this page · raw message
David Härdeman
maintainerPATCH 7/10 rc-core: use the full 32 bits for NEC scancodes
In reply to David HärdemanUsing the full 32 bits for all kinds of NEC scancodes simplifies rc-core and the nec decoder without any loss of functionality.
--- drivers/media/dvb/dvb-usb/af9015.c | 22 ++++++---------------- drivers/media/rc/ir-nec-decoder.c | 28 ++++------------------------ include/media/rc-map.h | 11 +++++++++-- 3 files changed, 19 insertions(+), 42 deletions(-)
drivers/media/dvb/dvb-usb/af9015.c +6 -16
@@ -1034,7 +1034,8 @@ static int af9015_rc_query(struct dvb_usb_device *d)if ((priv->rc_repeat != buf[6 ] || buf[0 ]) && !memcmp (&buf[12 ], priv->rc_last,4 )) {deb_rc ("%s: key repeated\n" , __func__); -rc_keydown (d->rc_dev,RC_TYPE_NEC , priv->rc_keycode,0 ); +rc_keydown (d->rc_dev,RC_TYPE_NEC , +RC_SCANCODE_NEC32 (priv->rc_keycode),0 ); priv->rc_repeat = buf[6 ];return ret; }
@@ -1051,21 +1052,10 @@ static int af9015_rc_query(struct dvb_usb_device *d)/* Remember this key */ memcpy (priv->rc_last, &buf[12 ],4 ); -if (buf[14 ] == (u8 ) ~buf[15 ]) { -if (buf[12 ] == (u8 ) ~buf[13 ]) { -/* NEC */ - priv->rc_keycode = buf[12 ] <<8 | buf[14 ]; - }else { -/* NEC extended*/ - priv->rc_keycode = buf[12 ] <<16 | - buf[13 ] <<8 | buf[14 ]; - } - }else { -/* 32 bit NEC */ - priv->rc_keycode = buf[12 ] <<24 | buf[13 ] <<16 | - buf[14 ] <<8 | buf[15 ]; - } -rc_keydown (d->rc_dev,RC_TYPE_NEC , priv->rc_keycode,0 ); + priv->rc_keycode = buf[12 ] <<24 | buf[13 ] <<16 | + buf[14 ] <<8 | buf[15 ]; +rc_keydown (d->rc_dev,RC_TYPE_NEC , +RC_SCANCODE_NEC32 (priv->rc_keycode),0 ); }else {deb_rc ("%s: no key press\n" , __func__);/* Invalidate last keypress */
drivers/media/rc/ir-nec-decoder.c +4 -24
@@ -49,7 +49,6 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)struct nec_dec *data = &dev->raw->nec;u32 scancode;u8 address, not_address, command, not_command; -bool send_32bits = false;if (!(dev->enabled_protocols &RC_BIT_NEC ))return 0 ;
@@ -162,33 +161,14 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) command =bitrev8 ((data->bits >>8 ) &0xff ); not_command =bitrev8 ((data->bits >>0 ) &0xff ); -if ((command ^ not_command) !=0xff ) { -IR_dprintk (1 ,"NEC checksum error: received 0x%08x\n" , - data->bits); - send_32bits = true; - } - -if (send_32bits) { -/* NEC transport, but modified protocol, used by at -* least Apple and TiVo remotes */ - scancode = data->bits; -IR_dprintk (1 ,"NEC (modified) scancode 0x%08x\n" , scancode); - }else if ((address ^ not_address) !=0xff ) { -/* Extended NEC */ - scancode = address <<16 | - not_address <<8 | - command; -IR_dprintk (1 ,"NEC (Ext) scancode 0x%06x\n" , scancode); - }else { -/* Normal NEC */ - scancode = address <<8 | command; -IR_dprintk (1 ,"NEC scancode 0x%04x\n" , scancode); - } + scancode = address <<24 | not_address <<16 | + command <<8 | not_command; +IR_dprintk (1 ,"NEC scancode 0x%08x\n" , scancode);if (data->is_nec_x) data->necx_repeat = true; -rc_keydown (dev,RC_TYPE_NEC , scancode,0 ); +rc_keydown (dev,RC_TYPE_NEC ,RC_SCANCODE_NEC32 (scancode),0 ); data->state =STATE_INACTIVE ;return 0 ; }
include/media/rc-map.h +9 -2
@@ -44,8 +44,15 @@#define RC_SCANCODE_UNKNOWN (x) (x)#define RC_SCANCODE_OTHER (x) (x) -#define RC_SCANCODE_NEC (addr, cmd) (((addr) << 8) | (cmd)) -#define RC_SCANCODE_NECX (addr, cmd) (((addr) << 8) | (cmd)) +#define RC_SCANCODE_NEC (addr, cmd) \ + ((( (addr) & 0xff) << 24) | \ + ((~(addr) & 0xff) << 16) | \ + (( (cmd) & 0xff) << 8 ) | \ + ((~(cmd) & 0xff) << 0 )) +#define RC_SCANCODE_NECX (addr, cmd) \ + ((( (addr) & 0xffff) << 16) | \ + (( (cmd) & 0x00ff) << 8) | \ + ((~(cmd) & 0x00ff) << 0))#define RC_SCANCODE_NEC32 (data) ((data) & 0xffffffff)#define RC_SCANCODE_RC5 (sys, cmd) (((sys) << 8) | (cmd))#define RC_SCANCODE_RC5_SZ (sys, cmd) (((sys) << 8) | (cmd))
David Härdeman
maintainerPATCH 8/10 rc-core: merge rc5 and streamzap decoders
In reply to David HärdemanNow that the protocol is part of the scancode, it is pretty easy to merge the rc5 and streamzap decoders. An additional advantage is that the decoder is now stricter as it waits for the trailing silence before determining that a command is a valid rc5/streamzap command (which avoids collisions that I've seen with e.g. Sony protocols).
--- drivers/media/rc/Kconfig | 12 -- drivers/media/rc/Makefile | 1 drivers/media/rc/ir-rc5-decoder.c | 51 ++++++---- drivers/media/rc/ir-rc5-sz-decoder.c | 153 ------------------------------- drivers/media/rc/keymaps/rc-streamzap.c | 4 - drivers/media/rc/rc-core-priv.h | 8 -- drivers/media/rc/streamzap.c | 10 -- 7 files changed, 31 insertions(+), 208 deletions(-) delete mode 100644 drivers/media/rc/ir-rc5-sz-decoder.c
drivers/media/rc/Kconfig +0 -12
@@ -75,18 +75,6 @@ config IR_SONY_DECODER Enable this option if you have an infrared remote control which uses the Sony protocol, and you need software decoding support. -config IR_RC5_SZ_DECODER - tristate "Enable IR raw decoder for the RC-5 (streamzap) protocol" - depends on RC_CORE - select BITREVERSE - default y - - ---help--- - Enable this option if you have IR with RC-5 (streamzap) protocol, - and if the IR is decoded in software. (The Streamzap PC Remote - uses an IR protocol that is almost standard RC-5, but not quite, - as it uses an additional bit). - config IR_LIRC_CODEC tristate "Enable IR to LIRC bridge" depends on RC_CORE
drivers/media/rc/Makefile +0 -1
@@ -9,7 +9,6 @@ obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o -obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o # stand-alone IR receivers/transmitters
drivers/media/rc/ir-rc5-decoder.c +29 -22
122 lines not on this page · raw message
drivers/media/rc/ir-rc5-sz-decoder.c deleted +0 -153
153 lines not on this page · raw message
drivers/media/rc/keymaps/rc-streamzap.c +1 -3
@@ -14,9 +14,7 @@static struct rc_map_table streamzap[] = {/* * The Streamzap remote is almost, but not quite, RC-5, as it has an extra -* bit in it, which throws the in-kernel RC-5 decoder for a loop. Currently, -* an additional RC-5-sz decoder is being deployed to support it, but it -* may be possible to merge it back with the standard RC-5 decoder. +* bit in it. */ {RC_TYPE_RC5_SZ ,RC_SCANCODE_RC5_SZ (0x28 ,0xc0 ),KEY_NUMERIC_0 }, {RC_TYPE_RC5_SZ ,RC_SCANCODE_RC5_SZ (0x28 ,0xc1 ),KEY_NUMERIC_1 },
drivers/media/rc/rc-core-priv.h +1 -7
@@ -54,7 +54,7 @@ struct ir_raw_event_ctrl {int state;u32 bits;unsigned count; -unsigned wanted_bits; +bool is_rc5x; } rc5;struct rc6_dec {int state;
@@ -77,12 +77,6 @@ struct ir_raw_event_ctrl {bool first;bool toggle; } jvc; -struct rc5_sz_dec { -int state; -u32 bits; -unsigned count; -unsigned wanted_bits; - } rc5_sz;struct lirc_codec {struct rc_dev *dev;struct lirc_driver *drv;
drivers/media/rc/streamzap.c +0 -10
@@ -69,13 +69,6 @@ MODULE_DEVICE_TABLE(usb, streamzap_table);/* number of samples buffered */ #define SZ_BUF_LEN 128 -/* from ir-rc5-sz-decoder.c */ -#ifdef CONFIG_IR_RC5_SZ_DECODER_MODULE -#define load_rc5_sz_decode () request_module("ir-rc5-sz-decoder") -#else -#define load_rc5_sz_decode () {} -#endif -enum StreamzapDecoderState { PulseSpace, FullPulse,
@@ -458,9 +451,6 @@ static int __devinit streamzap_probe(struct usb_interface *intf,dev_info (sz->dev,"Registered %s on usb%d:%d\n" , name, usbdev->bus->busnum, usbdev->devnum); -/* Load the streamzap not-quite-rc5 decoder too */ -load_rc5_sz_decode (); -return 0 ; rc_dev_fail:
David Härdeman
maintainerPATCH 9/10 rc-core: lirc use unsigned int
In reply to David HärdemanDurations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API.
--- drivers/media/rc/ene_ir.c | 4 ++-- drivers/media/rc/ene_ir.h | 2 +- drivers/media/rc/ir-lirc-codec.c | 15 +++++++++------ drivers/media/rc/ite-cir.c | 5 +---- drivers/media/rc/mceusb.c | 10 ++++------ drivers/media/rc/nuvoton-cir.c | 12 +++--------- drivers/media/rc/rc-loopback.c | 13 +++---------- drivers/media/rc/winbond-cir.c | 6 +----- include/media/rc-core.h | 2 +- 9 files changed, 25 insertions(+), 44 deletions(-)
drivers/media/rc/ene_ir.c +2 -2
@@ -953,13 +953,13 @@ static void ene_set_idle(struct rc_dev *rdev, bool idle) }/* outside interface: transmit */ -static int ene_transmit (struct rc_dev *rdev,int *buf,u32 n) +static int ene_transmit (struct rc_dev *rdev,unsigned *buf,unsigned n) {struct ene_device *dev = rdev->priv;unsigned long flags; dev->tx_buffer = buf; - dev->tx_len = n /sizeof (int ); + dev->tx_len = n; dev->tx_pos =0 ; dev->tx_reg =0 ; dev->tx_done =0 ;
drivers/media/rc/ene_ir.h +1 -1
@@ -235,7 +235,7 @@ struct ene_device {bool tx_sample_pulse;/* current sample is pulse */ /* TX buffer */ -int *tx_buffer;/* input samples buffer*/ +unsigned *tx_buffer;/* input samples buffer*/ int tx_pos;/* position in that bufer */ int tx_len;/* current len of tx buffer */ int tx_done;/* done transmitting */
drivers/media/rc/ir-lirc-codec.c +9 -6
@@ -103,19 +103,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, {struct lirc_codec *lirc;struct rc_dev *dev; -int *txbuf;/* buffer with values to transmit */ -int ret =0 ; +unsigned int *txbuf;/* buffer with values to transmit */ +ssize_t ret =0 ;size_t count; lirc =lirc_get_pdata (file);if (!lirc)return -EFAULT ; -if (n %sizeof (int )) +if (n <sizeof (unsigned ) || n %sizeof (unsigned ))return -EINVAL ; - count = n /sizeof (int ); -if (count >LIRCBUF_SIZE || count %2 ==0 || n %sizeof (int ) !=0 ) + count = n /sizeof (unsigned ); +if (count >LIRCBUF_SIZE || count %2 ==0 )return -EINVAL ; txbuf =memdup_user (buf, n);
@@ -129,7 +129,10 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, }if (dev->tx_ir) - ret = dev->tx_ir (dev, txbuf, (u32 )n); + ret = dev->tx_ir (dev, txbuf, count); + +if (ret >0 ) + ret *=sizeof (unsigned ); out:kfree (txbuf);
drivers/media/rc/ite-cir.c +1 -4
@@ -381,7 +381,7 @@ static int ite_set_tx_duty_cycle(struct rc_dev *rcdev, u32 duty_cycle)/* transmit out IR pulses; what you get here is a batch of alternating * pulse/space/pulse/space lengths that we should write out completely through * the FIFO, blocking on a full FIFO */ -static int ite_tx_ir (struct rc_dev *rcdev,int *txbuf,u32 n) +static int ite_tx_ir (struct rc_dev *rcdev,unsigned *txbuf,unsigned n) {unsigned long flags;struct ite_dev *dev = rcdev->priv;
@@ -397,9 +397,6 @@ static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n)/* clear the array just in case */ memset (last_sent,0 ,ARRAY_SIZE (last_sent)); -/* n comes in bytes; convert to ints */ - n /=sizeof (int ); -spin_lock_irqsave (&dev->lock, flags);/* let everybody know we're now transmitting */
drivers/media/rc/mceusb.c +4 -6
@@ -665,20 +665,18 @@ static void mce_sync_in(struct mceusb_dev *ir, unsigned char *data, int size) }/* Send data out the IR blaster port(s) */ -static int mceusb_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int mceusb_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned count) {struct mceusb_dev *ir = dev->priv;int i, ret =0 ; -int count, cmdcount =0 ; +int cmdcount =0 ;unsigned char *cmdbuf;/* MCE command buffer */ long signal_duration =0 ;/* Singnal length in us */ struct timeval start_time, end_time;do_gettimeofday (&start_time); - count = n /sizeof (int ); - - cmdbuf =kzalloc (sizeof (int ) *MCE_CMDBUF_SIZE ,GFP_KERNEL ); + cmdbuf =kzalloc (sizeof (unsigned ) *MCE_CMDBUF_SIZE ,GFP_KERNEL );if (!cmdbuf)return -ENOMEM ;
@@ -747,7 +745,7 @@ static int mceusb_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) out:kfree (cmdbuf); -return ret ? ret : n; +return ret ? ret : count; }/* Sets active IR outputs -- mce devices typically have two */
drivers/media/rc/nuvoton-cir.c +3 -9
@@ -512,24 +512,18 @@ static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier)* number may larger than TXFCONT (0xff). So in interrupt_handler, it has to * set TXFCONT as 0xff, until buf_count less than 0xff. */ -static int nvt_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int nvt_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned n) {struct nvt_dev *nvt = dev->priv;unsigned long flags; -size_t cur_count;unsigned int i;u8 iren;int ret;spin_lock_irqsave (&nvt->tx.lock, flags); -if (n >=TX_BUF_LEN ) { - nvt->tx.buf_count = cur_count =TX_BUF_LEN ; - ret =TX_BUF_LEN ; - }else { - nvt->tx.buf_count = cur_count = n; - ret = n; - } + ret =min ((unsigned )(TX_BUF_LEN /sizeof (unsigned )), n); + nvt->tx.buf_count = (ret *sizeof (unsigned ));memcpy (nvt->tx.buf, txbuf, nvt->tx.buf_count);
drivers/media/rc/rc-loopback.c +3 -10
@@ -101,21 +101,14 @@ static int loop_set_rx_carrier_range(struct rc_dev *dev, u32 min, u32 max)return 0 ; } -static int loop_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int loop_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned count) {struct loopback_dev *lodev = dev->priv;u32 rxmask; -unsigned count;unsigned total_duration =0 ;unsigned i;DEFINE_IR_RAW_EVENT (rawir); -if (n ==0 || n %sizeof (int )) { -dprintk ("invalid tx buffer size\n" ); -return -EINVAL ; - } - - count = n /sizeof (int );for (i =0 ; i < count; i++) total_duration +=abs (txbuf[i]);
@@ -142,7 +135,7 @@ static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n)for (i =0 ; i < count; i++) { rawir.pulse = i %2 ? false : true; - rawir.duration =abs (txbuf[i]) *1000 ; + rawir.duration = txbuf[i] *1000 ;if (rawir.duration)ir_raw_event_store_with_filter (dev, &rawir); }
@@ -158,7 +151,7 @@ out:/* Lirc expects this function to take as long as the total duration */ set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (usecs_to_jiffies (total_duration)); -return n; +return count; }static void loop_set_idle (struct rc_dev *dev,bool enable)
drivers/media/rc/winbond-cir.c +1 -5
@@ -577,16 +577,12 @@ wbcir_txmask(struct rc_dev *dev, u32 mask) }static int -wbcir_tx (struct rc_dev *dev,int *buf,u32 bufsize) +wbcir_tx (struct rc_dev *dev,unsigned *buf,unsigned count) {struct wbcir_data *data = dev->priv; -u32 count;unsigned i;unsigned long flags; -/* bufsize has been sanity checked by the caller */ - count = bufsize /sizeof (int ); -/* Not sure if this is possible, but better safe than sorry */ spin_lock_irqsave (&data->spinlock, flags);if (data->txstate !=WBCIR_TXSTATE_INACTIVE ) {
include/media/rc-core.h +1 -1
@@ -134,7 +134,7 @@ struct rc_dev {int (*s_tx_carrier)(struct rc_dev *dev,u32 carrier);int (*s_tx_duty_cycle)(struct rc_dev *dev,u32 duty_cycle);int (*s_rx_carrier_range)(struct rc_dev *dev,u32 min,u32 max); -int (*tx_ir)(struct rc_dev *dev,int *txbuf,u32 n); +int (*tx_ir)(struct rc_dev *dev,unsigned *txbuf,unsigned n);void (*s_idle)(struct rc_dev *dev,bool enable);int (*s_learning_mode)(struct rc_dev *dev,int enable);int (*s_carrier_report) (struct rc_dev *dev,int enable);
David Härdeman
maintainerPATCH 10/10 rc-core: move timeout and checks to lirc
In reply to David HärdemanThe lirc TX functionality expects the process which writes (TX) data to the lirc dev to sleep until the actual data has been transmitted by the hardware.
Since the same timeout calculation is duplicated in more than one driver (and would have to be duplicated in even more drivers as they gain TX support), it makes sense to move this timeout calculation to the lirc layer instead.
At the same time, centralize some of the sanity checks.
--- drivers/media/rc/ir-lirc-codec.c | 33 +++++++++++++++++++++++++++++---- drivers/media/rc/mceusb.c | 18 ------------------ drivers/media/rc/rc-loopback.c | 12 ------------ 3 files changed, 29 insertions(+), 34 deletions(-)
drivers/media/rc/ir-lirc-codec.c +29 -4
@@ -106,6 +106,12 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,unsigned int *txbuf;/* buffer with values to transmit */ ssize_t ret =0 ;size_t count; +ktime_t start; +s64 towait; +unsigned int duration =0 ;/* signal duration in us */ +int i; + + start =ktime_get (); lirc =lirc_get_pdata (file);if (!lirc)
@@ -128,11 +134,30 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, goto out; } -if (dev->tx_ir) - ret = dev->tx_ir (dev, txbuf, count); +if (!dev->tx_ir) { + ret = -ENOSYS ; + goto out; + } + + ret = dev->tx_ir (dev, txbuf, (u32 )n); +if (ret <0 ) + goto out; + +for (i =0 ; i < ret; i++) + duration += txbuf[i]; -if (ret >0 ) - ret *=sizeof (unsigned ); + ret *=sizeof (unsigned int ); + +/* +* The lircd gap calculation expects the write function to +* wait for the actual IR signal to be transmitted before +* returning. +*/ + towait =ktime_us_delta (ktime_add_us (start, duration),ktime_get ()); +if (towait >0 ) { +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (usecs_to_jiffies (towait)); + } out:kfree (txbuf);
drivers/media/rc/mceusb.c +0 -18
@@ -671,10 +671,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)int i, ret =0 ;int cmdcount =0 ;unsigned char *cmdbuf;/* MCE command buffer */ -long signal_duration =0 ;/* Singnal length in us */ -struct timeval start_time, end_time; - -do_gettimeofday (&start_time); cmdbuf =kzalloc (sizeof (unsigned ) *MCE_CMDBUF_SIZE ,GFP_KERNEL );if (!cmdbuf)
@@ -687,7 +683,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)/* Generate mce packet data */ for (i =0 ; (i < count) && (cmdcount <MCE_CMDBUF_SIZE ); i++) { - signal_duration += txbuf[i]; txbuf[i] = txbuf[i] /MCE_TIME_UNIT ; do { /* loop to support long pulses/spaces > 127*50us=6.35ms */
@@ -730,19 +725,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)/* Transmit the command to the mce device */ mce_async_out (ir, cmdbuf, cmdcount); -/* -* The lircd gap calculation expects the write function to -* wait the time it takes for the ircommand to be sent before -* it returns. -*/ -do_gettimeofday (&end_time); - signal_duration -= (end_time.tv_usec - start_time.tv_usec) + - (end_time.tv_sec - start_time.tv_sec) *1000000 ; - -/* delay with the closest number of ticks */ -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (usecs_to_jiffies (signal_duration)); - out:kfree (cmdbuf);return ret ? ret : count;
drivers/media/rc/rc-loopback.c +0 -12
@@ -105,18 +105,9 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) {struct loopback_dev *lodev = dev->priv;u32 rxmask; -unsigned total_duration =0 ;unsigned i;DEFINE_IR_RAW_EVENT (rawir); -for (i =0 ; i < count; i++) - total_duration +=abs (txbuf[i]); - -if (total_duration ==0 ) { -dprintk ("invalid tx data, total duration zero\n" ); -return -EINVAL ; - } -if (lodev->txcarrier < lodev->rxcarriermin || lodev->txcarrier > lodev->rxcarriermax) {dprintk ("ignoring tx, carrier out of range\n" );
@@ -148,9 +139,6 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)ir_raw_event_handle (dev); out: -/* Lirc expects this function to take as long as the total duration */ -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (usecs_to_jiffies (total_duration));return count; }
Quoted 5 lines · David Härdeman
The following series is what's in my current patch queue for rc-core.
It only been lightly tested so far and it's based on the "for_v2.6.39" branch, but I still wanted to send it to the list so that I can get some feedback while I refresh the patches to "for_v2.6.40" and do more testing.
Patch [06/10] hasn't made it to gmane or spinics servers.
Patchwork appears to be down again :(
Regards
Malcolm
David Härdeman
maintainerQuoted 10 lines · Malcolm Priestley
Quoted 7 lines · David Härdeman
The following series is what's in my current patch queue for rc-core.
It only been lightly tested so far and it's based on the "for_v2.6.39" branch,
but I still wanted to send it to the list so that I can get some feedback while
I refresh the patches to "for_v2.6.40" and do more testing.Patch [06/10] hasn't made it to gmane or spinics servers.
Looking through the postfix logs, vger.kernel.org did accept the mail. My guess is that it wasn't distributed (or indexed) because of its size.
I've put patch 6/10 at http://david.hardeman.nu/rc-proto.patch for now, and I've included the patch description inline below:
Setting and getting keycodes in the input subsystem used to be done via the EVIOC[GS]KEYCODE ioctl and "unsigned int[2]" (one int for scancode and one for the keycode).
The interface has now been extended to use the EVIOC[GS]KEYCODE_V2 ioctl which uses the following struct:
struct input_keymap_entry {
__u8 flags;
__u8 len;
__u16 index;
__u32 keycode;
__u8 scancode[32];
};(scancode can of course be even bigger, thanks to the len member).
This patch changes how the "input_keymap_entry" struct is interpreted by rc-core by casting it to "rc_keymap_entry":
struct rc_scancode {
__u16 protocol;
__u16 reserved[3];
__u64 scancode;
}
struct rc_keymap_entry {
__u8 flags;
__u8 len;
__u16 index;
__u32 keycode;
union {
struct rc_scancode rc;
__u8 raw[32];
};
};The u64 scancode member is large enough for all current protocols and it would be possible to extend it in the future should it be necessary for some exotic protocol.
The main advantage with this change is that the protocol is made explicit, which means that we're not throwing away data (the protocol type) and that it'll be easier to support multiple protocols with one decoder (think rc5 and rc5-streamzap).
Further down the road we should also have a way to report the protocol of a received keypress to userspace.
--- drivers/media/dvb/dm1105/dm1105.c | 3 drivers/media/dvb/dvb-usb/af9015.c | 4 drivers/media/dvb/dvb-usb/anysee.c | 2 drivers/media/dvb/dvb-usb/dib0700_core.c | 2 drivers/media/dvb/dvb-usb/dib0700_devices.c | 10 - drivers/media/dvb/dvb-usb/dvb-usb.h | 2 drivers/media/dvb/dvb-usb/lmedm04.c | 2 drivers/media/dvb/dvb-usb/ttusb2.c | 2 drivers/media/dvb/mantis/mantis_input.c | 117 +++--- drivers/media/dvb/ttpci/budget-ci.c | 7 drivers/media/rc/imon.c | 11 - drivers/media/rc/ir-jvc-decoder.c | 4 drivers/media/rc/ir-lirc-codec.c | 2 drivers/media/rc/ir-nec-decoder.c | 4 drivers/media/rc/ir-raw.c | 2 drivers/media/rc/ir-rc5-decoder.c | 23 - drivers/media/rc/ir-rc5-sz-decoder.c | 4 drivers/media/rc/ir-rc6-decoder.c | 4 drivers/media/rc/ir-sony-decoder.c | 26 + drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 89 ++--- drivers/media/rc/keymaps/rc-alink-dtu-m.c | 37 +- drivers/media/rc/keymaps/rc-anysee.c | 89 ++--- drivers/media/rc/keymaps/rc-apac-viewcomp.c | 65 ++-- drivers/media/rc/keymaps/rc-asus-pc39.c | 79 ++-- drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 49 +-- drivers/media/rc/keymaps/rc-avermedia-a16d.c | 69 ++-- drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 109 +++--- drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 69 ++-- drivers/media/rc/keymaps/rc-avermedia-m135a.c | 187 +++++----- .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 89 ++--- drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 55 +-- drivers/media/rc/keymaps/rc-avermedia.c | 73 ++-- drivers/media/rc/keymaps/rc-avertv-303.c | 73 ++-- drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 107 +++--- drivers/media/rc/keymaps/rc-behold-columbus.c | 73 ++-- drivers/media/rc/keymaps/rc-behold.c | 69 ++-- drivers/media/rc/keymaps/rc-budget-ci-old.c | 91 ++--- drivers/media/rc/keymaps/rc-cinergy-1400.c | 75 ++-- drivers/media/rc/keymaps/rc-cinergy.c | 73 ++-- drivers/media/rc/keymaps/rc-dib0700-nec.c | 141 ++++---- drivers/media/rc/keymaps/rc-dib0700-rc5.c | 361 ++++++++++---------- drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 99 +++-- drivers/media/rc/keymaps/rc-digittrade.c | 57 ++- drivers/media/rc/keymaps/rc-dm1105-nec.c | 63 ++- drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 65 ++-- drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 107 +++--- drivers/media/rc/keymaps/rc-em-terratec.c | 57 ++- drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 59 ++- drivers/media/rc/keymaps/rc-encore-enltv.c | 131 ++++--- drivers/media/rc/keymaps/rc-encore-enltv2.c | 79 ++-- drivers/media/rc/keymaps/rc-evga-indtube.c | 33 +- drivers/media/rc/keymaps/rc-eztv.c | 89 ++--- drivers/media/rc/keymaps/rc-flydvb.c | 65 ++-- drivers/media/rc/keymaps/rc-flyvideo.c | 53 +-- drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 105 +++--- drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 63 ++- drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 65 ++-- drivers/media/rc/keymaps/rc-gotview7135.c | 69 ++-- drivers/media/rc/keymaps/rc-hauppauge.c | 287 ++++++++-------- drivers/media/rc/keymaps/rc-imon-mce.c | 173 +++++----- drivers/media/rc/keymaps/rc-imon-pad.c | 215 ++++++------ drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 87 ++--- drivers/media/rc/keymaps/rc-kaiomy.c | 65 ++-- drivers/media/rc/keymaps/rc-kworld-315u.c | 65 ++-- .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 71 ++-- drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 101 +++--- drivers/media/rc/keymaps/rc-lirc.c | 1 drivers/media/rc/keymaps/rc-lme2510.c | 133 ++++--- drivers/media/rc/keymaps/rc-manli.c | 97 +++-- drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 37 +- drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 65 ++-- drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 89 ++--- drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 49 +-- drivers/media/rc/keymaps/rc-nebula.c | 111 +++--- .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 121 +++---- drivers/media/rc/keymaps/rc-norwood.c | 69 ++-- drivers/media/rc/keymaps/rc-npgtech.c | 71 ++-- drivers/media/rc/keymaps/rc-pctv-sedna.c | 65 ++-- drivers/media/rc/keymaps/rc-pinnacle-color.c | 107 +++--- drivers/media/rc/keymaps/rc-pinnacle-grey.c | 83 ++--- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 51 +-- drivers/media/rc/keymaps/rc-pixelview-002t.c | 53 +-- drivers/media/rc/keymaps/rc-pixelview-mk12.c | 63 ++- drivers/media/rc/keymaps/rc-pixelview-new.c | 63 ++- drivers/media/rc/keymaps/rc-pixelview.c | 77 ++-- .../media/rc/keymaps/rc-powercolor-real-angel.c | 71 ++-- drivers/media/rc/keymaps/rc-proteus-2309.c | 49 +-- drivers/media/rc/keymaps/rc-purpletv.c | 71 ++-- drivers/media/rc/keymaps/rc-pv951.c | 63 ++- drivers/media/rc/keymaps/rc-rc6-mce.c | 151 ++++---- .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 57 ++- drivers/media/rc/keymaps/rc-streamzap.c | 71 ++-- drivers/media/rc/keymaps/rc-tbs-nec.c | 69 ++-- drivers/media/rc/keymaps/rc-technisat-usb2.c | 67 ++-- drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 95 +++-- drivers/media/rc/keymaps/rc-terratec-slim-2.c | 37 +- drivers/media/rc/keymaps/rc-terratec-slim.c | 57 ++- drivers/media/rc/keymaps/rc-tevii-nec.c | 95 +++-- drivers/media/rc/keymaps/rc-total-media-in-hand.c | 71 ++-- drivers/media/rc/keymaps/rc-trekstor.c | 57 ++- drivers/media/rc/keymaps/rc-tt-1500.c | 79 ++-- drivers/media/rc/keymaps/rc-twinhan1027.c | 107 +++--- drivers/media/rc/keymaps/rc-videomate-m1f.c | 103 +++--- drivers/media/rc/keymaps/rc-videomate-s350.c | 89 ++--- drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 93 +++-- drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 57 ++- drivers/media/rc/keymaps/rc-winfast.c | 113 +++--- drivers/media/rc/rc-core-priv.h | 1 drivers/media/rc/rc-main.c | 229 +++++++++---- drivers/media/video/bt8xx/bttv-input.c | 10 - drivers/media/video/cx88/cx88-input.c | 10 - drivers/media/video/em28xx/em28xx-cards.c | 17 + drivers/media/video/em28xx/em28xx-input.c | 34 +- drivers/media/video/em28xx/em28xx.h | 1 drivers/media/video/ir-kbd-i2c.c | 12 + drivers/media/video/saa7134/saa7134-input.c | 6 drivers/staging/tm6000/tm6000-cards.c | 2 drivers/staging/tm6000/tm6000-input.c | 32 +- include/media/rc-core.h | 28 +- include/media/rc-map.h | 14 + 120 files changed, 4121 insertions(+), 4078 deletions(-)
Quoted 1 line
Patchwork appears to be down again :(
Mauro told me that it is and that someone is working on it...
Signature · 1 line
David Härdeman
Em 28-04-2011 17:13, Malcolm Priestley escreveu:
Quoted 10 lines · David Härdeman
Quoted 5 lines
The following series is what's in my current patch queue for rc-core.
It only been lightly tested so far and it's based on the "for_v2.6.39" branch, but I still wanted to send it to the list so that I can get some feedback while I refresh the patches to "for_v2.6.40" and do more testing.
Patch [06/10] hasn't made it to gmane or spinics servers.
Patchwork appears to be down again :(
None of the patches of this series were caught by patchwork :(
Btw, patchwork is broke again today: it is refusing to accept any commands to update via pwclient interface. On the last 7 days, I counted 7 days of partial outage at patchwork :(
It is time for us move from patchwork to something that works.
I intend to finish to apply the patches that patchwork caught and work on another process to get those patches from my imap server, probably writing a script using perl Mail::IMAPClient. The bad news is that, without patchwork, we'll loose some visibility about the patch status. I need to think a little more about that.
Quoted 10 lines
Regards
Malcolm
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/10] rc-core: add separate defines for protocol bitmaps and numbers
In reply to David HärdemanEm 28-04-2011 12:13, David Härdeman escreveu:
Quoted 5 lines
The RC_TYPE_* defines are currently used both where a single protocol is expected and where a bitmap of protocols is expected. This patch tries to separate the two in preparation for the following patches.
Signed-off-by David Härdeman <[email protected]>
Most of the patch is just renaming stuff. So, I'm commenting just the rc-main.c/rc-map.h changes.
Quoted 27 lines
drivers/media/rc/rc-main.c +3
-9@@ -102,7 +102,7 @@ static struct rc_map_list empty_map = { .map = { .scan = empty, .size = ARRAY_SIZE(empty), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EMPTY, } };@@ -725,14 +725,17 @@ static struct {u64 type;char *name; } proto_names[] = { - { RC_TYPE_UNKNOWN, "unknown" }, - { RC_TYPE_RC5, "rc-5" }, - { RC_TYPE_NEC, "nec" }, - { RC_TYPE_RC6, "rc-6" }, - { RC_TYPE_JVC, "jvc" }, - { RC_TYPE_SONY, "sony" }, - { RC_TYPE_RC5_SZ, "rc-5-sz" }, - { RC_TYPE_LIRC, "lirc" }, + { RC_BIT_OTHER, "other" }, + { RC_BIT_RC5, "rc-5" },
drivers/media/rc/rc-main.c static struct { · line 739
Quoted 10 lines
drivers/media/rc/rc-main.c +9
-0+ { RC_BIT_RC5X, "rc-5-x" }, + { RC_BIT_RC5_SZ, "rc-5-sz" }, + { RC_BIT_RC6, "rc-6" }, + { RC_BIT_JVC, "jvc" }, + { RC_BIT_SONY12, "sony12" }, + { RC_BIT_SONY15, "sony15" }, + { RC_BIT_SONY20, "sony20" }, + { RC_BIT_NEC, "nec" }, + { RC_BIT_LIRC, "lirc" }, };
There are some API breakages on the above. We shouln't do it, except if strictly required, and, if we'll do it, we need to do it via
Documentation/feature-removal-schedule.txt.
There are two types of breakages on the above:
1) the removal of "unknown" and "sony" types;
2) the behaviour change of "rc-5" (that, currently, means
both rc-5 and rc-5x.
Also, while you've mapped rc5/sony variants, nec variants weren't mapped.
IMO, what we should do on the above is:
1) preserve the "unknown";
2) use "rc-5", "sony", "nec" with the meaning that they will
enable all variants of those protocols;
3) add a new set of protocols to indicate subsets, like "sony:20",
"rc-5:normal", "rc5:x", etc.
4) if you're changing the interface, please submit a patch also
to v4l-utils, adding a logic there to handle the changes.
Quoted 12 lines
drivers/media/rc/rc-main.c +0
-0#define PROTO_NONE "none"include/media/rc-map.h +0
-2@@ -11,19 +11,36 @@#include <linux/input.h> -#define RC_TYPE_UNKNOWN 0 -#define RC_TYPE_RC5 (1 << 0)/* Philips RC5 protocol */
include/media/rc-map.h line 16
Quoted 10 lines
include/media/rc-map.h +2
-7-#define RC_TYPE_NEC (1 << 1) -#define RC_TYPE_RC6 (1 << 2)/* Philips RC6 protocol */ -#define RC_TYPE_JVC (1 << 3)/* JVC protocol */ -#define RC_TYPE_SONY (1 << 4)/* Sony12/15/20 protocol */ -#define RC_TYPE_RC5_SZ (1 << 5)/* RC5 variant used by Streamzap */ -#define RC_TYPE_LIRC (1 << 30)/* Pass raw IR to lirc userspace */ -#define RC_TYPE_OTHER (1u << 31) +#define RC_TYPE_UNKNOWN 0/* Protocol not known */ +#define RC_TYPE_OTHER 0/* Protocol known but proprietary */
This change doesn't make sense: we should either remove other or use different bits for different meanings. This is somewhat a mess currently, as there are, in fact, 3 types of "protocols":
1) reverse-engineered drivers, where developer didn't care to check what was the used protocol. It is there due to legacy IR handlers, added before rc-core. The better is to not accept this type anymore for new devices;
2) Other protocols that don't match at the list of supported protocols. Reserved for the cases were the developer took the care to check if the protocol is not NEC/RC-5/... and didn't find any protocol that matches;
3) Standard protocols with broken hardware. In general, keycode tables with just 8 bits for RC-5 or NEC, because the hardware uses a cheap uC (generally KS007 or similar) that only decodes the last 8 bits of the protocol. As the developer didn't have a full IR decoder, he was not able to fill the RC/NEC table with the IR address.
The problem with (2) is that it may reflect a temporary state where the protocol is not yet known. After adding a protocol decoder for it, case (2) turns into case (1).
So, maybe we can just merge (1) and (2) into the same case: "unknown". Maybe we should map (3) with a different option, internally (even exporting it as "unknown" to userspace), as it helps us to identify such cases and fix it later.
Quoted 35 lines
include/media/rc-map.h +27
-3+#define RC_TYPE_RC5 1/* Philips RC5 protocol */ +#define RC_TYPE_RC5X 2/* Philips RC5x protocol */ +#define RC_TYPE_RC5_SZ 3/* StreamZap variant of RC5 */ +#define RC_TYPE_RC6 4/* Philips RC6 protocol */ +#define RC_TYPE_JVC 5/* JVC protocol */ +#define RC_TYPE_SONY12 6/* Sony 12 bit protocol */ +#define RC_TYPE_SONY15 7/* Sony 15 bit protocol */ +#define RC_TYPE_SONY20 8/* Sony 20 bit protocol */ +#define RC_TYPE_NEC 9/* NEC protocol */ +#define RC_TYPE_LIRC 10/* Pass raw IR to lirc userspace */ -#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ - RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ - RC_TYPE_RC5_SZ | RC_TYPE_OTHER) +#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN) +#define RC_BIT_OTHER (1 << RC_TYPE_OTHER) +#define RC_BIT_RC5 (1 << RC_TYPE_RC5) +#define RC_BIT_RC5X (1 << RC_TYPE_RC5X) +#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ) +#define RC_BIT_RC6 (1 << RC_TYPE_RC6) +#define RC_BIT_JVC (1 << RC_TYPE_JVC) +#define RC_BIT_SONY12 (1 << RC_TYPE_SONY12) +#define RC_BIT_SONY15 (1 << RC_TYPE_SONY15) +#define RC_BIT_SONY20 (1 << RC_TYPE_SONY20) +#define RC_BIT_NEC (1 << RC_TYPE_NEC) +#define RC_BIT_LIRC (1 << RC_TYPE_LIRC) + +#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_RC5 | \ + RC_BIT_RC5X | RC_BIT_RC6 | RC_BIT_JVC | \ + RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ + RC_BIT_NEC | RC_BIT_LIRC)struct rc_map_table {u32 scancode;
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Mauro
Em 29-04-2011 05:08, David Härdeman escreveu:
Quoted 11 lines
Quoted 9 lines · Malcolm Priestley
Quoted 7 lines · David Härdeman
The following series is what's in my current patch queue for rc-core.
It only been lightly tested so far and it's based on the "for_v2.6.39" branch,
but I still wanted to send it to the list so that I can get some feedback while
I refresh the patches to "for_v2.6.40" and do more testing.
Quoted 7 lines
Quoted 1 line
Patch [06/10] hasn't made it to gmane or spinics servers.
Looking through the postfix logs, vger.kernel.org did accept the mail. My guess is that it wasn't distributed (or indexed) because of its size.
I've put patch 6/10 at http://david.hardeman.nu/rc-proto.patch for now, and I've included the patch description inline below:
Big patches like that makes harder to comment. So, I'll just get one small piece of the patch to add my comments.
Quoted 46 lines
Setting and getting keycodes in the input subsystem used to be done via the EVIOC[GS]KEYCODE ioctl and "unsigned int[2]" (one int for scancode and one for the keycode).
The interface has now been extended to use the EVIOC[GS]KEYCODE_V2 ioctl which uses the following struct:
struct input_keymap_entry { __u8 flags; __u8 len; __u16 index; __u32 keycode; __u8 scancode[32]; };(scancode can of course be even bigger, thanks to the len member).
This patch changes how the "
input_keymap_entry" struct is interpreted by rc-core by casting it to "rc_keymap_entry":struct rc_scancode { __u16 protocol; __u16 reserved[3]; __u64 scancode; } struct rc_keymap_entry { __u8 flags; __u8 len; __u16 index; __u32 keycode; union { struct rc_scancode rc; __u8 raw[32]; }; };The u64 scancode member is large enough for all current protocols and it would be possible to extend it in the future should it be necessary for some exotic protocol.
The main advantage with this change is that the protocol is made explicit, which means that we're not throwing away data (the protocol type) and that it'll be easier to support multiple protocols with one decoder (think rc5 and rc5-streamzap).
Quoted 4 lines
Further down the road we should also have a way to report the protocol of a received keypress to userspace.
Signed-off-by David Härdeman <[email protected]>
<snip/>
Review
Quoted 2 lines
(quoted diff) +1
-1- rc_keydown(d->rc_dev, priv->rc_keycode, 0); + rc_keydown(d->rc_dev, RC_TYPE_NEC, priv->rc_keycode, 0);
I'm OK with a change like the above, as it allows having some sort of input raw event to describe the protocol type, helping, for example, to have an userspace program that will help people to create keytable maps.
<snip/>
Quoted 87 lines
drivers/media/rc/keymaps/rc-videomate-s350.c +35
-44@@ -13,57 +13,56 @@#include <media/rc-map.h> static struct rc_map_table videomate_s350[] = { - {0x00 ,KEY_TV }, - {0x01 ,KEY_DVD }, - {0x04 ,KEY_RECORD }, - {0x05 ,KEY_VIDEO },/* TV/Video */ - {0x07 ,KEY_STOP }, - {0x08 ,KEY_PLAYPAUSE }, - {0x0a ,KEY_REWIND }, - {0x0f ,KEY_FASTFORWARD }, - {0x10 ,KEY_CHANNELUP }, - {0x12 ,KEY_VOLUMEUP }, - {0x13 ,KEY_CHANNELDOWN }, - {0x14 ,KEY_MUTE }, - {0x15 ,KEY_VOLUMEDOWN }, - {0x16 ,KEY_1 }, - {0x17 ,KEY_2 }, - {0x18 ,KEY_3 }, - {0x19 ,KEY_4 }, - {0x1a ,KEY_5 }, - {0x1b ,KEY_6 }, - {0x1c ,KEY_7 }, - {0x1d ,KEY_8 }, - {0x1e ,KEY_9 }, - {0x1f ,KEY_0 }, - {0x21 ,KEY_SLEEP }, - {0x24 ,KEY_ZOOM }, - {0x25 ,KEY_LAST },/* Recall */ - {0x26 ,KEY_SUBTITLE },/* CC */ - {0x27 ,KEY_LANGUAGE },/* MTS */ - {0x29 ,KEY_CHANNEL },/* SURF */ - {0x2b ,KEY_A }, - {0x2c ,KEY_B }, - {0x2f ,KEY_CAMERA },/* Snapshot */ - {0x23 ,KEY_RADIO }, - {0x02 ,KEY_PREVIOUSSONG }, - {0x06 ,KEY_NEXTSONG }, - {0x03 ,KEY_EPG }, - {0x09 ,KEY_SETUP }, - {0x22 ,KEY_BACKSPACE }, - {0x0c ,KEY_UP }, - {0x0e ,KEY_DOWN }, - {0x0b ,KEY_LEFT }, - {0x0d ,KEY_RIGHT }, - {0x11 ,KEY_ENTER }, - {0x20 ,KEY_TEXT }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x00 ),KEY_TV }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x01 ),KEY_DVD }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x04 ),KEY_RECORD }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x05 ),KEY_VIDEO },/* TV/Video */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x07 ),KEY_STOP }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x08 ),KEY_PLAYPAUSE }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x0a ),KEY_REWIND }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x0f ),KEY_FASTFORWARD }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x10 ),KEY_CHANNELUP }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x12 ),KEY_VOLUMEUP }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x13 ),KEY_CHANNELDOWN }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x14 ),KEY_MUTE }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x15 ),KEY_VOLUMEDOWN }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x16 ),KEY_1 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x17 ),KEY_2 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x18 ),KEY_3 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x19 ),KEY_4 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1a ),KEY_5 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1b ),KEY_6 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1c ),KEY_7 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1d ),KEY_8 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1e ),KEY_9 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x1f ),KEY_0 }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x21 ),KEY_SLEEP }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x24 ),KEY_ZOOM }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x25 ),KEY_LAST },/* Recall */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x26 ),KEY_SUBTITLE },/* CC */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x27 ),KEY_LANGUAGE },/* MTS */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x29 ),KEY_CHANNEL },/* SURF */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x2b ),KEY_A }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x2c ),KEY_B }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x2f ),KEY_CAMERA },/* Snapshot */ + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x23 ),KEY_RADIO }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x02 ),KEY_PREVIOUSSONG }, + {RC_TYPE_UNKNOWN ,RC_SCANCODE_UNKNOWN (0x06 ),KEY_NEXTSONG },
drivers/media/rc/keymaps/rc-videomate-s350.c line 60
Quoted 10 lines
drivers/media/rc/keymaps/rc-videomate-s350.c +9
-0+ { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x03), KEY_EPG}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x09), KEY_SETUP}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x22), KEY_BACKSPACE}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0c), KEY_UP}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0e), KEY_DOWN}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0b), KEY_LEFT}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0d), KEY_RIGHT}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x11), KEY_ENTER}, + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x20), KEY_TEXT}, };
However, changes like the above makes the keymaps confusing and breaks the v4l-utils sync scripts without a good reason.
A keymap maps one remote. All keys have the same protocol, so it doesn't make sense to mix the RC_TYPEs inside each key definition.
Before you answer tha above, you may be thinking on showing some some special remote type that might have more than one protocol. If this ever happens, just create two keymap tables for it. I'm sure that 99% of the remotes just use one protocol (except, of course, for Universal remotes, but no default keymap table covers this case).
Mauro.
Re: [PATCH 07/10] rc-core: use the full 32 bits for NEC scancodes
In reply to David HärdemanEm 28-04-2011 12:13, David Härdeman escreveu:
Quoted 2 lines
Using the full 32 bits for all kinds of NEC scancodes simplifies rc-core and the nec decoder without any loss of functionality.
This seems to be a good strategy. However, it breaks the existing NEC keymap tables (/me is not considering patch 6/10 macros), and changes those keytables on userspace. Not sure how to address this.
Comments?
Thanks,
Mauro.
Quoted 125 lines
Signed-off-by David Härdeman <[email protected]>--- drivers/media/dvb/dvb-usb/af9015.c | 22 ++++++---------------- drivers/media/rc/ir-nec-decoder.c | 28 ++++------------------------ include/media/rc-map.h | 11 +++++++++-- 3 files changed, 19 insertions(+), 42 deletions(-)drivers/media/dvb/dvb-usb/af9015.c +6
-16@@ -1034,7 +1034,8 @@ static int af9015_rc_query(struct dvb_usb_device *d)if ((priv->rc_repeat != buf[6 ] || buf[0 ]) && !memcmp (&buf[12 ], priv->rc_last,4 )) {deb_rc ("%s: key repeated\n" , __func__); -rc_keydown (d->rc_dev,RC_TYPE_NEC , priv->rc_keycode,0 ); +rc_keydown (d->rc_dev,RC_TYPE_NEC , +RC_SCANCODE_NEC32 (priv->rc_keycode),0 ); priv->rc_repeat = buf[6 ];return ret; }@@ -1051,21 +1052,10 @@ static int af9015_rc_query(struct dvb_usb_device *d)/* Remember this key */ memcpy (priv->rc_last, &buf[12 ],4 ); -if (buf[14 ] == (u8 ) ~buf[15 ]) { -if (buf[12 ] == (u8 ) ~buf[13 ]) { -/* NEC */ - priv->rc_keycode = buf[12 ] <<8 | buf[14 ]; - }else { -/* NEC extended*/ - priv->rc_keycode = buf[12 ] <<16 | - buf[13 ] <<8 | buf[14 ]; - } - }else { -/* 32 bit NEC */ - priv->rc_keycode = buf[12 ] <<24 | buf[13 ] <<16 | - buf[14 ] <<8 | buf[15 ]; - } -rc_keydown (d->rc_dev,RC_TYPE_NEC , priv->rc_keycode,0 ); + priv->rc_keycode = buf[12 ] <<24 | buf[13 ] <<16 | + buf[14 ] <<8 | buf[15 ]; +rc_keydown (d->rc_dev,RC_TYPE_NEC , +RC_SCANCODE_NEC32 (priv->rc_keycode),0 ); }else {deb_rc ("%s: no key press\n" , __func__);/* Invalidate last keypress */ drivers/media/rc/ir-nec-decoder.c +4
-24@@ -49,7 +49,6 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)struct nec_dec *data = &dev->raw->nec;u32 scancode;u8 address, not_address, command, not_command; -bool send_32bits = false;if (!(dev->enabled_protocols &RC_BIT_NEC ))return 0 ;@@ -162,33 +161,14 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) command =bitrev8 ((data->bits >>8 ) &0xff ); not_command =bitrev8 ((data->bits >>0 ) &0xff ); -if ((command ^ not_command) !=0xff ) { -IR_dprintk (1 ,"NEC checksum error: received 0x%08x\n" , - data->bits); - send_32bits = true; - } - -if (send_32bits) { -/* NEC transport, but modified protocol, used by at -* least Apple and TiVo remotes */ - scancode = data->bits; -IR_dprintk (1 ,"NEC (modified) scancode 0x%08x\n" , scancode); - }else if ((address ^ not_address) !=0xff ) { -/* Extended NEC */ - scancode = address <<16 | - not_address <<8 | - command; -IR_dprintk (1 ,"NEC (Ext) scancode 0x%06x\n" , scancode); - }else { -/* Normal NEC */ - scancode = address <<8 | command; -IR_dprintk (1 ,"NEC scancode 0x%04x\n" , scancode); - } + scancode = address <<24 | not_address <<16 | + command <<8 | not_command; +IR_dprintk (1 ,"NEC scancode 0x%08x\n" , scancode);if (data->is_nec_x) data->necx_repeat = true; -rc_keydown (dev,RC_TYPE_NEC , scancode,0 ); +rc_keydown (dev,RC_TYPE_NEC ,RC_SCANCODE_NEC32 (scancode),0 ); data->state =STATE_INACTIVE ;return 0 ; }include/media/rc-map.h +9
-3@@ -44,8 +44,15 @@#define RC_SCANCODE_UNKNOWN (x) (x)#define RC_SCANCODE_OTHER (x) (x) -#define RC_SCANCODE_NEC (addr, cmd) (((addr) << 8) | (cmd)) -#define RC_SCANCODE_NECX (addr, cmd) (((addr) << 8) | (cmd)) +#define RC_SCANCODE_NEC (addr, cmd) \ + ((( (addr) & 0xff) << 24) | \ + ((~(addr) & 0xff) << 16) | \ + (( (cmd) & 0xff) << 8 ) | \ + ((~(cmd) & 0xff) << 0 )) +#define RC_SCANCODE_NECX (addr, cmd) \ + ((( (addr) & 0xffff) << 16) | \ + (( (cmd) & 0x00ff) << 8) | \ + ((~(cmd) & 0x00ff) << 0))#define RC_SCANCODE_NEC32 (data) ((data) & 0xffffffff)#define RC_SCANCODE_RC5 (sys, cmd) (((sys) << 8) | (cmd))#define RC_SCANCODE_RC5_SZ (sys, cmd) (((sys) << 8) | (cmd)) --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] rc-core: merge rc5 and streamzap decoders
In reply to David HärdemanEm 28-04-2011 12:13, David Härdeman escreveu:
Quoted 5 lines
Now that the protocol is part of the scancode, it is pretty easy to merge the rc5 and streamzap decoders. An additional advantage is that the decoder is now stricter as it waits for the trailing silence before determining that a command is a valid rc5/streamzap command (which avoids collisions that I've seen with e.g. Sony protocols).
Makes sense for me.
(FYI, I probably won't be applying any patch after patch 6, due to dependency issues).
Quoted 416 lines
Signed-off-by David Härdeman <[email protected]>--- drivers/media/rc/Kconfig | 12 -- drivers/media/rc/Makefile | 1 drivers/media/rc/ir-rc5-decoder.c | 51 ++++++---- drivers/media/rc/ir-rc5-sz-decoder.c | 153 ------------------------------- drivers/media/rc/keymaps/rc-streamzap.c | 4 - drivers/media/rc/rc-core-priv.h | 8 -- drivers/media/rc/streamzap.c | 10 -- 7 files changed, 31 insertions(+), 208 deletions(-) delete mode 100644 drivers/media/rc/ir-rc5-sz-decoder.cdrivers/media/rc/Kconfig +0
-12@@ -75,18 +75,6 @@ config IR_SONY_DECODER Enable this option if you have an infrared remote control which uses the Sony protocol, and you need software decoding support. -config IR_RC5_SZ_DECODER - tristate "Enable IR raw decoder for the RC-5 (streamzap) protocol" - depends on RC_CORE - select BITREVERSE - default y - - ---help--- - Enable this option if you have IR with RC-5 (streamzap) protocol, - and if the IR is decoded in software. (The Streamzap PC Remote - uses an IR protocol that is almost standard RC-5, but not quite, - as it uses an additional bit). - config IR_LIRC_CODEC tristate "Enable IR to LIRC bridge" depends on RC_COREdrivers/media/rc/Makefile +0
-1@@ -9,7 +9,6 @@ obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o -obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o # stand-alone IR receivers/transmittersdrivers/media/rc/ir-rc5-decoder.c +29
-22@@ -1,6 +1,7 @@ -/* ir-rc5-decoder.c - handle RC5(x) IR Pulse/Space protocol +/* ir-rc5-decoder.c - decoder for RC5(x) and StreamZap protocols * * Copyright (C) 2010 by Mauro Carvalho Chehab <[email protected]> +* Copyright (C) 2010 by Jarod Wilson <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -13,22 +14,21 @@*/ /* -* This code handles 14 bits RC5 protocols and 20 bits RC5x protocols. -* There are other variants that use a different number of bits. -* This is currently unsupported. -* It considers a carrier of 36 kHz, with a total of 14/20 bits, where -* the first two bits are start bits, and a third one is a filing bit +* This decoder handles the 14 bit RC5 protocol, 15 bit "StreamZap" protocol +* and 20 bit RC5x protocol. */ #include "rc-core-priv.h" #define RC5_NBITS 14 +#define RC5_SZ_NBITS 15#define RC5X_NBITS 20#define CHECK_RC5X_NBITS 8#define RC5_UNIT 888888/* ns */ #define RC5_BIT_START (1 * RC5_UNIT)#define RC5_BIT_END (1 * RC5_UNIT)#define RC5X_SPACE (4 * RC5_UNIT) +#define RC5_TRAILER (10 * RC5_UNIT)/* In reality, approx 100 */ enum rc5_state {STATE_INACTIVE ,@@ -79,12 +79,15 @@ again: data->state =STATE_BIT_START ; data->count =1 ; -/* We just need enough bits to get to STATE_CHECK_RC5X */ - data->wanted_bits =RC5X_NBITS ;decrease_duration (&ev,RC5_BIT_START ); goto again;case STATE_BIT_START : +if (!ev.pulse &&geq_margin (ev.duration,RC5_TRAILER ,RC5_UNIT /2 )) { + data->state =STATE_FINISHED ; + goto again; + } +if (!eq_margin (ev.duration,RC5_BIT_START ,RC5_UNIT /2 ))break ;@@ -99,9 +102,7 @@ again:if (!is_transition (&ev, &dev->raw->prev_ev))break ; -if (data->count == data->wanted_bits) - data->state =STATE_FINISHED ; -else if (data->count ==CHECK_RC5X_NBITS ) +if (data->count ==CHECK_RC5X_NBITS ) data->state =STATE_CHECK_RC5X ;else data->state =STATE_BIT_START ;@@ -111,13 +112,10 @@ again:case STATE_CHECK_RC5X :if (!ev.pulse &&geq_margin (ev.duration,RC5X_SPACE ,RC5_UNIT /2 )) { -/* RC5X */ - data->wanted_bits =RC5X_NBITS ; + data->is_rc5x = true;decrease_duration (&ev,RC5X_SPACE ); - }else { -/* RC5 */ - data->wanted_bits =RC5_NBITS ; - } + }else + data->is_rc5x = false; data->state =STATE_BIT_START ; goto again;@@ -125,7 +123,7 @@ again:if (ev.pulse)break ; -if (data->wanted_bits ==RC5X_NBITS ) { +if (data->is_rc5x && data->count ==RC5X_NBITS ) {/* RC5X */ u8 xdata, command, system; xdata = (data->bits &0x0003F ) >>0 ;@@ -135,7 +133,7 @@ again: command += (data->bits &0x01000 ) ?0 :0x40 ; scancode = system <<16 | command <<8 | xdata; protocol =RC_TYPE_RC5X ; - }else { + }else if (!data->is_rc5x && data->count ==RC5_NBITS ) {/* RC5 */ u8 command, system; command = (data->bits &0x0003F ) >>0 ;@@ -144,10 +142,19 @@ again: command += (data->bits &0x01000 ) ?0 :0x40 ; scancode = system <<8 | command; protocol =RC_TYPE_RC5 ; - } + }else if (!data->is_rc5x && data->count ==RC5_SZ_NBITS ) { +/* RC5 StreamZap */ +u8 command, system; + command = (data->bits &0x0003F ) >>0 ; + system = (data->bits &0x02FC0 ) >>6 ; + toggle = (data->bits &0x01000 ) ?1 :0 ; + scancode = system <<6 | command; + protocol =RC_TYPE_RC5_SZ ; + }else +break ;if (dev->enabled_protocols & (1 << protocol)) { -IR_dprintk (1 ,"RC5(x) scancode 0x%06x (toggle: %u)\n" , +IR_dprintk (1 ,"RC5(x/sz) scancode 0x%06x (toggle: %u)\n" , scancode, toggle);rc_keydown (dev, protocol, scancode, toggle); }@@ -164,7 +171,7 @@ out: }static struct ir_raw_handler rc5_handler = { - .protocols =RC_BIT_RC5 |RC_BIT_RC5X , + .protocols =RC_BIT_RC5 |RC_BIT_RC5X |RC_BIT_RC5_SZ , .decode = ir_rc5_decode, };drivers/media/rc/ir-rc5-sz-decoder.c deleted +0
-153@@ -1,153 +0,0 @@ -/* ir-rc5-sz-decoder.c - handle RC5 Streamzap IR Pulse/Space protocol -* -* Copyright (C) 2010 by Mauro Carvalho Chehab <[email protected]> -* Copyright (C) 2010 by Jarod Wilson <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation version 2 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ - -/* -* This code handles the 15 bit RC5-ish protocol used by the Streamzap -* PC Remote. -* It considers a carrier of 36 kHz, with a total of 15 bits, where -* the first two bits are start bits, and a third one is a filing bit -*/ - -#include "rc-core-priv.h" - -#define RC5_SZ_NBITS 15 -#define RC5_UNIT 888888/* ns */ -#define RC5_BIT_START (1 * RC5_UNIT) -#define RC5_BIT_END (1 * RC5_UNIT) - -enum rc5_sz_state { -STATE_INACTIVE , -STATE_BIT_START , -STATE_BIT_END , -STATE_FINISHED , -}; - -/** -* ir_rc5_sz_decode() - Decode one RC-5 Streamzap pulse or space -* @dev: the struct rc_dev descriptor of the device -* @ev: the struct ir_raw_event descriptor of the pulse/space -* -* This function returns -EINVAL if the pulse violates the state machine -*/ -static int ir_rc5_sz_decode (struct rc_dev *dev,struct ir_raw_event ev) -{ -struct rc5_sz_dec *data = &dev->raw->rc5_sz; -u8 toggle, command, system; -u32 scancode; - -if (!(dev->enabled_protocols &RC_BIT_RC5_SZ )) -return 0 ; - -if (!is_timing_event (ev)) { -if (ev.reset) - data->state =STATE_INACTIVE ; -return 0 ; - } - -if (!geq_margin (ev.duration,RC5_UNIT ,RC5_UNIT /2 )) - goto out; - -again: -IR_dprintk (2 ,"RC5-sz decode started at state %i (%uus %s)\n" , - data->state,TO_US (ev.duration),TO_STR (ev.pulse)); - -if (!geq_margin (ev.duration,RC5_UNIT ,RC5_UNIT /2 )) -return 0 ; - -switch (data->state) { - -case STATE_INACTIVE : -if (!ev.pulse) -break ; - - data->state =STATE_BIT_START ; - data->count =1 ; - data->wanted_bits =RC5_SZ_NBITS ; -decrease_duration (&ev,RC5_BIT_START ); - goto again; - -case STATE_BIT_START : -if (!eq_margin (ev.duration,RC5_BIT_START ,RC5_UNIT /2 )) -break ; - - data->bits <<=1 ; -if (!ev.pulse) - data->bits |=1 ; - data->count++; - data->state =STATE_BIT_END ; -return 0 ; - -case STATE_BIT_END : -if (!is_transition (&ev, &dev->raw->prev_ev)) -break ; - -if (data->count == data->wanted_bits) - data->state =STATE_FINISHED ; -else - data->state =STATE_BIT_START ; - -decrease_duration (&ev,RC5_BIT_END ); - goto again; - -case STATE_FINISHED : -if (ev.pulse) -break ; - -/* RC5-sz */ - command = (data->bits &0x0003F ) >>0 ; - system = (data->bits &0x02FC0 ) >>6 ; - toggle = (data->bits &0x01000 ) ?1 :0 ; - scancode = system <<6 | command; - -IR_dprintk (1 ,"RC5-sz scancode 0x%04x (toggle: %u)\n" , - scancode, toggle); - -rc_keydown (dev,RC_TYPE_RC5_SZ , scancode, toggle); - data->state =STATE_INACTIVE ; -return 0 ; - } - -out: -IR_dprintk (1 ,"RC5-sz decode failed at state %i (%uus %s)\n" , - data->state,TO_US (ev.duration),TO_STR (ev.pulse)); - data->state =STATE_INACTIVE ; -return -EINVAL ; -} - -static struct ir_raw_handler rc5_sz_handler = { - .protocols =RC_BIT_RC5_SZ , - .decode = ir_rc5_sz_decode, -}; - -static int __init ir_rc5_sz_decode_init (void ) -{ -ir_raw_handler_register (&rc5_sz_handler); - -printk (KERN_INFO "IR RC5 (streamzap) protocol handler initialized\n" ); -return 0 ; -} - -static void __exit ir_rc5_sz_decode_exit(void) -{ -ir_raw_handler_unregister (&rc5_sz_handler); -} - -module_init (ir_rc5_sz_decode_init); -module_exit (ir_rc5_sz_decode_exit); - -MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Jarod Wilson <[email protected]>" ); -MODULE_AUTHOR ("Red Hat Inc. (http://www.redhat.com)" ); -MODULE_DESCRIPTION ("RC5 (streamzap) IR protocol decoder" );drivers/media/rc/keymaps/rc-streamzap.c +1
-3@@ -14,9 +14,7 @@static struct rc_map_table streamzap[] = {/* * The Streamzap remote is almost, but not quite, RC-5, as it has an extra -* bit in it, which throws the in-kernel RC-5 decoder for a loop. Currently, -* an additional RC-5-sz decoder is being deployed to support it, but it -* may be possible to merge it back with the standard RC-5 decoder. +* bit in it. */ {RC_TYPE_RC5_SZ ,RC_SCANCODE_RC5_SZ (0x28 ,0xc0 ),KEY_NUMERIC_0 }, {RC_TYPE_RC5_SZ ,RC_SCANCODE_RC5_SZ (0x28 ,0xc1 ),KEY_NUMERIC_1 },drivers/media/rc/rc-core-priv.h +1
-7@@ -54,7 +54,7 @@ struct ir_raw_event_ctrl {int state;u32 bits;unsigned count; -unsigned wanted_bits; +bool is_rc5x; } rc5;struct rc6_dec {int state;@@ -77,12 +77,6 @@ struct ir_raw_event_ctrl {bool first;bool toggle; } jvc; -struct rc5_sz_dec { -int state; -u32 bits; -unsigned count; -unsigned wanted_bits; - } rc5_sz;struct lirc_codec {struct rc_dev *dev;struct lirc_driver *drv;drivers/media/rc/streamzap.c +0
-11@@ -69,13 +69,6 @@ MODULE_DEVICE_TABLE(usb, streamzap_table);/* number of samples buffered */ #define SZ_BUF_LEN 128 -/* from ir-rc5-sz-decoder.c */ -#ifdef CONFIG_IR_RC5_SZ_DECODER_MODULE -#define load_rc5_sz_decode () request_module("ir-rc5-sz-decoder") -#else -#define load_rc5_sz_decode () {} -#endif -enum StreamzapDecoderState { PulseSpace, FullPulse,@@ -458,9 +451,6 @@ static int __devinit streamzap_probe(struct usb_interface *intf,dev_info (sz->dev,"Registered %s on usb%d:%d\n" , name, usbdev->bus->busnum, usbdev->devnum); -/* Load the streamzap not-quite-rc5 decoder too */ -load_rc5_sz_decode (); -return 0 ; rc_dev_fail: --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/10] rc-core: lirc use unsigned int
In reply to David HärdemanEm 28-04-2011 12:13, David Härdeman escreveu:
Quoted 3 lines
Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API.
Patch looked ok to me (except for one small issue - see bellow).
Quoted 21 lines
Signed-off-by David Härdeman <[email protected]>--- drivers/media/rc/ene_ir.c | 4 ++-- drivers/media/rc/ene_ir.h | 2 +- drivers/media/rc/ir-lirc-codec.c | 15 +++++++++------ drivers/media/rc/ite-cir.c | 5 +---- drivers/media/rc/mceusb.c | 10 ++++------ drivers/media/rc/nuvoton-cir.c | 12 +++--------- drivers/media/rc/rc-loopback.c | 13 +++---------- drivers/media/rc/winbond-cir.c | 6 +----- include/media/rc-core.h | 2 +- 9 files changed, 25 insertions(+), 44 deletions(-)drivers/media/rc/ene_ir.c +0
-0@@ -953,13 +953,13 @@ static void ene_set_idle(struct rc_dev *rdev, bool idle) }
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev, bool idle) · line 962
Quoted 10 lines
drivers/media/rc/ene_ir.c +2
-2/* outside interface: transmit */ -static int ene_transmit (struct rc_dev *rdev,int *buf,u32 n) +static int ene_transmit (struct rc_dev *rdev,unsigned *buf,unsigned n) {struct ene_device *dev = rdev->priv;unsigned long flags; dev->tx_buffer = buf; - dev->tx_len = n /sizeof (int ); + dev->tx_len = n;
That hunk seems wrong to me. Or is it a bug fix that you're solving?
Quoted 234 lines
drivers/media/rc/ene_ir.c +0
-0dev->tx_pos =0 ; dev->tx_reg =0 ; dev->tx_done =0 ;drivers/media/rc/ene_ir.h +1
-1@@ -235,7 +235,7 @@ struct ene_device {bool tx_sample_pulse;/* current sample is pulse */ /* TX buffer */ -int *tx_buffer;/* input samples buffer*/ +unsigned *tx_buffer;/* input samples buffer*/ int tx_pos;/* position in that bufer */ int tx_len;/* current len of tx buffer */ int tx_done;/* done transmitting */ drivers/media/rc/ir-lirc-codec.c +9
-6@@ -103,19 +103,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, {struct lirc_codec *lirc;struct rc_dev *dev; -int *txbuf;/* buffer with values to transmit */ -int ret =0 ; +unsigned int *txbuf;/* buffer with values to transmit */ +ssize_t ret =0 ;size_t count; lirc =lirc_get_pdata (file);if (!lirc)return -EFAULT ; -if (n %sizeof (int )) +if (n <sizeof (unsigned ) || n %sizeof (unsigned ))return -EINVAL ; - count = n /sizeof (int ); -if (count >LIRCBUF_SIZE || count %2 ==0 || n %sizeof (int ) !=0 ) + count = n /sizeof (unsigned ); +if (count >LIRCBUF_SIZE || count %2 ==0 )return -EINVAL ; txbuf =memdup_user (buf, n);@@ -129,7 +129,10 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, }if (dev->tx_ir) - ret = dev->tx_ir (dev, txbuf, (u32 )n); + ret = dev->tx_ir (dev, txbuf, count); + +if (ret >0 ) + ret *=sizeof (unsigned ); out:kfree (txbuf);drivers/media/rc/ite-cir.c +1
-4@@ -381,7 +381,7 @@ static int ite_set_tx_duty_cycle(struct rc_dev *rcdev, u32 duty_cycle)/* transmit out IR pulses; what you get here is a batch of alternating * pulse/space/pulse/space lengths that we should write out completely through * the FIFO, blocking on a full FIFO */ -static int ite_tx_ir (struct rc_dev *rcdev,int *txbuf,u32 n) +static int ite_tx_ir (struct rc_dev *rcdev,unsigned *txbuf,unsigned n) {unsigned long flags;struct ite_dev *dev = rcdev->priv;@@ -397,9 +397,6 @@ static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n)/* clear the array just in case */ memset (last_sent,0 ,ARRAY_SIZE (last_sent)); -/* n comes in bytes; convert to ints */ - n /=sizeof (int ); -spin_lock_irqsave (&dev->lock, flags);/* let everybody know we're now transmitting */ drivers/media/rc/mceusb.c +4
-6@@ -665,20 +665,18 @@ static void mce_sync_in(struct mceusb_dev *ir, unsigned char *data, int size) }/* Send data out the IR blaster port(s) */ -static int mceusb_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int mceusb_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned count) {struct mceusb_dev *ir = dev->priv;int i, ret =0 ; -int count, cmdcount =0 ; +int cmdcount =0 ;unsigned char *cmdbuf;/* MCE command buffer */ long signal_duration =0 ;/* Singnal length in us */ struct timeval start_time, end_time;do_gettimeofday (&start_time); - count = n /sizeof (int ); - - cmdbuf =kzalloc (sizeof (int ) *MCE_CMDBUF_SIZE ,GFP_KERNEL ); + cmdbuf =kzalloc (sizeof (unsigned ) *MCE_CMDBUF_SIZE ,GFP_KERNEL );if (!cmdbuf)return -ENOMEM ;@@ -747,7 +745,7 @@ static int mceusb_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) out:kfree (cmdbuf); -return ret ? ret : n; +return ret ? ret : count; }/* Sets active IR outputs -- mce devices typically have two */ drivers/media/rc/nuvoton-cir.c +3
-9@@ -512,24 +512,18 @@ static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier)* number may larger than TXFCONT (0xff). So in interrupt_handler, it has to * set TXFCONT as 0xff, until buf_count less than 0xff. */ -static int nvt_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int nvt_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned n) {struct nvt_dev *nvt = dev->priv;unsigned long flags; -size_t cur_count;unsigned int i;u8 iren;int ret;spin_lock_irqsave (&nvt->tx.lock, flags); -if (n >=TX_BUF_LEN ) { - nvt->tx.buf_count = cur_count =TX_BUF_LEN ; - ret =TX_BUF_LEN ; - }else { - nvt->tx.buf_count = cur_count = n; - ret = n; - } + ret =min ((unsigned )(TX_BUF_LEN /sizeof (unsigned )), n); + nvt->tx.buf_count = (ret *sizeof (unsigned ));memcpy (nvt->tx.buf, txbuf, nvt->tx.buf_count);drivers/media/rc/rc-loopback.c +3
-10@@ -101,21 +101,14 @@ static int loop_set_rx_carrier_range(struct rc_dev *dev, u32 min, u32 max)return 0 ; } -static int loop_tx_ir (struct rc_dev *dev,int *txbuf,u32 n) +static int loop_tx_ir (struct rc_dev *dev,unsigned *txbuf,unsigned count) {struct loopback_dev *lodev = dev->priv;u32 rxmask; -unsigned count;unsigned total_duration =0 ;unsigned i;DEFINE_IR_RAW_EVENT (rawir); -if (n ==0 || n %sizeof (int )) { -dprintk ("invalid tx buffer size\n" ); -return -EINVAL ; - } - - count = n /sizeof (int );for (i =0 ; i < count; i++) total_duration +=abs (txbuf[i]);@@ -142,7 +135,7 @@ static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n)for (i =0 ; i < count; i++) { rawir.pulse = i %2 ? false : true; - rawir.duration =abs (txbuf[i]) *1000 ; + rawir.duration = txbuf[i] *1000 ;if (rawir.duration)ir_raw_event_store_with_filter (dev, &rawir); }@@ -158,7 +151,7 @@ out:/* Lirc expects this function to take as long as the total duration */ set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (usecs_to_jiffies (total_duration)); -return n; +return count; }static void loop_set_idle (struct rc_dev *dev,bool enable)drivers/media/rc/winbond-cir.c +1
-5@@ -577,16 +577,12 @@ wbcir_txmask(struct rc_dev *dev, u32 mask) }static int -wbcir_tx (struct rc_dev *dev,int *buf,u32 bufsize) +wbcir_tx (struct rc_dev *dev,unsigned *buf,unsigned count) {struct wbcir_data *data = dev->priv; -u32 count;unsigned i;unsigned long flags; -/* bufsize has been sanity checked by the caller */ - count = bufsize /sizeof (int ); -/* Not sure if this is possible, but better safe than sorry */ spin_lock_irqsave (&data->spinlock, flags);if (data->txstate !=WBCIR_TXSTATE_INACTIVE ) {include/media/rc-core.h +1
-2@@ -134,7 +134,7 @@ struct rc_dev {int (*s_tx_carrier)(struct rc_dev *dev,u32 carrier);int (*s_tx_duty_cycle)(struct rc_dev *dev,u32 duty_cycle);int (*s_rx_carrier_range)(struct rc_dev *dev,u32 min,u32 max); -int (*tx_ir)(struct rc_dev *dev,int *txbuf,u32 n); +int (*tx_ir)(struct rc_dev *dev,unsigned *txbuf,unsigned n);void (*s_idle)(struct rc_dev *dev,bool enable);int (*s_learning_mode)(struct rc_dev *dev,int enable);int (*s_carrier_report) (struct rc_dev *dev,int enable); --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Härdeman
maintainerRe: [PATCH 09/10] rc-core: lirc use unsigned int
Quoted 7 lines · Mauro Carvalho Chehab
Em 28-04-2011 12:13, David Härdeman escreveu:
Quoted 3 lines
Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API.
Patch looked ok to me (except for one small issue - see bellow).
...
Quoted 5 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev,
Quoted 5 lines
drivers/media/rc/ene_ir.c +0
-0@@ -953,13 +953,13 @@ static void ene_set_idle(struct rc_dev *rdev,
bool
Quoted 6 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev, bool idle)
Quoted 6 lines
drivers/media/rc/ene_ir.c +1
-1idle) }/* outside interface: transmit */ -static int ene_transmit (struct rc_dev *rdev,int *buf,u32 n) +static int ene_transmit(struct rc_dev *rdev, unsigned *buf, unsigned
n)
Quoted 9 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev, bool idle) · line 962
Quoted 7 lines
drivers/media/rc/ene_ir.c +1
-1{struct ene_device *dev = rdev->priv;unsigned long flags; dev->tx_buffer = buf; - dev->tx_len = n /sizeof (int ); + dev->tx_len = n;That hunk seems wrong to me. Or is it a bug fix that you're solving?
My fault, I didn't mention in the patch description that the third argument of the tx function is also changed to mean array size rather than size in number of bytes.
Signature · 1 line
David Härdeman
David Härdeman
maintainerRe: [PATCH 07/10] rc-core: use the full 32 bits for NEC scancodes
In reply to Mauro Carvalho ChehabQuoted 2 lines · Mauro Carvalho Chehab
Em 28-04-2011 12:13, David Härdeman escreveu:
Quoted 1 line
Using the full 32 bits for all kinds of NEC scancodes simplifies
rc-core
Quoted 5 lines
Quoted 1 line
and the nec decoder without any loss of functionality.
This seems to be a good strategy. However, it breaks the existing NEC keymap tables (/me is not considering patch 6/10 macros), and changes those keytables on userspace. Not sure how to address this.
The in-kernel keymaps is not a problem, they can always be updated in the same patch. Keytables provided from userspace are a bigger problem.
Perhaps we could check if the set/get ioctl is done with the new rc-specific
struct (that includes protocol) and assume that the scancode will be in nec32
if the protocol has been explicitly provided.
This might seem like we're adding a lot of guesswork into rc-core, but I think
we should/could phase out the use of legacy ioctls over a couple of kernel versions and the heuristics can then be removed at the same time.
Signature · 1 line
David Härdeman
David Härdeman
maintainerQuoted 11 lines · Mauro Carvalho Chehab
Em 29-04-2011 05:08, David Härdeman escreveu:
Quoted 10 lines
drivers/media/rc/keymaps/rc-videomate-s350.c +0
-1@@ -13,57 +13,56 @@#include <media/rc-map.h> static struct rc_map_table videomate_s350[] = { - {0x00 ,KEY_TV },
...
Quoted 4 lines
drivers/media/rc/keymaps/rc-videomate-s350.c
Quoted 2 lines
drivers/media/rc/keymaps/rc-videomate-s350.c +1
-0+ { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x00), KEY_TV}, };However, changes like the above makes the keymaps confusing and breaks
the
Quoted 1 line
v4l-utils sync scripts without a good reason.
First of all, I've missed that there are v4l-utils sync scripts.
Second of all, I think you can ignore this patch for now. It's actually a much better idea to keep the rc_map and rc_map_table structs the way they are (thereby reducing the patch size) and introduce new structs to be used in rc_dev for maintaining the actual live keytable (and store the protocol for each scancode in the new struct instead).
That way drivers/media/rc/keymaps/ won't see so much churn.
Signature · 1 line
David Härdeman
David Härdeman
maintainerRe: [PATCH 08/10] rc-core: merge rc5 and streamzap decoders
In reply to Mauro Carvalho ChehabQuoted 2 lines · Mauro Carvalho Chehab
Em 28-04-2011 12:13, David Härdeman escreveu:
Quoted 1 line
Now that the protocol is part of the scancode, it is pretty easy to
merge
Quoted 5 lines
Quoted 5 lines
the rc5 and streamzap decoders. An additional advantage is that the decoder
is now stricter as it waits for the trailing silence before determining that
a command is a valid rc5/streamzap command (which avoids collisions
that
Quoted 7 lines
Quoted 2 lines
I've
seen with e.g. Sony protocols).Makes sense for me.
(FYI, I probably won't be applying any patch after patch 6, due to dependency issues).
Feel free to ignore it for now, I'll include it in a refreshed patchset.
Signature · 1 line
David Härdeman
David Härdeman
maintainerRe: [PATCH 05/10] rc-core: add separate defines for protocol bitmaps and numbers
In reply to Mauro Carvalho ChehabQuoted 2 lines · Mauro Carvalho Chehab
Em 28-04-2011 12:13, David Härdeman escreveu:
Quoted 1 line
The RC_TYPE_* defines are currently used both where a single protocol
is
Quoted 50 lines
Quoted 4 lines
expected and where a bitmap of protocols is expected. This patch tries to separate the two in preparation for the following patches.
Signed-off-by David Härdeman <[email protected]>Most of the patch is just renaming stuff. So, I'm commenting just the
rc-main.c/rc-map.hchanges.Quoted 27 lines
drivers/media/rc/rc-main.c +3
-9@@ -102,7 +102,7 @@ static struct rc_map_list empty_map = { .map = { .scan = empty, .size = ARRAY_SIZE(empty), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_BIT_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EMPTY, } };@@ -725,14 +725,17 @@ static struct {u64 type;char *name; } proto_names[] = { - { RC_TYPE_UNKNOWN, "unknown" }, - { RC_TYPE_RC5, "rc-5" }, - { RC_TYPE_NEC, "nec" }, - { RC_TYPE_RC6, "rc-6" }, - { RC_TYPE_JVC, "jvc" }, - { RC_TYPE_SONY, "sony" }, - { RC_TYPE_RC5_SZ, "rc-5-sz" }, - { RC_TYPE_LIRC, "lirc" }, + { RC_BIT_OTHER, "other" }, + { RC_BIT_RC5, "rc-5" },drivers/media/rc/rc-main.c static struct { · line 739
Quoted 10 lines
drivers/media/rc/rc-main.c +9
-0+ { RC_BIT_RC5X, "rc-5-x" }, + { RC_BIT_RC5_SZ, "rc-5-sz" }, + { RC_BIT_RC6, "rc-6" }, + { RC_BIT_JVC, "jvc" }, + { RC_BIT_SONY12, "sony12" }, + { RC_BIT_SONY15, "sony15" }, + { RC_BIT_SONY20, "sony20" }, + { RC_BIT_NEC, "nec" }, + { RC_BIT_LIRC, "lirc" }, };There are some API breakages on the above. We shouln't do it, except if strictly required, and, if we'll do it, we need to do it via
Documentation/feature-removal-schedule.txt.
Quoted 2 lines
There are two types of breakages on the above:
1) the removal of "unknown" and "sony" types;
We could just keep "unknown" and (optionally) also map "other" to it.
Quoted 2 lines
2) the behaviour change of "rc-5" (that, currently, means
both rc-5 and rc-5x.
That's a change but I don't think it'll actually break user-space since "rc-5" will still be accepted.
Quoted 1 line
Also, while you've mapped rc5/sony variants, nec variants weren't
mapped.
"nec" needs no mapping with the nec 32-bit scancode change.
Quoted 8 lines
IMO, what we should do on the above is:
1) preserve the "unknown";2) use "rc-5", "sony", "nec" with the meaning that they will
enable all variants of those protocols;3) add a new set of protocols to indicate subsets, like "sony:20",
"rc-5:normal", "rc5:x", etc.
I can look into it...
Quoted 2 lines
4) if you're changing the interface, please submit a patch also
to v4l-utils, adding a logic there to handle the changes.
I'll look into it when redoing the patches.
Quoted 20 lines
Quoted 19 lines
drivers/media/rc/rc-main.c +0
-0#define PROTO_NONE "none"include/media/rc-map.h +0
-9@@ -11,19 +11,36 @@#include <linux/input.h> -#define RC_TYPE_UNKNOWN 0 -#define RC_TYPE_RC5 (1 << 0)/* Philips RC5 protocol */ -#define RC_TYPE_NEC (1 << 1) -#define RC_TYPE_RC6 (1 << 2)/* Philips RC6 protocol */ -#define RC_TYPE_JVC (1 << 3)/* JVC protocol */ -#define RC_TYPE_SONY (1 << 4)/* Sony12/15/20 protocol */ -#define RC_TYPE_RC5_SZ (1 << 5)/* RC5 variant used by Streamzap */ -#define RC_TYPE_LIRC (1 << 30)/* Pass raw IR to lirc userspace */ -#define RC_TYPE_OTHER (1u << 31)
Quoted 5 lines
include/media/rc-map.h line 15
Quoted 2 lines
include/media/rc-map.h +2
-0+#define RC_TYPE_UNKNOWN 0/* Protocol not known */ +#define RC_TYPE_OTHER 0/* Protocol known but proprietary */ This change doesn't make sense: we should either remove other or use different bits for different meanings.
I think that it's not necessary. Unknown and other have a meaningful difference to the programmer but not from a code point of view. Both mean that whatever scancode we get, we have to accept as-is and we don't know anything about it.
For e.g. a RC5 scancode we could (though we're not doing it yet) do sanity-checks on the scancode and set a proper timeout value based on protocol characteristics. With other and unknown we can't.
That's the reason I merged them - we can't do anything meaningful with the difference from a code point of view and long term "unknown" should die (might not happen but...).
Quoted 23 lines
This is somewhat a mess currently, as there
are, in
fact, 3 types of "protocols":
1) reverse-engineered drivers, where developer didn't care to check what was the used protocol. It is there due to legacy IR handlers, added before rc-core. The better is to not accept this type anymore for new devices;
2) Other protocols that don't match at the list of supported protocols. Reserved for the cases were the developer took the care to check if the protocol is not NEC/RC-5/... and didn't find any protocol that matches;
3) Standard protocols with broken hardware. In general, keycode tables with just 8 bits for RC-5 or NEC, because the hardware uses a cheap uC (generally KS007 or similar) that only decodes the last 8 bits of the protocol. As the developer didn't have a full IR decoder, he was not able to fill the RC/NEC table with the IR address.The problem with (2) is that it may reflect a temporary state where the protocol
is not yet known. After adding a protocol decoder for it, case (2) turns into
case (1).
Quoted 5 lines
So, maybe we can just merge (1) and (2) into the same case: "unknown". Maybe we
should map (3) with a different option, internally (even exporting it as "unknown"
to userspace), as it helps us to identify such cases and fix it later.
I think we should keep the distinction internal.
Signature · 1 line
David Härdeman
Re: [PATCH 09/10] rc-core: lirc use unsigned int
In reply to David HärdemanEm 06-05-2011 06:46, David Härdeman escreveu:
Quoted 33 lines
Quoted 7 lines · Mauro Carvalho Chehab
Em 28-04-2011 12:13, David Härdeman escreveu:
Quoted 3 lines
Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API.
Patch looked ok to me (except for one small issue - see bellow).
...
Quoted 5 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev,
Quoted 5 lines
drivers/media/rc/ene_ir.c +0
-0@@ -953,13 +953,13 @@ static void ene_set_idle(struct rc_dev *rdev,bool
Quoted 6 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev, bool idle)
Quoted 6 lines
drivers/media/rc/ene_ir.c +1
-1idle) }/* outside interface: transmit */ -static int ene_transmit (struct rc_dev *rdev,int *buf,u32 n) +static int ene_transmit(struct rc_dev *rdev, unsigned *buf, unsignedn)
Quoted 9 lines
drivers/media/rc/ene_ir.c static void ene_set_idle(struct rc_dev *rdev, bool idle) · line 962
Quoted 7 lines
drivers/media/rc/ene_ir.c +1
-1{struct ene_device *dev = rdev->priv;unsigned long flags; dev->tx_buffer = buf; - dev->tx_len = n /sizeof (int ); + dev->tx_len = n;That hunk seems wrong to me. Or is it a bug fix that you're solving?
Quoted 3 lines
My fault, I didn't mention in the patch description that the third argument of the tx function is also changed to mean array size rather than size in number of bytes.
Sorry for the long delay. Got sidetracked with other things.
Patch applied.
Thanks,
Mauro
Re: [PATCH 10/10] rc-core: move timeout and checks to lirc
In reply to David HärdemanEm 28-04-2011 12:14, David Härdeman escreveu:
Quoted 10 lines
The lirc TX functionality expects the process which writes (TX) data to the lirc dev to sleep until the actual data has been transmitted by the hardware.
Since the same timeout calculation is duplicated in more than one driver (and would have to be duplicated in even more drivers as they gain TX support), it makes sense to move this timeout calculation to the lirc layer instead.
At the same time, centralize some of the sanity checks.
This patch[1] were never applied, nor I'm seeing any comments about it at the ML.
Jarod,
would you care to review it?
Thanks,
Mauro
[1] http://patchwork.linuxtv.org/patch/6468/
Quoted 141 lines
Signed-off-by David Härdeman <[email protected]>--- drivers/media/rc/ir-lirc-codec.c | 33 +++++++++++++++++++++++++++++---- drivers/media/rc/mceusb.c | 18 ------------------ drivers/media/rc/rc-loopback.c | 12 ------------ 3 files changed, 29 insertions(+), 34 deletions(-)drivers/media/rc/ir-lirc-codec.c +29
-4@@ -106,6 +106,12 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,unsigned int *txbuf;/* buffer with values to transmit */ ssize_t ret =0 ;size_t count; +ktime_t start; +s64 towait; +unsigned int duration =0 ;/* signal duration in us */ +int i; + + start =ktime_get (); lirc =lirc_get_pdata (file);if (!lirc)@@ -128,11 +134,30 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, goto out; } -if (dev->tx_ir) - ret = dev->tx_ir (dev, txbuf, count); +if (!dev->tx_ir) { + ret = -ENOSYS ; + goto out; + } + + ret = dev->tx_ir (dev, txbuf, (u32 )n); +if (ret <0 ) + goto out; + +for (i =0 ; i < ret; i++) + duration += txbuf[i]; -if (ret >0 ) - ret *=sizeof (unsigned ); + ret *=sizeof (unsigned int ); + +/* +* The lircd gap calculation expects the write function to +* wait for the actual IR signal to be transmitted before +* returning. +*/ + towait =ktime_us_delta (ktime_add_us (start, duration),ktime_get ()); +if (towait >0 ) { +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (usecs_to_jiffies (towait)); + } out:kfree (txbuf);drivers/media/rc/mceusb.c +0
-18@@ -671,10 +671,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)int i, ret =0 ;int cmdcount =0 ;unsigned char *cmdbuf;/* MCE command buffer */ -long signal_duration =0 ;/* Singnal length in us */ -struct timeval start_time, end_time; - -do_gettimeofday (&start_time); cmdbuf =kzalloc (sizeof (unsigned ) *MCE_CMDBUF_SIZE ,GFP_KERNEL );if (!cmdbuf)@@ -687,7 +683,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)/* Generate mce packet data */ for (i =0 ; (i < count) && (cmdcount <MCE_CMDBUF_SIZE ); i++) { - signal_duration += txbuf[i]; txbuf[i] = txbuf[i] /MCE_TIME_UNIT ; do { /* loop to support long pulses/spaces > 127*50us=6.35ms */@@ -730,19 +725,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)/* Transmit the command to the mce device */ mce_async_out (ir, cmdbuf, cmdcount); -/* -* The lircd gap calculation expects the write function to -* wait the time it takes for the ircommand to be sent before -* it returns. -*/ -do_gettimeofday (&end_time); - signal_duration -= (end_time.tv_usec - start_time.tv_usec) + - (end_time.tv_sec - start_time.tv_sec) *1000000 ; - -/* delay with the closest number of ticks */ -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (usecs_to_jiffies (signal_duration)); - out:kfree (cmdbuf);return ret ? ret : count;drivers/media/rc/rc-loopback.c +0
-13@@ -105,18 +105,9 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) {struct loopback_dev *lodev = dev->priv;u32 rxmask; -unsigned total_duration =0 ;unsigned i;DEFINE_IR_RAW_EVENT (rawir); -for (i =0 ; i < count; i++) - total_duration +=abs (txbuf[i]); - -if (total_duration ==0 ) { -dprintk ("invalid tx data, total duration zero\n" ); -return -EINVAL ; - } -if (lodev->txcarrier < lodev->rxcarriermin || lodev->txcarrier > lodev->rxcarriermax) {dprintk ("ignoring tx, carrier out of range\n" );@@ -148,9 +139,6 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)ir_raw_event_handle (dev); out: -/* Lirc expects this function to take as long as the total duration */ -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (usecs_to_jiffies (total_duration));return count; } --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html