Linux Hotplug development
 help / color / mirror / Atom feed
* Re: [PATCH] Export SMBIOS provided firmware instance and label to
From: Greg KH @ 2010-07-21  3:54 UTC (permalink / raw)
  To: Narendra_K
  Cc: netdev, linux-hotplug, linux-pci, Matt_Domsch, Charles_Rose,
	Jordan_Hargrave, Vijay_Nijhawan
In-Reply-To: <EDA0A4495861324DA2618B4C45DCB3EE612BD1@blrx3m08.blr.amer.dell.com>

On Mon, Jul 19, 2010 at 10:24:39PM +0530, Narendra_K@Dell.com wrote:
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > owner@vger.kernel.org] On Behalf Of Narendra K
> > Sent: Wednesday, July 14, 2010 5:44 PM
> > To: greg@kroah.com
> > Cc: netdev@vger.kernel.org; linux-hotplug@vger.kernel.org; linux-
> > pci@vger.kernel.org; Domsch, Matt; Rose, Charles; Hargrave, Jordan;
> > Nijhawan, Vijay
> > Subject: Re: [PATCH] Export SMBIOS provided firmware instance and
> label
> > to sysfs
> > 
> > 
> > V1 -> V2:
> > 
> > 1. The 'smbios_attr' buffer is not being used as mentioned above
> > 
> > 2. The function 'smbios_instance_string_exist' is split into two
> > functions,
> > the other being 'find_smbios_instance_string' which would print the
> > result
> > into the sysfs provided 'buf' of associated device. The function
> > 'smbios_instance_string_exist' would let us know if the label exists
> or
> > not.
> > 
> > Please find the patch with above changes here -
> > 
> > From: Narendra K <narendra_k@dell.com>
> > Subject: [PATCH] Export SMBIOS provided firmware instance and label to
> > sysfs
> > 
> 
> Greg,
> 
> Thanks for the review comments. 
> 
> This version of the patch has all the suggestions incorporated. Please
> let us know if there are any concerns. If the approach is acceptable,
> please consider this patch for inclusion.

What "version"?  The previous one you sent?  I'll look at it, but note
that I'm not the maintainer who you need to convince to accept it :)

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH] Export SMBIOS provided firmware instance and label to
From: Greg KH @ 2010-07-21  3:59 UTC (permalink / raw)
  To: Narendra K
  Cc: netdev, linux-hotplug, linux-pci, matt_domsch, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <20100714121345.GA20411@auslistsprd01.us.dell.com>

On Wed, Jul 14, 2010 at 07:13:45AM -0500, Narendra K wrote:
> @@ -333,6 +358,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
>  		break;
>  	case 41:	/* Onboard Devices Extended Information */
>  		dmi_save_extended_devices(dm);
> +		break;

Why make this change?  It's not relevant to your patch, right?

> +enum smbios_attr_enum {
> +	SMBIOS_ATTR_NONE = 0,
> +	SMBIOS_ATTR_LABEL_SHOW,
> +	SMBIOS_ATTR_INSTANCE_SHOW,
> +};
> +
> +static mode_t
> +find_smbios_instance_string(struct pci_dev *pdev, char *buf, int attribute)

Why isn't 'attribute' an enumerated type like you just defined above?
Extra type-checking is always good, especially as the variable name
'attribute' means something totally different in other parts of this
file.

> +{
> +	const struct dmi_device *dmi;
> +	struct dmi_dev_onboard *donboard;
> +	int bus;
> +	int devfn;
> +
> +	bus = pdev->bus->number;
> +	devfn = pdev->devfn;
> +
> +	dmi = NULL;
> +	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
> +				      NULL, dmi)) != NULL) {
> +		donboard = dmi->device_data;
> +		if (donboard && donboard->bus = bus &&
> +					donboard->devfn = devfn) {
> +			if (buf) {
> +				if (attribute = SMBIOS_ATTR_INSTANCE_SHOW)
> +					return scnprintf(buf, PAGE_SIZE,
> +							 "%d\n",
> +							 donboard->instance);
> +				else if (attribute = SMBIOS_ATTR_LABEL_SHOW)
> +					return scnprintf(buf, PAGE_SIZE,
> +							 "%s\n",
> +							 dmi->name);
> +			}
> +			return strlen(dmi->name);
> +		}
> +	}
> +	return 0;
> +}
> +
> +static mode_t
> +smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
> +			     int n)
> +{
> +	struct device *dev;
> +	struct pci_dev *pdev;
> +
> +	dev = container_of(kobj, struct device, kobj);
> +	pdev = to_pci_dev(dev);
> +
> +	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE);
> +}
> +
> +static ssize_t
> +smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct pci_dev *pdev;
> +	pdev = to_pci_dev(dev);
> +
> +	return find_smbios_instance_string(pdev, buf,
> +					   SMBIOS_ATTR_LABEL_SHOW);
> +}
> +
> +static ssize_t
> +smbiosinstance_show(struct device *dev,
> +		    struct device_attribute *attr, char *buf)
> +{
> +	struct pci_dev *pdev;
> +	pdev = to_pci_dev(dev);
> +
> +	return find_smbios_instance_string(pdev, buf,
> +					   SMBIOS_ATTR_INSTANCE_SHOW);
> +}
> +
> +static struct device_attribute smbios_attr_label = {
> +	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
> +	.show = smbioslabel_show,
> +};
> +
> +static struct device_attribute smbios_attr_instance = {
> +	.attr = {.name = "index", .mode = 0444, .owner = THIS_MODULE},
> +	.show = smbiosinstance_show,
> +};
> +
> +static struct attribute *smbios_attributes[] = {
> +	&smbios_attr_label.attr,
> +	&smbios_attr_instance.attr,
> +	NULL,
> +};
> +
> +static struct attribute_group smbios_attr_group = {
> +	.attrs = smbios_attributes,
> +	.is_visible = smbios_instance_string_exist,
> +};
> +
> +static int
> +pci_create_smbiosname_file(struct pci_dev *pdev)
> +{
> +	if (!sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group))
> +		return 0;
> +	return -ENODEV;
> +}
> +
> +static int
> +pci_remove_smbiosname_file(struct pci_dev *pdev)
> +{
> +		sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
> +		return 0;
> +}

What's with the extra indentation?

Why return a value at all here?

> +
> +int pci_create_firmware_label_files(struct pci_dev *pdev)
> +{
> +	if (!pci_create_smbiosname_file(pdev))
> +		return 0;
> +	return -ENODEV;
> +}
> +
> +int pci_remove_firmware_label_files(struct pci_dev *pdev)
> +{
> +	if (!pci_remove_smbiosname_file(pdev))
> +		return 0;
> +	return -ENODEV;
> +}

Why return values for these two functions if you never check them
anywhere?  Either check the return value and do something with it, or
just make them 'void'.

Also, you need to add documentation for what this sysfs file is and does
in the Documentation/ABI/ directory.  That must be in this patch to have
it acceptable.

thanks,

greg k-h

^ permalink raw reply

* Hotplug event for usb webcam
From: linux newbie @ 2010-07-21  5:34 UTC (permalink / raw)
  To: linux-hotplug

Hi,

* I am running linux_2.6.27 kernel with hotplug support
(/sbin/hotplug) on PXA255 based embedded platform.
* I have a usb network adapter, so when it is plugged into our
platform, I can able to access it using "usb0".
* Whenever this device is plugged in, I do "ifconfig usb0 192.168.0.1"
* I need to automate this process and I do not have hotplug related
scripts in my userspace.

Can anyone let me know, the script files that I need to download? Also
how to tailor it for my custom needs?

Thanks in Advance

^ permalink raw reply

* Re: What variables are important when a cdrom is in or out?
From: Kay Sievers @ 2010-07-21  6:38 UTC (permalink / raw)
  To: linux-hotplug
In-Reply-To: <AANLkTilWvuVVCWFvw33OjfmFhqGeazobCqIRoQp-Mgee@mail.gmail.com>

