[PATCH] Add PHYS-string and connecton to pci-device for nicer usage by udev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there!

The attached patch a PHYS-string and a connection to the relevant pci-device 
to let udev now this and create more user-friendly/persistent links on the 
event-device. Code with some changes taken from budget-ci.c

With that patch, udev-103 creates:
/dev/input/by-path/pci-0000\:00\:0a.0--event-ir


Nevertheless input-handling for av7110 needs some changes: one can for example
only use input-connector of first card.

Other possible (simpler) change: Change name of input device and attach name 
of dvb-device.

Greetings
Matthias

-- 
Matthias Schwarzott (zzam)
Matthias Schwarzott <zzam@xxxxxxxxxx>:

Add PHYS-string to help udev and
others using EVIOCPHYS ioctl to
identify the input device node.

Code taken (with little changes) from budget-ci.c

diff -r e37679b39df8 linux/drivers/media/dvb/ttpci/av7110_ir.c
--- a/linux/drivers/media/dvb/ttpci/av7110_ir.c	Tue Jan 09 12:20:59 2007 -0200
+++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c	Wed Jan 10 15:49:35 2007 +0100
@@ -16,6 +16,7 @@ static int av_cnt;
 static int av_cnt;
 static struct av7110 *av_list[4];
 static struct input_dev *input_dev;
+static char input_phys[32];
 
 static u8 delay_timer_finished;
 
@@ -231,8 +232,28 @@ int __devinit av7110_ir_init(struct av71
 		if (!input_dev)
 			return -ENOMEM;
 
+		snprintf(input_phys, sizeof(input_phys),
+			"pci-%s/ir0", pci_name(av7110->dev->pci));
+
 		input_dev->name = "DVB on-card IR receiver";
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+		input_dev->phys = input_phys;
+		input_dev->id.bustype = BUS_PCI;
+		input_dev->id.version = 1;
+		if (av7110->dev->pci->subsystem_vendor) {
+			input_dev->id.vendor = av7110->dev->pci->subsystem_vendor;
+			input_dev->id.product = av7110->dev->pci->subsystem_device;
+		} else {
+			input_dev->id.vendor = av7110->dev->pci->vendor;
+			input_dev->id.product = av7110->dev->pci->device;
+		}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
+		input_dev->cdev.dev = &av7110->dev->pci->dev;
+#else
+		input_dev->dev = &av7110->dev->pci->dev;
+#endif
+#endif
 		set_bit(EV_KEY, input_dev->evbit);
 		set_bit(EV_REP, input_dev->evbit);
 		input_register_keys();
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux