Skip to contentSkip to conversation

imon IR driver fixups

PATCH New Jarod Wilson 1 participant 4 messages Oct 23, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover imon IR driver fixups

Three minor imon IR driver fixups. Well, the first isn't so minor, since without it, the imon driver can wedge your system. Getting ir_input_dev (or at least try to get it) from the mouse input dev instead of the remote input dev is bad... Then a minor cleanup patch and a modparam option fixup.

Jarod Wilson (3):
imon: fix my egregious brown paper bag w/rdev/idev split
imon: remove redundant change_protocol call
imon: fix nomouse modprobe option

 drivers/media/IR/imon.c |   48  +++++++++++++++++-----------------------------
  1 files changed, 18 insertions(+), 30 deletions(-)
Signature · 2 lines
Jarod Wilson
[email protected]
#1 lore raw

PATCH 1/3 imon: fix my egregious brown paper bag w/rdev/idev split

Somehow, I managed to screw things up when reworking the rdev/idev split patch from David, and started trying to get ir_input_dev from idev instead of rdev, thus resulting in button presses hanging the system. This fixes it.

---
 drivers/media/IR/imon.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/media/IR/imon.c +9 -10
index 0391c3b..bcb2826 100644
@@ -1477,7 +1477,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
 	bool norelease = false;
 	int i;
 	u64 scancode;
-	struct input_dev *idev = NULL;
+	struct input_dev *rdev = NULL;
 	struct ir_input_dev *irdev = NULL;
 	int press_type = 0;
 	int msec;