On Wed, Jul 21, 2010 at 00:25, Stef Bon <stefbon@gmail.com> wrote:
> ID_CDROM_MEDIA_TRACK_COUNT equal to 18,
> and ID_CDROM_MEDIA_TRACK_COUNT_AUDIO also 18. Does this mean that
> there is also an
> ID_CDROM_MEDIA_TRACK_COUNT_VIDEO??

Seems, you have 18 tracks, and 18 of them are audio. There seems nothing else.

And video is usually DVD and this would be on a mountable UDF
filesystem. There is no real native video track like audio.

> And what's the meaning of the ID_CDROM_MEDIA_SESSION_COUNT? Multisession cd's?

Yes.

Kay

^ permalink raw reply

* Re: Hotplug event for usb webcam
From: Kay Sievers @ 2010-07-21  6:44 UTC (permalink / raw)
  To: linux-hotplug
In-Reply-To: <AANLkTimvs9gwkBUJKVtvACNEe-V9sFvspSetF1j5dTfo@mail.gmail.com>

On Wed, Jul 21, 2010 at 07:34, linux newbie <linux.newbie79@gmail.com> wrote:
> * I am running linux_2.6.27 kernel with hotplug support
> (/sbin/hotplug) on PXA255 based embedded platform.
> * I have a usb network adapter, so when it is plugged into our
> platform, I can able to access it using "usb0".
> * Whenever this device is plugged in, I do "ifconfig usb0 192.168.0.1"
> * I need to automate this process and I do not have hotplug related
> scripts in my userspace.
>
> Can anyone let me know, the script files that I need to download? Also
> how to tailor it for my custom needs?

I don't think many people on this list really use the ancient
/sbin/hotplug mechanism and the shell scripts anymore. All this stuff
has moved to udev since years.

Hotplug-aware services do stuff like this for video device handling:
  http://article.gmane.org/gmane.linux.hotplug.devel/13925

Kay

^ permalink raw reply

* Re: Hotplug event for usb webcam
From: linux newbie @ 2010-07-21  9:52 UTC (permalink / raw)
  To: linux-hotplug
In-Reply-To: <AANLkTimvs9gwkBUJKVtvACNEe-V9sFvspSetF1j5dTfo@mail.gmail.com>

Thanks for  your reply.

Can I use udev for my case? If yes, can  you please let me know some
documentation?

Thanks

On Wed, Jul 21, 2010 at 4:44 PM, Kay Sievers <kay.sievers@vrfy.org> wrote:
> On Wed, Jul 21, 2010 at 07:34, linux newbie <linux.newbie79@gmail.com> wrote:
>> * I am running linux_2.6.27 kernel with hotplug support
>> (/sbin/hotplug) on PXA255 based embedded platform.
>> * I have a usb network adapter, so when it is plugged into our
>> platform, I can able to access it using "usb0".
>> * Whenever this device is plugged in, I do "ifconfig usb0 192.168.0.1"
>> * I need to automate this process and I do not have hotplug related
>> scripts in my userspace.
>>
>> Can anyone let me know, the script files that I need to download? Also
>> how to tailor it for my custom needs?
>
> I don't think many people on this list really use the ancient
> /sbin/hotplug mechanism and the shell scripts anymore. All this stuff
> has moved to udev since years.
>
> Hotplug-aware services do stuff like this for video device handling:
>  http://article.gmane.org/gmane.linux.hotplug.devel/13925
>
> Kay
>

^ permalink raw reply

* Difference between adding a partition after inserting a disk and
From: Stef Bon @ 2010-07-21 12:07 UTC (permalink / raw)
  To: linux-hotplug

Hello,

I'm looking at the difference between the adding of a partition as
part of the inserting a usb disk,
and after repartitioning the disk.

I want to make udev run a script after it has been inserted. I've
chosen to make this script run after
the whole disk is discovered, and ignore the adding of the individual
partitions.

But after changing the partitiontable, and when a partition is
created, I want to make a script run, and not ignored.

Does udisk discover that?
I've seen some variables like:

UDISKS_PARTITION=1?

Is this the one to check?

Stef

^ permalink raw reply

* Re: What variables are important when a cdrom is in or out?
From: Matthew Dharm @ 2010-07-21 21:02 UTC (permalink / raw)
  To: linux-hotplug
In-Reply-To: <AANLkTilWvuVVCWFvw33OjfmFhqGeazobCqIRoQp-Mgee@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Wed, Jul 21, 2010 at 08:38:53AM +0200, Kay Sievers wrote:
> On Wed, Jul 21, 2010 at 00:25, Stef Bon <stefbon@gmail.com> wrote:
> > ID_CDROM_MEDIA_TRACK_COUNT equal to 18,
> > and ID_CDROM_MEDIA_TRACK_COUNT_AUDIO also 18. Does this mean that
> > there is also an
> > ID_CDROM_MEDIA_TRACK_COUNT_VIDEO??
> 
> Seems, you have 18 tracks, and 18 of them are audio. There seems nothing else.
> 
> And video is usually DVD and this would be on a mountable UDF
> filesystem. There is no real native video track like audio.

It is possible, however, to mix audio tracks and data tracks on the same
disc.  It's really rare, but it can be done.  I would guess that is why you
get a "whole disk" track count and an "audio" track count.

Matt

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

C:  They kicked your ass, didn't they?
S:  They were cheating!
					-- The Chief and Stef
User Friendly, 11/19/1997

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH V3] Export SMBIOS provided firmware instance and label to sysfs
From: Narendra K @ 2010-07-22 18:44 UTC (permalink / raw)
  To: netdev, linux-hotplug, linux-pci
  Cc: matt_domsch, charles_rose, jordan_hargrave, vijay_nijhawan

Hello,

Resubmitting the patch with suggested changes -

V2 -> V3:

1. Added documentation about the sysfs attributes in Documentation/ABI
directory.
2. Changed the type of parameter 'attribute' of the function
'find_smbios_instance_string' from int to enum.
3. Changed the return type of the functions 'pci_create_firmware_label_files'
and 'pci_remove_firmware_label_files' from int to void

Please find the patch with above changes -

 
From: Narendra K <narendra_k@dell.com>
Subject: [PATCH] Export SMBIOS provided firmware instance and label to sysfs

This patch exports SMBIOS provided firmware instance and label
of onboard pci devices to sysfs

Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Narendra K <narendra_k@dell.com>
---
 Documentation/ABI/testing/sysfs-bus-pci |   26 ++++++
 drivers/firmware/dmi_scan.c             |   25 ++++++
 drivers/pci/Makefile                    |    3 +
 drivers/pci/pci-label.c                 |  143 +++++++++++++++++++++++++++++++
 drivers/pci/pci-sysfs.c                 |    5 +
 drivers/pci/pci.h                       |    9 ++
 include/linux/dmi.h                     |    9 ++
 7 files changed, 220 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pci/pci-label.c

diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 428676c..d3eb807 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -179,3 +179,29 @@ Contact:	linux-pci@vger.kernel.org
 Description:
 		This symbolic link points to the PCI hotplug controller driver
 		module that manages the hotplug slot.
+
+What:		/sys/bus/pci/devices/.../label
+Date:		July 2010
+Contact:	Linux PCI developers <linux-pci@vger.kernel.org>
+Description:
+		Reading this attribute will provide the firmware
+		given name of the PCI device. The attribute will
+		be created only if the firmware has given a name
+		to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned name of the PCI device.
+
+What:		/sys/bus/pci/devices/.../index
+Date:		July 2010
+Contact:	Linux PCI developers <linux-pci@vger.kernel.org>
+Description:
+		Reading this attribute will provide the firmware
+		given instance of the PCI device. The attribute will
+		be created only if the firmware has given a device
+		type instance to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned device type instance of the PCI
+		device that can help in understanding the firmware
+		intended order of the PCI device.
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index d464672..b3d22d6 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -277,6 +277,29 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
 	list_add_tail(&dev->list, &dmi_devices);
 }
 
