Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15511
b: refs/heads/master
c: a9714c8
h: refs/heads/master
i:
  15509: 1200bbc
  15507: 80220d5
  15503: 8760030
v: v3
  • Loading branch information
David Woodhouse authored and Greg Kroah-Hartman committed Jan 4, 2006
1 parent 2f20962 commit 4296121
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 318e479eb7ad9a948c6da381976d258464413816
refs/heads/master: a9714c845c0681a203a9ae22aa5165ec72c51d33
35 changes: 26 additions & 9 deletions trunk/drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4296121

Please sign in to comment.