@@ -1485,8 +1485,8 @@ static void imon_incoming_packet(struct imon_context *ictx,
 	static struct timeval prev_time = { 0, 0 };
 	u8 ktype;
 
-	idev = ictx->idev;
-	irdev = input_get_drvdata(idev);
+	rdev = ictx->rdev;
+	irdev = input_get_drvdata(rdev);
 
 	/* filter out junk data on the older 0xffdc imon devices */
 	if ((buf[0] == 0xff) && (buf[1] == 0xff) && (buf[2] == 0xff))
@@ -1570,8 +1570,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
 		if (press_type == 0)
 			ir_keyup(irdev);
 		else {
-			ir_keydown(ictx->rdev, ictx->rc_scancode,
-				   ictx->rc_toggle);
+			ir_keydown(rdev, ictx->rc_scancode, ictx->rc_toggle);
 			spin_lock_irqsave(&ictx->kc_lock, flags);
 			ictx->last_keycode = ictx->kc;
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
@@ -1587,7 +1586,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
 		do_gettimeofday(&t);
 		msec = tv2int(&t, &prev_time);
 		prev_time = t;
-		if (msec < idev->rep[REP_DELAY]) {
+		if (msec < ictx->idev->rep[REP_DELAY]) {
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
 			return;
 		}
@@ -1596,12 +1595,12 @@ static void imon_incoming_packet(struct imon_context *ictx,
 
 	spin_unlock_irqrestore(&ictx->kc_lock, flags);
 
-	input_report_key(idev, kc, press_type);
-	input_sync(idev);
+	input_report_key(ictx->idev, kc, press_type);
+	input_sync(ictx->idev);
 
 	/* panel keys don't generate a release */
-	input_report_key(idev, kc, 0);
-	input_sync(idev);
+	input_report_key(ictx->idev, kc, 0);
+	input_sync(ictx->idev);
 
 	ictx->last_keycode = kc;
 
Signature · 5 lines
1.7.2.3

-- 
Jarod Wilson
[email protected]
#2 lore raw

PATCH 2/3 imon: remove redundant change_protocol call

In reply to Jarod Wilson

There was a redundant call to imon_ir_change_protocol -- its already getting called from ir_input_register. Also do some minor housekeeping with var names and formatting.

---
 drivers/media/IR/imon.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)
drivers/media/IR/imon.c +7 -18
index bcb2826..b4d489d 100644
@@ -315,7 +315,7 @@ MODULE_DEVICE_TABLE(usb, imon_usb_id_table);
 
 static bool debug;
 module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Debug messages: 0=no, 1=yes(default: no)");
+MODULE_PARM_DESC(debug, "Debug messages: 0=no, 1=yes (default: no)");
 
 /* lcd, vfd, vga or none? should be auto-detected, but can be overridden... */
 static int display_type;
@@ -784,7 +784,7 @@ static struct attribute *imon_display_sysfs_entries[] = {
 	NULL
 };
 
-static struct attribute_group imon_display_attribute_group = {
+static struct attribute_group imon_display_attr_group = {
 	.attrs = imon_display_sysfs_entries
 };
 
@@ -793,7 +793,7 @@ static struct attribute *imon_rf_sysfs_entries[] = {
 	NULL
 };
 
-static struct attribute_group imon_rf_attribute_group = {
+static struct attribute_group imon_rf_attr_group = {
 	.attrs = imon_rf_sysfs_entries
 };
 
@@ -2238,8 +2238,7 @@ static void imon_init_display(struct imon_context *ictx,
 	dev_dbg(ictx->dev, "Registering iMON display with sysfs\n");
 
 	/* set up sysfs entry for built-in clock */
-	ret = sysfs_create_group(&intf->dev.kobj,
-				 &imon_display_attribute_group);
+	ret = sysfs_create_group(&intf->dev.kobj, &imon_display_attr_group);
 	if (ret)
 		dev_err(ictx->dev, "Could not create display sysfs "
 			"entries(%d)", ret);
@@ -2312,7 +2311,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
 	if (ifnum == 0) {
 		if (product == 0xffdc && ictx->rf_device) {
 			sysfs_err = sysfs_create_group(&interface->dev.kobj,
-						       &imon_rf_attribute_group);
+						       &imon_rf_attr_group);
 			if (sysfs_err)
 				pr_err("Could not create RF sysfs entries(%d)\n",
 				       sysfs_err);
@@ -2322,14 +2321,6 @@ static int __devinit imon_probe(struct usb_interface *interface,
 			imon_init_display(ictx, interface);
 	}
 
-	/* set IR protocol/remote type */
-	ret = imon_ir_change_protocol(ictx, ictx->ir_type);
-	if (ret) {
-		dev_warn(dev, "%s: failed to set IR protocol, falling back "
-			 "to standard iMON protocol mode\n", __func__);
-		ictx->ir_type = IR_TYPE_OTHER;
-	}
-
 	dev_info(dev, "iMON device (%04x:%04x, intf%d) on "
 		 "usb<%d:%d> initialized\n", vendor, product, ifnum,
 		 usbdev->bus->busnum, usbdev->devnum);
@@ -2368,10 +2359,8 @@ static void __devexit imon_disconnect(struct usb_interface *interface)
 	 * sysfs_remove_group is safe to call even if sysfs_create_group
 	 * hasn't been called
 	 */
-	sysfs_remove_group(&interface->dev.kobj,
-			   &imon_display_attribute_group);
-	sysfs_remove_group(&interface->dev.kobj,
-			   &imon_rf_attribute_group);
+	sysfs_remove_group(&interface->dev.kobj, &imon_display_attr_group);
+	sysfs_remove_group(&interface->dev.kobj, &imon_rf_attr_group);
 
 	usb_set_intfdata(interface, NULL);
 
Signature · 5 lines
1.7.2.3

-- 
Jarod Wilson
[email protected]
#3 lore raw

PATCH 3/3 imon: fix nomouse modprobe option

In reply to Jarod Wilson

Pointed out by Bonne Eggleston on the lirc list.

---
 drivers/media/IR/imon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/IR/imon.c +2 -2
index b4d489d..f782a9d 100644
@@ -1004,7 +1004,7 @@ int imon_ir_change_protocol(void *priv, u64 ir_type)
 	case IR_TYPE_UNKNOWN:
 	case IR_TYPE_OTHER:
 		dev_dbg(dev, "Configuring IR receiver for iMON protocol\n");
-		if (pad_stabilize)
+		if (pad_stabilize && !nomouse)
 			pad_mouse = true;
 		else {
 			dev_dbg(dev, "PAD stabilize functionality disabled\n");
@@ -1016,7 +1016,7 @@ int imon_ir_change_protocol(void *priv, u64 ir_type)
 	default:
 		dev_warn(dev, "Unsupported IR protocol specified, overriding "
 			 "to iMON IR protocol\n");
-		if (pad_stabilize)
+		if (pad_stabilize && !nomouse)
 			pad_mouse = true;
 		else {
 			dev_dbg(dev, "PAD stabilize functionality disabled\n");
Signature · 6 lines
1.7.2.3


-- 
Jarod Wilson
[email protected]