+static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
+					int devfn, const char *name)
+{
+	struct dmi_dev_onboard *onboard_dev;
+
+	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
+	if (!onboard_dev) {
+		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
+		return;
+	}
+	onboard_dev->instance = instance;
+	onboard_dev->segment = segment;
+	onboard_dev->bus = bus;
+	onboard_dev->devfn = devfn;
+
+	strcpy((char *)&onboard_dev[1], name);
+	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
+	onboard_dev->dev.name = (char *)&onboard_dev[1];
+	onboard_dev->dev.device_data = onboard_dev;
+
+	list_add(&onboard_dev->dev.list, &dmi_devices);
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const u8 *d = (u8*) dm + 5;
@@ -285,6 +308,8 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	if ((*d & 0x80) = 0)
 		return;
 
+	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
+			     dmi_string_nosave(dm, *(d-1)));
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 0b51857..dc1aa09 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -55,6 +55,9 @@ obj-$(CONFIG_MICROBLAZE) += setup-bus.o
 #
 obj-$(CONFIG_ACPI)    += pci-acpi.o
 
+# SMBIOS provided firmware instance and labels
+obj-$(CONFIG_DMI)    += pci-label.o
+
 # Cardbus & CompactPCI use setup-bus
 obj-$(CONFIG_HOTPLUG) += setup-bus.o
 
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
new file mode 100644
index 0000000..111500e
--- /dev/null
+++ b/drivers/pci/pci-label.c
@@ -0,0 +1,143 @@
+/*
+ * Purpose: Export the firmware instance and label associated with
+ * a pci device to sysfs
+ * Copyright (C) 2010 Dell Inc.
+ * by Narendra K <Narendra_K@dell.com>,
+ * Jordan Hargrave <Jordan_Hargrave@dell.com>
+ *
+ * SMBIOS defines type 41 for onboard pci devices. This code retrieves
+ * the instance number and string from the type 41 record and exports
+ * it to sysfs.
+ *
+ * Please see http://linux.dell.com/wiki/index.php/Oss/libnetdevname for more
+ * information.
+ */
+
+#include <linux/dmi.h>
+#include <linux/sysfs.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include "pci.h"
+
+enum smbios_attr_enum {
+	SMBIOS_ATTR_NONE = 0,
+	SMBIOS_ATTR_LABEL_SHOW,
+	SMBIOS_ATTR_INSTANCE_SHOW,
+};
+
+static mode_t
+find_smbios_instance_string(struct pci_dev *pdev, char *buf,
+			    enum smbios_attr_enum attribute)
+{
+	const struct dmi_device *dmi;
+	struct dmi_dev_onboard *donboard;
+	int bus;
+	int devfn;
+
+	bus = pdev->bus->number;
+	devfn = pdev->devfn;
+
+	dmi = NULL;
+	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
+				      NULL, dmi)) != NULL) {
+		donboard = dmi->device_data;
+		if (donboard && donboard->bus = bus &&
+					donboard->devfn = devfn) {
+			if (buf) {
+				if (attribute = SMBIOS_ATTR_INSTANCE_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%d\n",
+							 donboard->instance);
+				else if (attribute = SMBIOS_ATTR_LABEL_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%s\n",
+							 dmi->name);
+			}
+			return strlen(dmi->name);
+		}
+	}
+	return 0;
+}
+
+static mode_t
+smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
+			     int n)
+{
+	struct device *dev;
+	struct pci_dev *pdev;
+
+	dev = container_of(kobj, struct device, kobj);
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ?
+					   S_IRUGO : 0;
+}
+
+static ssize_t
+smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_LABEL_SHOW);
+}
+
+static ssize_t
+smbiosinstance_show(struct device *dev,
+		    struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_INSTANCE_SHOW);
+}
+
+static struct device_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbioslabel_show,
+};
+
+static struct device_attribute smbios_attr_instance = {
+	.attr = {.name = "index", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosinstance_show,
+};
+
+static struct attribute *smbios_attributes[] = {
+	&smbios_attr_label.attr,
+	&smbios_attr_instance.attr,
+	NULL,
+};
+
+static struct attribute_group smbios_attr_group = {
+	.attrs = smbios_attributes,
+	.is_visible = smbios_instance_string_exist,
+};
+
+static int
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (!sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group))
+		return 0;
+	return -ENODEV;
+}
+
+static void
+pci_remove_smbiosname_file(struct pci_dev *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
+}
+
+void pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))
+		;
+}
+
+void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{
+	pci_remove_smbiosname_file(pdev);
+}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index afd2fbf..01fd799 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1132,6 +1132,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 
 	pci_create_slot_links(pdev);
 
+	pci_create_firmware_label_files(pdev);
+
 	return 0;
 
 err_vga_file:
@@ -1201,6 +1203,9 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 		sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr);
 		kfree(pdev->rom_attr);
 	}
+
+	pci_remove_firmware_label_files(pdev);
+
 }
 
 static int __init pci_sysfs_init(void)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f8077b3..d930338 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -11,6 +11,15 @@
 extern int pci_uevent(struct device *dev, struct kobj_uevent_env *env);
 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
+#ifndef CONFIG_DMI
+static inline void pci_create_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+static inline void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+#else
+extern void pci_create_firmware_label_files(struct pci_dev *pdev);
+extern void pci_remove_firmware_label_files(struct pci_dev *pdev);
+#endif
 extern void pci_cleanup_rom(struct pci_dev *dev);
 #ifdef HAVE_PCI_MMAP
 extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1a..90e087f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_SAS,
 	DMI_DEV_TYPE_IPMI = -1,
 	DMI_DEV_TYPE_OEM_STRING = -2,
+	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 };
 
 struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
 
 #ifdef CONFIG_DMI
 
+struct dmi_dev_onboard {
+	struct dmi_device dev;
+	int instance;
+	int segment;
+	int bus;
+	int devfn;
+};
+
 extern int dmi_check_system(const struct dmi_system_id *list);
 const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
 extern const char * dmi_get_system_info(int field);
-- 
1.6.5.2

With regards,
Narendra K


^ permalink raw reply related

* Re: [PATCH V3] Export SMBIOS provided firmware instance and label
From: Greg KH @ 2010-07-22 18:56 UTC (permalink / raw)
  To: Narendra K
  Cc: netdev, linux-hotplug, linux-pci, matt_domsch, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <20100722184448.GA9122@auslistsprd01.us.dell.com>

On Thu, Jul 22, 2010 at 01:44:48PM -0500, Narendra K wrote:
> Hello,
> 
> Resubmitting the patch with suggested changes -
> 
> V2 -> V3:
> 
> 1. Added documentation about the sysfs attributes in Documentation/ABI
> directory.
> 2. Changed the type of parameter 'attribute' of the function
> 'find_smbios_instance_string' from int to enum.
> 3. Changed the return type of the functions 'pci_create_firmware_label_files'
> and 'pci_remove_firmware_label_files' from int to void
> 
> Please find the patch with above changes -
> 
>  
> From: Narendra K <narendra_k@dell.com>
> Subject: [PATCH] Export SMBIOS provided firmware instance and label to sysfs
> 
> This patch exports SMBIOS provided firmware instance and label
> of onboard pci devices to sysfs
> 
> Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
> Signed-off-by: Narendra K <narendra_k@dell.com>
> ---
>  Documentation/ABI/testing/sysfs-bus-pci |   26 ++++++
>  drivers/firmware/dmi_scan.c             |   25 ++++++
>  drivers/pci/Makefile                    |    3 +
>  drivers/pci/pci-label.c                 |  143 +++++++++++++++++++++++++++++++
>  drivers/pci/pci-sysfs.c                 |    5 +
>  drivers/pci/pci.h                       |    9 ++
>  include/linux/dmi.h                     |    9 ++
>  7 files changed, 220 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/pci/pci-label.c
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
> index 428676c..d3eb807 100644
> --- a/Documentation/ABI/testing/sysfs-bus-pci
> +++ b/Documentation/ABI/testing/sysfs-bus-pci
> @@ -179,3 +179,29 @@ Contact:	linux-pci@vger.kernel.org
>  Description:
>  		This symbolic link points to the PCI hotplug controller driver
>  		module that manages the hotplug slot.
> +
> +What:		/sys/bus/pci/devices/.../label
> +Date:		July 2010
> +Contact:	Linux PCI developers <linux-pci@vger.kernel.org>

