[media] mceusb: fix inverted mask inversion logic

As it turns out, somewhere along the way, we managed to invert the
meaning of the tx_mask_inverted flag. Looking back over the old lirc
driver, tx_mask_inverted was set to 0 if the device was in tx_mask_list.
Now we have a tx_mask_inverted flag set to 1 for all the devices that
were in the list, and set tx_mask_inverted to that flag value, which is
actually the opposite of what we used to set, causing set_tx_mask to use
the wrong mask setting option. Since there seem to be more devices with
inverted masks than not (using the original device as the baseline for
inverted vs. normal), lets just call the ones currently marked as
inverted normal instead, and flip the if/else actions that key off of
the inverted flag.

Note: the problem only cropped up if a call to set_tx_mask was made, if
no mask was set, the device would work just fine, which is why this
managed to slip though w/o getting noticed until now.

Tested successfully by myself and Dennis Gilmore.

Reported-by: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by Jarod Wilson and committed by Mauro Carvalho Chehab d8cc7fd7 fbb1f1b0

+11 -11
+11 -11
drivers/media/IR/mceusb.c
··· 156 u32 mce_gen1:1; 157 u32 mce_gen2:1; 158 u32 mce_gen3:1; 159 - u32 tx_mask_inverted:1; 160 u32 is_polaris:1; 161 u32 no_tx:1; 162 ··· 167 static const struct mceusb_model mceusb_model[] = { 168 [MCE_GEN1] = { 169 .mce_gen1 = 1, 170 - .tx_mask_inverted = 1, 171 }, 172 [MCE_GEN2] = { 173 .mce_gen2 = 1, 174 }, 175 [MCE_GEN2_TX_INV] = { 176 .mce_gen2 = 1, 177 - .tx_mask_inverted = 1, 178 }, 179 [MCE_GEN3] = { 180 .mce_gen3 = 1, 181 - .tx_mask_inverted = 1, 182 }, 183 [POLARIS_EVK] = { 184 .is_polaris = 1, ··· 350 351 struct { 352 u32 connected:1; 353 - u32 tx_mask_inverted:1; 354 u32 microsoft_gen1:1; 355 u32 no_tx:1; 356 } flags; ··· 753 { 754 struct mceusb_dev *ir = priv; 755 756 - if (ir->flags.tx_mask_inverted) 757 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? 758 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; 759 - else 760 - ir->tx_mask = mask; 761 762 return 0; 763 } ··· 1117 enum mceusb_model_type model = id->driver_info; 1118 bool is_gen3; 1119 bool is_microsoft_gen1; 1120 - bool tx_mask_inverted; 1121 bool is_polaris; 1122 1123 dev_dbg(&intf->dev, "%s called\n", __func__); ··· 1126 1127 is_gen3 = mceusb_model[model].mce_gen3; 1128 is_microsoft_gen1 = mceusb_model[model].mce_gen1; 1129 - tx_mask_inverted = mceusb_model[model].tx_mask_inverted; 1130 is_polaris = mceusb_model[model].is_polaris; 1131 1132 if (is_polaris) { ··· 1193 ir->dev = &intf->dev; 1194 ir->len_in = maxp; 1195 ir->flags.microsoft_gen1 = is_microsoft_gen1; 1196 - ir->flags.tx_mask_inverted = tx_mask_inverted; 1197 ir->flags.no_tx = mceusb_model[model].no_tx; 1198 ir->model = model; 1199
··· 156 u32 mce_gen1:1; 157 u32 mce_gen2:1; 158 u32 mce_gen3:1; 159 + u32 tx_mask_normal:1; 160 u32 is_polaris:1; 161 u32 no_tx:1; 162 ··· 167 static const struct mceusb_model mceusb_model[] = { 168 [MCE_GEN1] = { 169 .mce_gen1 = 1, 170 + .tx_mask_normal = 1, 171 }, 172 [MCE_GEN2] = { 173 .mce_gen2 = 1, 174 }, 175 [MCE_GEN2_TX_INV] = { 176 .mce_gen2 = 1, 177 + .tx_mask_normal = 1, 178 }, 179 [MCE_GEN3] = { 180 .mce_gen3 = 1, 181 + .tx_mask_normal = 1, 182 }, 183 [POLARIS_EVK] = { 184 .is_polaris = 1, ··· 350 351 struct { 352 u32 connected:1; 353 + u32 tx_mask_normal:1; 354 u32 microsoft_gen1:1; 355 u32 no_tx:1; 356 } flags; ··· 753 { 754 struct mceusb_dev *ir = priv; 755 756 + if (ir->flags.tx_mask_normal) 757 + ir->tx_mask = mask; 758 + else 759 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? 760 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; 761 762 return 0; 763 } ··· 1117 enum mceusb_model_type model = id->driver_info; 1118 bool is_gen3; 1119 bool is_microsoft_gen1; 1120 + bool tx_mask_normal; 1121 bool is_polaris; 1122 1123 dev_dbg(&intf->dev, "%s called\n", __func__); ··· 1126 1127 is_gen3 = mceusb_model[model].mce_gen3; 1128 is_microsoft_gen1 = mceusb_model[model].mce_gen1; 1129 + tx_mask_normal = mceusb_model[model].tx_mask_normal; 1130 is_polaris = mceusb_model[model].is_polaris; 1131 1132 if (is_polaris) { ··· 1193 ir->dev = &intf->dev; 1194 ir->len_in = maxp; 1195 ir->flags.microsoft_gen1 = is_microsoft_gen1; 1196 + ir->flags.tx_mask_normal = tx_mask_normal; 1197 ir->flags.no_tx = mceusb_model[model].no_tx; 1198 ir->model = model; 1199