[BACK]Return to usb_subr.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / usb

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/usb/usb_subr.c between version 1.51 and 1.52

version 1.51, 1999/10/12 20:02:48 version 1.52, 1999/10/13 08:10:58
Line 224  usbd_devinfo_vp(dev, v, p)
Line 224  usbd_devinfo_vp(dev, v, p)
         struct usb_knowndev *kdp;          struct usb_knowndev *kdp;
 #endif  #endif
   
           if (!dev) {
                   v[0] = p[0] = '\0';
                   return;
           }
   
         vendor = usbd_get_string(dev, udd->iManufacturer, v);          vendor = usbd_get_string(dev, udd->iManufacturer, v);
         product = usbd_get_string(dev, udd->iProduct, p);          product = usbd_get_string(dev, udd->iProduct, p);
 #ifdef USBVERBOSE  #ifdef USBVERBOSE
Line 739  usbd_probe_and_attach(parent, dev, port,
Line 744  usbd_probe_and_attach(parent, dev, port,
          * during probe and attach. Should be changed however.           * during probe and attach. Should be changed however.
          */           */
         device_t bdev;          device_t bdev;
         bdev = device_add_child(*parent, NULL, -1, &uaa);          bdev = device_add_child(parent, NULL, -1, &uaa);
         if (!bdev) {          if (!bdev) {
             printf("%s: Device creation failed\n", USBDEVNAME(dev->bus->bdev));              printf("%s: Device creation failed\n", USBDEVNAME(dev->bus->bdev));
             return (USBD_INVAL);              return (USBD_INVAL);
         }          }
           device_quiet(bdev);
 #endif  #endif
   
         uaa.device = dev;          uaa.device = dev;
Line 786  usbd_probe_and_attach(parent, dev, port,
Line 792  usbd_probe_and_attach(parent, dev, port,
                                USBDEVPTRNAME(parent), port, addr);                                 USBDEVPTRNAME(parent), port, addr);
 #endif  #endif
 #if defined(__FreeBSD__)  #if defined(__FreeBSD__)
                         device_delete_child(*parent, bdev);                          device_delete_child(parent, bdev);
 #endif  #endif
   
                         return (r);                          return (r);
                 }                  }
                 nifaces = dev->cdesc->bNumInterface;                  nifaces = dev->cdesc->bNumInterface;
Line 797  usbd_probe_and_attach(parent, dev, port,
Line 804  usbd_probe_and_attach(parent, dev, port,
                 uaa.ifaces = ifaces;                  uaa.ifaces = ifaces;
                 uaa.nifaces = nifaces;                  uaa.nifaces = nifaces;
                 dev->subdevs = malloc((nifaces+1) * sizeof dv, M_USB,M_NOWAIT);                  dev->subdevs = malloc((nifaces+1) * sizeof dv, M_USB,M_NOWAIT);
                 if (dev->subdevs == 0)                  if (dev->subdevs == 0) {
   #if defined(__FreeBSD__)
                           device_delete_child(parent, bdev);
   #endif
                         return (USBD_NOMEM);                          return (USBD_NOMEM);
                 for (found = i = 0; i < nifaces; i++) {                  }
   
                   found = 0;
                   for (i = 0; i < nifaces; i++) {
                         if (!ifaces[i])                          if (!ifaces[i])
                                 continue; /* interface already claimed */                                  continue; /* interface already claimed */
                         uaa.iface = ifaces[i];                          uaa.iface = ifaces[i];
Line 810  usbd_probe_and_attach(parent, dev, port,
Line 823  usbd_probe_and_attach(parent, dev, port,
                                 dev->subdevs[found++] = dv;                                  dev->subdevs[found++] = dv;
                                 dev->subdevs[found] = 0;                                  dev->subdevs[found] = 0;
                                 ifaces[i] = 0; /* consumed */                                  ifaces[i] = 0; /* consumed */
   
   #if defined(__FreeBSD__)
                                   /* create another child for the next iface */
                                   bdev = device_add_child(parent, NULL, -1,&uaa);
                                   if (!bdev) {
                                           printf("%s: Device creation failed\n",
                                           USBDEVNAME(dev->bus->bdev));
                                           return (USBD_NORMAL_COMPLETION);
                                   }
                                   device_quiet(bdev);
   #endif
                         }                          }
                 }                  }
                 if (found != 0)                  if (found != 0) {
   #if defined(__FreeBSD__)
                           /* remove the last created child again; it is unused */
                           device_delete_child(parent, bdev);
   #endif
                         return (USBD_NORMAL_COMPLETION);                          return (USBD_NORMAL_COMPLETION);
                   }
                 free(dev->subdevs, M_USB);                  free(dev->subdevs, M_USB);
                 dev->subdevs = 0;                  dev->subdevs = 0;
         }          }
Line 849  usbd_probe_and_attach(parent, dev, port,
Line 878  usbd_probe_and_attach(parent, dev, port,
          */           */
         DPRINTF(("usbd_probe_and_attach: generic attach failed\n"));          DPRINTF(("usbd_probe_and_attach: generic attach failed\n"));
 #if defined(__FreeBSD__)  #if defined(__FreeBSD__)
 /*          device_delete_child(parent, bdev);
  * XXX should we delete the child again? Left for now to avoid dangling  
  * references.  
       device_delete_child(*parent, bdev);  
 */  
 #endif  #endif
         return (USBD_NORMAL_COMPLETION);          return (USBD_NORMAL_COMPLETION);
 }  }
Line 1100  usbd_submatch(parent, match, aux)
Line 1125  usbd_submatch(parent, match, aux)
         return ((*cf->cf_attach->ca_match)(parent, cf, aux));          return ((*cf->cf_attach->ca_match)(parent, cf, aux));
 }  }
   
 #elif defined(__FreeBSD__)  
 static void  
 usbd_bus_print_child(device_t bus, device_t dev)  
 {  
         /* FIXME print the device address and the configuration used  
          */  
 }  
 #endif  #endif
   
 void  void
Line 1218  usb_disconnect_port(up, parent)
Line 1236  usb_disconnect_port(up, parent)
   
         if (dev->subdevs) {          if (dev->subdevs) {
                 for (i = 0; dev->subdevs[i]; i++) {                  for (i = 0; dev->subdevs[i]; i++) {
                           if (!dev->subdevs[i])   /* skip empty elements */
                                   continue;
   
                         printf("%s: at %s", USBDEVPTRNAME(dev->subdevs[i]),                          printf("%s: at %s", USBDEVPTRNAME(dev->subdevs[i]),
                                hubname);                                 hubname);
                         if (up->portno != 0)                          if (up->portno != 0)
Line 1231  usb_disconnect_port(up, parent)
Line 1252  usb_disconnect_port(up, parent)
         dev->bus->devices[dev->address] = 0;          dev->bus->devices[dev->address] = 0;
         up->device = 0;          up->device = 0;
         usb_free_device(dev);          usb_free_device(dev);
   
 #if defined(__FreeBSD__)  
       device_delete_child(  
           device_get_parent(((struct softc *)dev->softc)->sc_dev),  
           ((struct softc *)dev->softc)->sc_dev);  
 #endif  
 }  }
   

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

CVSweb <webmaster@jp.NetBSD.org>