Why not contact you?

> +Description:
> +		Reading this attribute will provide the firmware
> +		given name of the PCI device. The attribute will
> +		be created only if the firmware has given a name
> +		to the PCI device.

Where does that "name" come from?  Please describe this.

> +Users:
> +		Userspace applications interested in knowing the
> +		firmware assigned name of the PCI device.
> +
> +What:		/sys/bus/pci/devices/.../index
> +Date:		July 2010
> +Contact:	Linux PCI developers <linux-pci@vger.kernel.org>
> +Description:
> +		Reading this attribute will provide the firmware
> +		given instance of the PCI device. The attribute will
> +		be created only if the firmware has given a device
> +		type instance to the PCI device.

Same comments as above.

thanks,

greg k-h

^ permalink raw reply

* Difference removing a partitition again: a launch manger.
From: Stef Bon @ 2010-07-23 10:00 UTC (permalink / raw)
  To: linux-hotplug

Hello,

I was dealing with detecting the difference between the event a
partition is removed when
the whole disk is removed (for example removeable drives) and the
removal of a partition
through a partitionmanager.

Udev does not see any difference.

What I see happen:

generally when a partition is removed when a device is taken out:

- first all the individual partitions are removed
- finally the whole disk is removed (type=disk)

when a partition is removed through a partmanager:

- a partition is removed
- the whole disk is changed (the partitiontable!)

(the same order when a partition is added through partmanager)

Now I've made a construction using the at daemon
to run scripts initiated by udev events. Generally it's good idea to use
such a launch manager which takes care of the launching of all kinds of scripts,
you don't want udev to wait for a script to finish, while waiting not
being able
to continue what it's doing, detection  hardware changes.

An overview:

an hardware event

a rule tells udev to run a script

this script creates a list of commands to be run, if this list already
exist (and is not too old) adds them
to this list.

the launching of the commands on this list takes place after a short
time (a few seconds) This list is sorted and
doubles are removed, and then finally the desired scripts are launched
in a certain preferred order.


I've added some extra scripts to at to make this waiting, sorting and
queuing  them possible.

The reason for me is to introduce the ability for a at job to wait for
some time (a few seconds),
and then queue a list of commands.
Why? When just running scripts launched by udev events, it will get a
mess, cause there are a lot
of events when just removing a partition.

They are all related, but the launch manager (the at daemon) does not
"know" that,
and all the scrips will be launched, which is not what you want.
My construction provides ways to "streamline" the  launching these scripts.
It does so by waiting a short period to gather all the information
coming from udev,
does some sorting and deleting double jobs, and finally launch them in
a preferred order.

Maybe I should publish this construction (on my gitorious page for
example), cause it's good
thing to have a "launch" manager next to udev.

There is being worked on launch mangers like Upstart an system.d,
which you can use for this purpose,
but maybe to have some other solution, only to compare is a good thing.

Through the use of at as launch manager and the ability to "gather"
all the queued jobs
before launching them, it's easy to distinguish the removal of a
partition as part
of the removal of the whole disk, and the removal when using a partitionmanager.

In the first case, there is always a "remove the whole disk" command
(next to the remove the partition),
and in the second case that's not so, there is a "change the whole
disk" instead.

When adding a partition, there is an "add the whole disk" when
inserting the disk (next to the add the partition),
and there is an "change the whole disk" instead when inserting the disk.


A lot of words, I hope you made it to the end.

Stef

PS I've developed this as part of my construction to create
userfriendly access to all kinds of mountable resources,
remote like smb shares, ftp servers AND local like USB devices,
harddisks and cdroms.

See:

http://linux.bononline.nl/linux/mount.md5key.new/

You do not find anything about the launch manager yet. I've worked on
it the last weeks, and not published yet.

^ permalink raw reply

* Re: [PATCH V3] Export SMBIOS provided firmware instance and label to sysfs
From: Narendra K @ 2010-07-23 13:34 UTC (permalink / raw)
  To: greg
  Cc: netdev, linux-hotplug, linux-pci, matt_domsch, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <EDA0A4495861324DA2618B4C45DCB3EE612C40@blrx3m08.blr.amer.dell.com>

> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com] 
> Sent: Friday, July 23, 2010 12:26 AM
> To: K, Narendra
> Cc: netdev@vger.kernel.org; linux-hotplug@vger.kernel.org;
> linux-pci@vger.kernel.org; Domsch, Matt; Rose, Charles; Hargrave,
> Jordan; Nijhawan, Vijay
> Subject: Re: [PATCH V3] Export SMBIOS provided firmware instance and
> label to sysfs
> 
> On Thu, Jul 22, 2010 at 01:44:48PM -0500, Narendra K wrote:
> > Hello,
> > 
> > Resubmitting the patch with suggested changes -
> > 
> > V2 -> V3:
> > +Date:		July 2010
> > +Contact:	Linux PCI developers <linux-pci@vger.kernel.org>
> 
> Why not contact you?
> 
> > +Description:
> > +		Reading this attribute will provide the firmware
> > +		given name of the PCI device. The attribute will
> > +		be created only if the firmware has given a name
> > +		to the PCI device.
> 
> Where does that "name" come from?  Please describe this.
> 
> > +Users:
> > +		Userspace applications interested in knowing the
> > +		firmware assigned name of the PCI device.
> > +
> > +What:		/sys/bus/pci/devices/.../index
> > +Date:		July 2010
> > +Contact:	Linux PCI developers <linux-pci@vger.kernel.org>
> > +Description:
> > +		Reading this attribute will provide the firmware
> > +		given instance of the PCI device. The attribute will
> > +		be created only if the firmware has given a device
> > +		type instance to the PCI device.
> 
> Same comments as above.

Please find the patch with above suggestions incorporated -


From: Narendra K <narendra_k@dell.com>
Subject: [PATCH] Export SMBIOS provided firmware instance and label to sysfs

This patch exports SMBIOS provided firmware instance and label
of onboard pci devices to sysfs

Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Narendra K <narendra_k@dell.com>
---
 Documentation/ABI/testing/sysfs-bus-pci |   27 ++++++
 drivers/firmware/dmi_scan.c             |   25 ++++++
 drivers/pci/Makefile                    |    3 +
 drivers/pci/pci-label.c                 |  143 +++++++++++++++++++++++++++++++
 drivers/pci/pci-sysfs.c                 |    5 +
 drivers/pci/pci.h                       |    9 ++
 include/linux/dmi.h                     |    9 ++
 7 files changed, 221 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pci/pci-label.c

diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 428676c..c17b48b 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
 Description:
 		This symbolic link points to the PCI hotplug controller driver
 		module that manages the hotplug slot.
+
+What:		/sys/bus/pci/devices/.../label
+Date:		July 2010
+Contact:	linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given name(SMBIOS type 41 string) of the PCI device.
+		The attribute will be created only if the firmware
+		has given a name to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned name of the PCI device.
+
+What:		/sys/bus/pci/devices/.../index
+Date:		July 2010
+Contact:	linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given instance(SMBIOS type 41 device type instance)
+		of the PCI device. The attribute will be created
+		only if the firmware has given a device type instance
+		to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned device type instance of the PCI
+		device that can help in understanding the firmware
+		intended order of the PCI device.
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index d464672..b3d22d6 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -277,6 +277,29 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
 	list_add_tail(&dev->list, &dmi_devices);
 }
 
