From 4296121bedf892ab13cbeef7ec44842efda2b666 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 23 Dec 2005 16:41:41 +0000 Subject: [PATCH] --- yaml --- r: 15511 b: refs/heads/master c: a9714c845c0681a203a9ae22aa5165ec72c51d33 h: refs/heads/master i: 15509: 1200bbc3f72494bd5bc4e6537f0d152576f2be91 15507: 80220d51ea190894261466ac423da46b57e56d7c 15503: 876003036926414eed33251afabec546e65507ba v: v3 --- [refs] | 2 +- trunk/drivers/usb/class/usblp.c | 35 ++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index 6284b9adefe5..a488606a748a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 318e479eb7ad9a948c6da381976d258464413816 +refs/heads/master: a9714c845c0681a203a9ae22aa5165ec72c51d33 diff --git a/trunk/drivers/usb/class/usblp.c b/trunk/drivers/usb/class/usblp.c index 708a292e5a0d..27e9404547f3 100644 --- a/trunk/drivers/usb/class/usblp.c +++ b/trunk/drivers/usb/class/usblp.c @@ -850,6 +850,20 @@ static struct usb_class_driver usblp_class = { .minor_base = USBLP_MINOR_BASE, }; +static ssize_t usblp_show_ieee1284_id(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct usb_interface *intf = to_usb_interface(dev); + struct usblp *usblp = usb_get_intfdata (intf); + + if (usblp->device_id_string[0] == 0 && + usblp->device_id_string[1] == 0) + return 0; + + return sprintf(buf, "%s", usblp->device_id_string+2); +} + +static DEVICE_ATTR(ieee1284_id, S_IRUGO, usblp_show_ieee1284_id, NULL); + static int usblp_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -934,20 +948,12 @@ static int usblp_probe(struct usb_interface *intf, /* Retrieve and store the device ID string. */ usblp_cache_device_id_string(usblp); + device_create_file(&intf->dev, &dev_attr_ieee1284_id); #ifdef DEBUG usblp_check_status(usblp, 0); #endif - info("usblp%d: USB %sdirectional printer dev %d " - "if %d alt %d proto %d vid 0x%4.4X pid 0x%4.4X", - usblp->minor, usblp->bidir ? "Bi" : "Uni", dev->devnum, - usblp->ifnum, - usblp->protocol[usblp->current_protocol].alt_setting, - usblp->current_protocol, - le16_to_cpu(usblp->dev->descriptor.idVendor), - le16_to_cpu(usblp->dev->descriptor.idProduct)); - usb_set_intfdata (intf, usblp); usblp->present = 1; @@ -958,11 +964,20 @@ static int usblp_probe(struct usb_interface *intf, goto abort_intfdata; } usblp->minor = intf->minor; + info("usblp%d: USB %sdirectional printer dev %d " + "if %d alt %d proto %d vid 0x%4.4X pid 0x%4.4X", + usblp->minor, usblp->bidir ? "Bi" : "Uni", dev->devnum, + usblp->ifnum, + usblp->protocol[usblp->current_protocol].alt_setting, + usblp->current_protocol, + le16_to_cpu(usblp->dev->descriptor.idVendor), + le16_to_cpu(usblp->dev->descriptor.idProduct)); return 0; abort_intfdata: usb_set_intfdata (intf, NULL); + device_remove_file(&intf->dev, &dev_attr_ieee1284_id); abort: if (usblp) { if (usblp->writebuf) @@ -1157,6 +1172,8 @@ static void usblp_disconnect(struct usb_interface *intf) BUG (); } + device_remove_file(&intf->dev, &dev_attr_ieee1284_id); + down (&usblp_sem); down (&usblp->sem); usblp->present = 0;