From: Adam Belay This patch adds some additional information to sysfs for pnp cards. It should be useful for userland tools. --- drivers/pnp/card.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) diff -puN drivers/pnp/card.c~pnp-additional-sysfs-info drivers/pnp/card.c --- 25/drivers/pnp/card.c~pnp-additional-sysfs-info 2004-01-29 22:40:37.000000000 -0800 +++ 25-akpm/drivers/pnp/card.c 2004-01-29 22:40:37.000000000 -0800 @@ -139,6 +139,39 @@ static void pnp_release_card(struct devi kfree(card); } + +static ssize_t pnp_show_card_name(struct device *dmdev, char *buf) +{ + char *str = buf; + struct pnp_card *card = to_pnp_card(dmdev); + str += sprintf(str,"%s\n", card->name); + return (str - buf); +} + +static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL); + +static ssize_t pnp_show_card_ids(struct device *dmdev, char *buf) +{ + char *str = buf; + struct pnp_card *card = to_pnp_card(dmdev); + struct pnp_id * pos = card->id; + + while (pos) { + str += sprintf(str,"%s\n", pos->id); + pos = pos->next; + } + return (str - buf); +} + +static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL); + +static int pnp_interface_attach_card(struct pnp_card *card) +{ + device_create_file(&card->dev,&dev_attr_name); + device_create_file(&card->dev,&dev_attr_card_id); + return 0; +} + /** * pnp_add_card - adds a PnP card to the PnP Layer * @card: pointer to the card to add @@ -158,6 +191,7 @@ int pnp_add_card(struct pnp_card * card) error = device_register(&card->dev); if (error == 0) { + pnp_interface_attach_card(card); spin_lock(&pnp_lock); list_add_tail(&card->global_list, &pnp_cards); list_add_tail(&card->protocol_list, &card->protocol->cards); _