+static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
+					int devfn, const char *name)
+{
+	struct dmi_dev_onboard *onboard_dev;
+
+	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
+	if (!onboard_dev) {
+		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
+		return;
+	}
+	onboard_dev->instance = instance;
+	onboard_dev->segment = segment;
+	onboard_dev->bus = bus;
+	onboard_dev->devfn = devfn;
+
+	strcpy((char *)&onboard_dev[1], name);
+	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
+	onboard_dev->dev.name = (char *)&onboard_dev[1];
+	onboard_dev->dev.device_data = onboard_dev;
+
+	list_add(&onboard_dev->dev.list, &dmi_devices);
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const u8 *d = (u8*) dm + 5;
@@ -285,6 +308,8 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	if ((*d & 0x80) = 0)
 		return;
 
+	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
+			     dmi_string_nosave(dm, *(d-1)));
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 0b51857..dc1aa09 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -55,6 +55,9 @@ obj-$(CONFIG_MICROBLAZE) += setup-bus.o
 #
 obj-$(CONFIG_ACPI)    += pci-acpi.o
 
+# SMBIOS provided firmware instance and labels
+obj-$(CONFIG_DMI)    += pci-label.o
+
 # Cardbus & CompactPCI use setup-bus
 obj-$(CONFIG_HOTPLUG) += setup-bus.o
 
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
new file mode 100644
index 0000000..111500e
--- /dev/null
+++ b/drivers/pci/pci-label.c
@@ -0,0 +1,143 @@
+/*
+ * Purpose: Export the firmware instance and label associated with
+ * a pci device to sysfs
+ * Copyright (C) 2010 Dell Inc.
+ * by Narendra K <Narendra_K@dell.com>,
+ * Jordan Hargrave <Jordan_Hargrave@dell.com>
+ *
+ * SMBIOS defines type 41 for onboard pci devices. This code retrieves
+ * the instance number and string from the type 41 record and exports
+ * it to sysfs.
+ *
+ * Please see http://linux.dell.com/wiki/index.php/Oss/libnetdevname for more
+ * information.
+ */
+
+#include <linux/dmi.h>
+#include <linux/sysfs.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include "pci.h"
+
+enum smbios_attr_enum {
+	SMBIOS_ATTR_NONE = 0,
+	SMBIOS_ATTR_LABEL_SHOW,
+	SMBIOS_ATTR_INSTANCE_SHOW,
+};
+
+static mode_t
+find_smbios_instance_string(struct pci_dev *pdev, char *buf,
+			    enum smbios_attr_enum attribute)
+{
+	const struct dmi_device *dmi;
+	struct dmi_dev_onboard *donboard;
+	int bus;
+	int devfn;
+
+	bus = pdev->bus->number;
+	devfn = pdev->devfn;
+
+	dmi = NULL;
+	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
+				      NULL, dmi)) != NULL) {
+		donboard = dmi->device_data;
+		if (donboard && donboard->bus = bus &&
+					donboard->devfn = devfn) {
+			if (buf) {
+				if (attribute = SMBIOS_ATTR_INSTANCE_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%d\n",
+							 donboard->instance);
+				else if (attribute = SMBIOS_ATTR_LABEL_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%s\n",
+							 dmi->name);
+			}
+			return strlen(dmi->name);
+		}
+	}
+	return 0;
+}
+
+static mode_t
+smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
+			     int n)
+{
+	struct device *dev;
+	struct pci_dev *pdev;
+
+	dev = container_of(kobj, struct device, kobj);
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ?
+					   S_IRUGO : 0;
+}
+
+static ssize_t
+smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_LABEL_SHOW);
+}
+
+static ssize_t
+smbiosinstance_show(struct device *dev,
+		    struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_INSTANCE_SHOW);
+}
+
+static struct device_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbioslabel_show,
+};
+
+static struct device_attribute smbios_attr_instance = {
+	.attr = {.name = "index", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosinstance_show,
+};
+
+static struct attribute *smbios_attributes[] = {
+	&smbios_attr_label.attr,
+	&smbios_attr_instance.attr,
+	NULL,
+};
+
+static struct attribute_group smbios_attr_group = {
+	.attrs = smbios_attributes,
+	.is_visible = smbios_instance_string_exist,
+};
+
+static int
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (!sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group))
+		return 0;
+	return -ENODEV;
+}
+
+static void
+pci_remove_smbiosname_file(struct pci_dev *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
+}
+
+void pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))
+		;
+}
+
+void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{
+	pci_remove_smbiosname_file(pdev);
+}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index afd2fbf..01fd799 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1132,6 +1132,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 
 	pci_create_slot_links(pdev);
 
+	pci_create_firmware_label_files(pdev);
+
 	return 0;
 
 err_vga_file:
@@ -1201,6 +1203,9 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 		sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr);
 		kfree(pdev->rom_attr);
 	}
+
+	pci_remove_firmware_label_files(pdev);
+
 }
 
 static int __init pci_sysfs_init(void)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f8077b3..d930338 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -11,6 +11,15 @@
 extern int pci_uevent(struct device *dev, struct kobj_uevent_env *env);
 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
+#ifndef CONFIG_DMI
+static inline void pci_create_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+static inline void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+#else
+extern void pci_create_firmware_label_files(struct pci_dev *pdev);
+extern void pci_remove_firmware_label_files(struct pci_dev *pdev);
+#endif
 extern void pci_cleanup_rom(struct pci_dev *dev);
 #ifdef HAVE_PCI_MMAP
 extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1a..90e087f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_SAS,
 	DMI_DEV_TYPE_IPMI = -1,
 	DMI_DEV_TYPE_OEM_STRING = -2,
+	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 };
 
 struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
 
 #ifdef CONFIG_DMI
 
+struct dmi_dev_onboard {
+	struct dmi_device dev;
+	int instance;
+	int segment;
+	int bus;
+	int devfn;
+};
+
 extern int dmi_check_system(const struct dmi_system_id *list);
 const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
 extern const char * dmi_get_system_info(int field);
-- 
1.6.5.2

With regards,
Narendra K

^ permalink raw reply related

* Re: [PATCH V3] Export SMBIOS provided firmware instance and label
From: Greg KH @ 2010-07-23 13:55 UTC (permalink / raw)
  To: Narendra K
  Cc: netdev, linux-hotplug, linux-pci, matt_domsch, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <20100723133456.GA9378@auslistsprd01.us.dell.com>

On Fri, Jul 23, 2010 at 08:34:56AM -0500, Narendra K wrote:
> --- a/Documentation/ABI/testing/sysfs-bus-pci
> +++ b/Documentation/ABI/testing/sysfs-bus-pci
> @@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
>  Description:
>  		This symbolic link points to the PCI hotplug controller driver
>  		module that manages the hotplug slot.
> +
> +What:		/sys/bus/pci/devices/.../label
> +Date:		July 2010
> +Contact:	linux-bugs@dell.com

that's not your email address.  Please don't hide behind some random
address, Linux is about contacting developers directly were ever
possible.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH V3] Export SMBIOS provided firmware instance and label to sysfs
From: Matt Domsch @ 2010-07-23 14:58 UTC (permalink / raw)
  To: Greg KH
  Cc: Narendra K, netdev, linux-hotplug, linux-pci, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <20100723135557.GA3624@kroah.com>

On Fri, Jul 23, 2010 at 06:55:57AM -0700, Greg KH wrote:
> On Fri, Jul 23, 2010 at 08:34:56AM -0500, Narendra K wrote:
> > --- a/Documentation/ABI/testing/sysfs-bus-pci
> > +++ b/Documentation/ABI/testing/sysfs-bus-pci
> > @@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
> >  Description:
> >  		This symbolic link points to the PCI hotplug controller driver
> >  		module that manages the hotplug slot.
> > +
> > +What:		/sys/bus/pci/devices/.../label
> > +Date:		July 2010
> > +Contact:	linux-bugs@dell.com
> 
> that's not your email address.  Please don't hide behind some random
> address, Linux is about contacting developers directly were ever
> possible.

That's actually the public email address for the whole Linux
engineering team (including engineers and managers) at Dell, of which
Narendra is a part.  It's the address we publish for people to include
on the cc: list of bugzilla issues on the kernel.org, Novell, and Red
Hat bugzillas.  This ensures someone on the team will see bug reports
or patches and act accordingly, likely Narendra, but could be anyone
in the future once Narendra is promoted or changes responsibilities
(or even employers).

-Matt

-- 
Matt Domsch
Technology Strategist
Dell | Office of the CTO

^ permalink raw reply

* [PATCH V4] Export SMBIOS provided firmware instance and label to sysfs
From: Narendra K @ 2010-07-26 10:56 UTC (permalink / raw)
  To: netdev, linux-hotplug, linux-pci
  Cc: matt_domsch, charles_rose, jordan_hargrave, vijay_nijhawan

Hello,

V3 -> V4:

Updated the contact field in Documentation/ABI directory.

Please consider for inclusion -

From: Narendra K <narendra_k@dell.com>
Subject: [PATCH] Export SMBIOS provided firmware instance and label to sysfs

This patch exports SMBIOS provided firmware instance and label
of onboard pci devices to sysfs

Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Narendra K <narendra_k@dell.com>
---
 Documentation/ABI/testing/sysfs-bus-pci |   27 ++++++
 drivers/firmware/dmi_scan.c             |   25 ++++++
 drivers/pci/Makefile                    |    3 +
 drivers/pci/pci-label.c                 |  143 +++++++++++++++++++++++++++++++
 drivers/pci/pci-sysfs.c                 |    5 +
 drivers/pci/pci.h                       |    9 ++
 include/linux/dmi.h                     |    9 ++
 7 files changed, 221 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pci/pci-label.c

diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 428676c..11855ca 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
 Description:
 		This symbolic link points to the PCI hotplug controller driver
 		module that manages the hotplug slot.
+
+What:		/sys/bus/pci/devices/.../label
+Date:		July 2010
+Contact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given name(SMBIOS type 41 string) of the PCI device.
+		The attribute will be created only if the firmware
+		has given a name to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned name of the PCI device.
+
+What:		/sys/bus/pci/devices/.../index
+Date:		July 2010
+Contact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given instance(SMBIOS type 41 device type instance)
+		of the PCI device. The attribute will be created
+		only if the firmware has given a device type instance
+		to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned device type instance of the PCI
+		device that can help in understanding the firmware
+		intended order of the PCI device.
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index d464672..b3d22d6 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -277,6 +277,29 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
 	list_add_tail(&dev->list, &dmi_devices);
 }
 
+static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
+					int devfn, const char *name)
+{
+	struct dmi_dev_onboard *onboard_dev;
+
+	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
+	if (!onboard_dev) {
+		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
+		return;
+	}
+	onboard_dev->instance = instance;
+	onboard_dev->segment = segment;
+	onboard_dev->bus = bus;
+	onboard_dev->devfn = devfn;
+
+	strcpy((char *)&onboard_dev[1], name);
+	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
+	onboard_dev->dev.name = (char *)&onboard_dev[1];
+	onboard_dev->dev.device_data = onboard_dev;
+
+	list_add(&onboard_dev->dev.list, &dmi_devices);
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const u8 *d = (u8*) dm + 5;
@@ -285,6 +308,8 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	if ((*d & 0x80) = 0)
 		return;
 
+	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
+			     dmi_string_nosave(dm, *(d-1)));
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 0b51857..dc1aa09 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -55,6 +55,9 @@ obj-$(CONFIG_MICROBLAZE) += setup-bus.o
 #
 obj-$(CONFIG_ACPI)    += pci-acpi.o
 
+# SMBIOS provided firmware instance and labels
+obj-$(CONFIG_DMI)    += pci-label.o
+
 # Cardbus & CompactPCI use setup-bus
 obj-$(CONFIG_HOTPLUG) += setup-bus.o
 
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
new file mode 100644
index 0000000..111500e
--- /dev/null
+++ b/drivers/pci/pci-label.c
@@ -0,0 +1,143 @@
+/*
+ * Purpose: Export the firmware instance and label associated with
+ * a pci device to sysfs
+ * Copyright (C) 2010 Dell Inc.
+ * by Narendra K <Narendra_K@dell.com>,
+ * Jordan Hargrave <Jordan_Hargrave@dell.com>
+ *
+ * SMBIOS defines type 41 for onboard pci devices. This code retrieves
+ * the instance number and string from the type 41 record and exports
+ * it to sysfs.
+ *
+ * Please see http://linux.dell.com/wiki/index.php/Oss/libnetdevname for more
+ * information.
+ */
+
+#include <linux/dmi.h>
+#include <linux/sysfs.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include "pci.h"
+
+enum smbios_attr_enum {
+	SMBIOS_ATTR_NONE = 0,
+	SMBIOS_ATTR_LABEL_SHOW,
+	SMBIOS_ATTR_INSTANCE_SHOW,
+};
+
+static mode_t
+find_smbios_instance_string(struct pci_dev *pdev, char *buf,
+			    enum smbios_attr_enum attribute)
+{
+	const struct dmi_device *dmi;
+	struct dmi_dev_onboard *donboard;
+	int bus;
+	int devfn;
+
+	bus = pdev->bus->number;
+	devfn = pdev->devfn;
+
+	dmi = NULL;
+	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
+				      NULL, dmi)) != NULL) {
+		donboard = dmi->device_data;
+		if (donboard && donboard->bus = bus &&
+					donboard->devfn = devfn) {
+			if (buf) {
+				if (attribute = SMBIOS_ATTR_INSTANCE_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%d\n",
+							 donboard->instance);
+				else if (attribute = SMBIOS_ATTR_LABEL_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%s\n",
+							 dmi->name);
+			}
+			return strlen(dmi->name);
+		}
+	}
+	return 0;
+}
+
+static mode_t
+smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
+			     int n)
+{
+	struct device *dev;
+	struct pci_dev *pdev;
+
+	dev = container_of(kobj, struct device, kobj);
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ?
+					   S_IRUGO : 0;
+}
+
+static ssize_t
+smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_LABEL_SHOW);
+}
+
+static ssize_t
+smbiosinstance_show(struct device *dev,
+		    struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_INSTANCE_SHOW);
+}
+
+static struct device_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbioslabel_show,
+};
+
+static struct device_attribute smbios_attr_instance = {
+	.attr = {.name = "index", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosinstance_show,
+};
+
+static struct attribute *smbios_attributes[] = {
+	&smbios_attr_label.attr,
+	&smbios_attr_instance.attr,
+	NULL,
+};
+
+static struct attribute_group smbios_attr_group = {
+	.attrs = smbios_attributes,
+	.is_visible = smbios_instance_string_exist,
+};
+
+static int
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (!sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group))
+		return 0;
+	return -ENODEV;
+}
+
+static void
+pci_remove_smbiosname_file(struct pci_dev *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
+}
+
+void pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))
+		;
+}
+
+void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{
+	pci_remove_smbiosname_file(pdev);
+}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index afd2fbf..01fd799 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1132,6 +1132,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 
 	pci_create_slot_links(pdev);
 
+	pci_create_firmware_label_files(pdev);
+
 	return 0;
 
 err_vga_file:
@@ -1201,6 +1203,9 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 		sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr);
 		kfree(pdev->rom_attr);
 	}
+
+	pci_remove_firmware_label_files(pdev);
+
 }
 
 static int __init pci_sysfs_init(void)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f8077b3..d930338 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -11,6 +11,15 @@
 extern int pci_uevent(struct device *dev, struct kobj_uevent_env *env);
 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
+#ifndef CONFIG_DMI
+static inline void pci_create_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+static inline void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+#else
+extern void pci_create_firmware_label_files(struct pci_dev *pdev);
+extern void pci_remove_firmware_label_files(struct pci_dev *pdev);
+#endif
 extern void pci_cleanup_rom(struct pci_dev *dev);
 #ifdef HAVE_PCI_MMAP
 extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1a..90e087f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_SAS,
 	DMI_DEV_TYPE_IPMI = -1,
 	DMI_DEV_TYPE_OEM_STRING = -2,
+	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 };
 
 struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
 
 #ifdef CONFIG_DMI
 
+struct dmi_dev_onboard {
+	struct dmi_device dev;
+	int instance;
+	int segment;
+	int bus;
+	int devfn;
+};
+
 extern int dmi_check_system(const struct dmi_system_id *list);
 const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
 extern const char * dmi_get_system_info(int field);
-- 
1.6.5.2

With regards,
Narendra K

^ permalink raw reply related

* Re: [PATCH V3] Export SMBIOS provided firmware instance and label
From: Greg KH @ 2010-07-26 18:20 UTC (permalink / raw)
  To: Matt Domsch
  Cc: Narendra K, netdev, linux-hotplug, linux-pci, charles_rose,
	jordan_hargrave, vijay_nijhawan
In-Reply-To: <20100723145809.GA7629@auslistsprd01.us.dell.com>

On Fri, Jul 23, 2010 at 09:58:09AM -0500, Matt Domsch wrote:
> On Fri, Jul 23, 2010 at 06:55:57AM -0700, Greg KH wrote:
> > On Fri, Jul 23, 2010 at 08:34:56AM -0500, Narendra K wrote:
> > > --- a/Documentation/ABI/testing/sysfs-bus-pci
> > > +++ b/Documentation/ABI/testing/sysfs-bus-pci
> > > @@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
> > >  Description:
> > >  		This symbolic link points to the PCI hotplug controller driver
> > >  		module that manages the hotplug slot.
> > > +
> > > +What:		/sys/bus/pci/devices/.../label
> > > +Date:		July 2010
> > > +Contact:	linux-bugs@dell.com
> > 
> > that's not your email address.  Please don't hide behind some random
> > address, Linux is about contacting developers directly were ever
> > possible.
> 
> That's actually the public email address for the whole Linux
> engineering team (including engineers and managers) at Dell, of which
> Narendra is a part.  It's the address we publish for people to include
> on the cc: list of bugzilla issues on the kernel.org, Novell, and Red
> Hat bugzillas.  This ensures someone on the team will see bug reports
> or patches and act accordingly, likely Narendra, but could be anyone
> in the future once Narendra is promoted or changes responsibilities
> (or even employers).

Ok, I don't really like it, but if that's what Dell wants to do, I guess
it's acceptable.

thanks,

greg k-h

^ permalink raw reply

* Re: USB device random clash problem?
From: Alan Stern @ 2010-07-26 18:54 UTC (permalink / raw)
  To: linux-hotplug

Resending to Kay and linux-hotplug, as this appears to be a problem in
udev.  For this purpose, the parts concerning the java library and the
lack of a proper serial number can be ignored.

I get the feeling that the udev script could be improved; in particular
there probably should be a delay between loading the driver and
executing the stty command.  But there's likely more going wrong here
than just that.

Alan Stern


On Mon, 26 Jul 2010, Greg KH wrote:

> On Sun, Jul 25, 2010 at 09:01:06PM +0200, Ben Andersen wrote:
> > Hello,
> > 
> > I have 3 USB devices connected which are part of a cash register.
> > 
> > 1. USB Fiscal control unit (symlink: ttyS10)
> > 2. Serial Receipt printer on a USB2Serial converter (symlink: ttyS20)
> > 3. USB Customer display (symlink: ttyS30)
> > 
> > I need to know which ttyUSB* each device gets. I solved this with a udev
> > rules file with symlinks to ttyS* which works fine. I had to make them
> > ttyS* and not something like /dev/receiptprinter to have them working
> > with the java lib rxtx, it seems they have to have a "serial port name".
> 
> Sounds like a java library problem :)
> 
> > The ttyS30 device does not work with the common lucid kernel. So I had
> > to get the latest generic kernel, else it just does not work at all.
> > 
> > My only problem now is that the device that should come up as ttyS30
> > sometimes does not map to any ttyUSB* and hence the ttyS30 symlink
> > points to bus something instead of ttyUSB* and the device is unusable.
> > If I don't connect the ttyS10 device this is not a problem so it seems
> > there is some kind of clash that sometimes prevents the ttyS30 device
> > from working. They're both using the same driver (ftdi_sio) while ttyS20
> > is using pl2303.
> > 
> > My udev rules are as follows:
> > http://paste.ubuntu.com/468897/
> > 
> > When it works it looks like this:
> > http://paste.ubuntu.com/468881/
> > 
> > When it does not work it looks like this:
> > http://paste.ubuntu.com/468882/
> > 
> > Note this line when it's not working..
> > util_run_program: '/sbin/modprobe' (stderr) 'FATAL: Module
> > usb:v0519p0007d0400dc00dsc00dp00icFFiscFFipFF not found.'
> > 
> > I tried changing the rules file to only using idVendor as unique
> > selection and it seemed to work at first but now it's the same again.
> > Sometimes it works, sometimes it does not when starting up the computer.
> > 
> > It does always work it seems if plugging the ttyS10 device after startup
> > of the computer.
> > 
> > One side problem is that this line never works:
> > ATTRS{idVendor}="0519", ATTRS{idProduct}="0007", RUN+="/bin/stty -F
> > /dev/ttyS30 19200"
> > It works running the line from cmd-line or the script which starts the
> > POS-software. BUT not when I autstart the script in Ubuntu (startup
> > programs). It seems it's too early for ttyS30 to be completely finished??
> > 
> > Thanks for any help in this matter! It would be fantastic if Ubuntu
> > would work better as a POS system. I'm using Openbravo POS btw.
> 
> As this is a userspace udev issue, there's nothing that the kernel can
> do here really.  I'd recommend using a device with a unique serial
> number, and/or using the /dev/serial/ symlinks to get the proper
> persistant device name for your devices, so no matter what happens with
> the devices being found in any order, it will all "just work".
> 
> Oh, and go fix your java library, it shouldn't only work with old serial
> port names, that's a bad bug on its part.
> 
> good luck,
> 
> greg k-h



^ permalink raw reply

* Re: USB device random clash problem?
From: Kay Sievers @ 2010-07-26 19:00 UTC (permalink / raw)
  To: linux-hotplug
In-Reply-To: <Pine.LNX.4.44L0.1007261449390.1550-100000@iolanthe.rowland.org>

On Mon, Jul 26, 2010 at 20:54, Alan Stern <stern@rowland.harvard.edu> wrote:
> Resending to Kay and linux-hotplug, as this appears to be a problem in
> udev.  For this purpose, the parts concerning the java library and the
> lack of a proper serial number can be ignored.
>
> I get the feeling that the udev script could be improved; in particular
> there probably should be a delay between loading the driver and
> executing the stty command.  But there's likely more going wrong here
> than just that.

Not sure if that's the problem, but I guess these rules just can't
work. They match on anything and run several times per device in
parallel. They need real matches when they should trigger something.
Loading a module and running program a the device really needs
different rules to make sure the program runs only once, and at the
right device.

Kay

^ permalink raw reply

* [PATCH 0/9] udevadm sub commands adding short options in usage
From: Yin Kangkai @ 2010-07-28  3:10 UTC (permalink / raw)
  To: linux-hotplug

Hi,

This patchset adds short options in usage, also correct two short
options in getopt_long.

I can't not figure out the short options, neither from the "udevadm
subcommand -h", nor the man pages, except I looking into the code.

Hopefully this can be applied. Thanks.

Kangkai

^ permalink raw reply

* [PATCH 1/9] udevadm-info: export-prefix requires argument
From: Yin Kangkai @ 2010-07-28  3:13 UTC (permalink / raw)
  To: linux-hotplug

From 3331023e479ff38803eb43e73ab264b485e2dbd4 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 13:40:56 +0800
Subject: [PATCH 1/9] udevadm-info: export-prefix requires argument

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-info.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
index 14baa6a..9bd60c7 100644
--- a/udev/udevadm-info.c
+++ b/udev/udevadm-info.c
@@ -242,7 +242,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
 		int option;
 		struct stat statbuf;
 
-		option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL);
+		option = getopt_long(argc, argv, "aed:n:p:q:rxP:Vh", options, NULL);
 		if (option = -1)
 			break;
 
-- 
1.6.5


^ permalink raw reply related

* [PATCH 2/9] udevadm-info: add short options in Usage
From: Yin Kangkai @ 2010-07-28  3:14 UTC (permalink / raw)
  To: linux-hotplug

From 9ae52c366fbdf25d169b6dae06782857a068a6cd Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 13:44:49 +0800
Subject: [PATCH 2/9] udevadm-info: add short options in Usage

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-info.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
index 9bd60c7..61a6f84 100644
--- a/udev/udevadm-info.c
+++ b/udev/udevadm-info.c
@@ -347,20 +347,23 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
 			goto exit;
 		case 'h':
 			printf("Usage: udevadm info OPTIONS\n"
-			       "  --query=<type>             query device information:\n"
-			       "      name                     name of device node\n"
-			       "      symlink                  pointing to node\n"
-			       "      path                     sys device path\n"
-			       "      property                 the device properties\n"
-			       "      all                      all values\n"
-			       "  --path=<syspath>           sys device path used for query or attribute walk\n"
-			       "  --name=<name>              node or symlink name used for query or attribute walk\n"
-			       "  --root                     prepend dev directory to path names\n"
-			       "  --attribute-walk           print all key matches while walking along the chain\n"
-			       "                             of parent devices\n"
-			       "  --device-id-of-file=<file> print major:minor of device containing this file\n"
-			       "  --export-db                export the content of the udev database\n"
-			       "  --help\n\n");
+			       "  -q, --query=<type>             query device information:\n"
+			       "      name                         name of device node\n"
+			       "      symlink                      pointing to node\n"
+			       "      path                         sys device path\n"
+			       "      property                     the device properties\n"
+			       "      all                          all values\n"
+			       "  -p, --path=<syspath>           sys device path used for query or\n"
+			       "                                 attribute walk\n"
+			       "  -n, --name=<name>              node or symlink name used for query or\n"
+			       "                                 attribute walk\n"
+			       "  -r, --root                     prepend dev directory to path names\n"
+			       "  -a, --attribute-walk           print all key matches while walking along\n"
+			       "                                 the chain of parent devices\n"
+			       "  -d, --device-id-of-file=<file> print major:minor of device containing\n"
+			       "                                 this file\n"
+			       "  -e, --export-db                export the content of the udev database\n"
+			       "  -h, --help\n\n");
 			goto exit;
 		default:
 			goto exit;
-- 
1.6.5


^ permalink raw reply related

* [PATCH 3/9] udevadm-info: add usage for --export and
From: Yin Kangkai @ 2010-07-28  3:15 UTC (permalink / raw)
  To: linux-hotplug

From c9b30ed029332746b98c5039f39f70e21a286787 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 16:04:03 +0800
Subject: [PATCH 3/9] udevadm-info: add usage for --export and --export-prefix

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-info.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
index 61a6f84..4262a8c 100644
--- a/udev/udevadm-info.c
+++ b/udev/udevadm-info.c
@@ -362,6 +362,8 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
 			       "                                 the chain of parent devices\n"
 			       "  -d, --device-id-of-file=<file> print major:minor of device containing\n"
 			       "                                 this file\n"
+			       "  -x, --export                   more readable major:minor, for -d\n"
+			       "  -P, --export-prefix            prefix for major and minor, for -d and -x\n"
 			       "  -e, --export-db                export the content of the udev database\n"
 			       "  -h, --help\n\n");
 			goto exit;
-- 
1.6.5


^ permalink raw reply related

* [PATCH 4/9] udevadm-monitor: add the short options in Usage
From: Yin Kangkai @ 2010-07-28  3:15 UTC (permalink / raw)
  To: linux-hotplug

From 6decea1de891031f1bad0df91ed9f0d5ffaac529 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 16:15:38 +0800
Subject: [PATCH 4/9] udevadm-monitor: add the short options in Usage

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-monitor.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
index 85252bb..9efed6e 100644
--- a/udev/udevadm-monitor.c
+++ b/udev/udevadm-monitor.c
@@ -126,13 +126,13 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
 			udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0, 0);
 			break;
 		case 'h':
-			printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n"
-			       "  --property                              print the event properties\n"
-			       "  --kernel                                print kernel uevents\n"
-			       "  --udev                                  print udev events\n"
-			       "  --subsystem-match=<subsystem[/devtype]> filter events by subsystem\n"
-			       "  --tag-match=<tag>                       filter events by tag\n"
-			       "  --help\n\n");
+			printf("Usage: udevadm monitor OPTIONS\n"
+			       "  -p, --property                              print the event properties\n"
+			       "  -k, --kernel                                print kernel uevents\n"
+			       "  -u, --udev                                  print udev events\n"
+			       "  -s, --subsystem-match=<subsystem[/devtype]> filter events by subsystem\n"
+			       "  -t, --tag-match=<tag>                       filter events by tag\n"
+			       "  -h, --help\n\n");
 		default:
 			goto out;
 		}
-- 
1.6.5


^ permalink raw reply related

* [PATCH 5/9] udevadm-control: rm short options that not used
From: Yin Kangkai @ 2010-07-28  3:16 UTC (permalink / raw)
  To: linux-hotplug

From 3aee4b9a71ceb175eb0a69efb6fc243500598532 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 16:33:39 +0800
Subject: [PATCH 5/9] udevadm-control: rm short options that not used

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-control.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c
index 1f8008a..8b90829 100644
--- a/udev/udevadm-control.c
+++ b/udev/udevadm-control.c
@@ -71,7 +71,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[])
 		int i;
 		char *endp;
 
-		option = getopt_long(argc, argv, "l:sSRp:m:M:h", options, NULL);
+		option = getopt_long(argc, argv, "l:sSRp:m:h", options, NULL);
 		if (option = -1)
 			break;
 
-- 
1.6.5


^ permalink raw reply related

* [PATCH 6/9] udevadm-control: add short options in Usage
From: Yin Kangkai @ 2010-07-28  3:16 UTC (permalink / raw)
  To: linux-hotplug

From b0bb14092c150b3a17587b1a69aa1c35e3173e41 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Tue, 27 Jul 2010 16:36:23 +0800
Subject: [PATCH 6/9] udevadm-control: add short options in Usage

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 udev/udevadm-control.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c
index 8b90829..8520b8b 100644
--- a/udev/udevadm-control.c
+++ b/udev/udevadm-control.c
@@ -29,14 +29,14 @@
 
 static void print_help(void)
 {
-	printf("Usage: udevadm control COMMAND\n"
-		"  --log-priority=<level>   set the udev log level for the daemon\n"
-		"  --stop-exec-queue        keep udevd from executing events, queue only\n"
-		"  --start-exec-queue       execute events, flush queue\n"
-		"  --reload-rules           reloads the rules files\n"
-		"  --property=<KEY>=<value> set a global property for all events\n"
-		"  --children-max=<N>       maximum number of children\n"
-		"  --help                   print this help text\n\n");
+	printf("Usage: udevadm control OPTIONS\n"
+		"  -l, --log-priority=<level>   set the udev log level for the daemon\n"
+		"  -s, --stop-exec-queue        keep udevd from executing events, queue only\n"
+		"  -S, --start-exec-queue       execute events, flush queue\n"
+		"  -R, --reload-rules           reloads the rules files\n"
+		"  -p, --property=<KEY>=<value> set a global property for all events\n"
+		"  -m, --children-max=<N>       maximum number of children\n"
+		"  -h, --help                   print this help text\n\n");
 }
 
 int udevadm_control(struct udev *udev, int argc, char *argv[])
-- 
1.6.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox