[BACK]Return to ustir.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/ustir.c between version 1.14 and 1.14.2.5

version 1.14, 2005/05/11 10:02:29 version 1.14.2.5, 2008/02/27 08:36:48
Line 176  struct ustir_softc {
Line 176  struct ustir_softc {
         u_int                   sc_rd_expectdataticks;          u_int                   sc_rd_expectdataticks;
         u_char                  sc_rd_err;          u_char                  sc_rd_err;
         struct framestate       sc_framestate;          struct framestate       sc_framestate;
         struct proc             *sc_thread;          struct lwp              *sc_thread;
         struct selinfo          sc_rd_sel;          struct selinfo          sc_rd_sel;
   
         u_int8_t                *sc_wr_buf;          u_int8_t                *sc_wr_buf;
Line 209  struct ustir_softc {
Line 209  struct ustir_softc {
 #define USTIR_WR_TIMEOUT 200  #define USTIR_WR_TIMEOUT 200
   
 Static int ustir_activate(device_ptr_t self, enum devact act);  Static int ustir_activate(device_ptr_t self, enum devact act);
 Static int ustir_open(void *h, int flag, int mode, usb_proc_ptr p);  Static int ustir_open(void *h, int flag, int mode, struct lwp *l);
 Static int ustir_close(void *h, int flag, int mode, usb_proc_ptr p);  Static int ustir_close(void *h, int flag, int mode, struct lwp *l);
 Static int ustir_read(void *h, struct uio *uio, int flag);  Static int ustir_read(void *h, struct uio *uio, int flag);
 Static int ustir_write(void *h, struct uio *uio, int flag);  Static int ustir_write(void *h, struct uio *uio, int flag);
 Static int ustir_set_params(void *h, struct irda_params *params);  Static int ustir_set_params(void *h, struct irda_params *params);
 Static int ustir_get_speeds(void *h, int *speeds);  Static int ustir_get_speeds(void *h, int *speeds);
 Static int ustir_get_turnarounds(void *h, int *times);  Static int ustir_get_turnarounds(void *h, int *times);
 Static int ustir_poll(void *h, int events, usb_proc_ptr p);  Static int ustir_poll(void *h, int events, struct lwp *l);
 Static int ustir_kqfilter(void *h, struct knote *kn);  Static int ustir_kqfilter(void *h, struct knote *kn);
   
 #ifdef USTIR_DEBUG_IOCTLS  #ifdef USTIR_DEBUG_IOCTLS
 Static int ustir_ioctl(void *h, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p);  Static int ustir_ioctl(void *h, u_long cmd, void *addr, int flag, struct lwp *l);
 #endif  #endif
   
 Static struct irframe_methods const ustir_methods = {  Static struct irframe_methods const ustir_methods = {
Line 288  ustir_dumpdata(u_int8_t const *data, siz
Line 288  ustir_dumpdata(u_int8_t const *data, siz
 }  }
 #endif  #endif
   
 USB_DECLARE_DRIVER(ustir);  int ustir_match(device_t, struct cfdata *, void *);
   void ustir_attach(device_t, device_t, void *);
   void ustir_childdet(device_t, device_t);
   int ustir_detach(device_t, int);
   int ustir_activate(device_t, enum devact);
   extern struct cfdriver ustir_cd;
   CFATTACH_DECL2(ustir, sizeof(struct ustir_softc), ustir_match,
       ustir_attach, ustir_detach, ustir_activate, NULL, ustir_childdet);
   
 USB_MATCH(ustir)  USB_MATCH(ustir)
 {  {
Line 296  USB_MATCH(ustir)
Line 303  USB_MATCH(ustir)
   
         DPRINTFN(50,("ustir_match\n"));          DPRINTFN(50,("ustir_match\n"));
   
         if (uaa->iface == NULL)  
                 return UMATCH_NONE;  
   
         if (uaa->vendor == USB_VENDOR_SIGMATEL &&          if (uaa->vendor == USB_VENDOR_SIGMATEL &&
             uaa->product == USB_PRODUCT_SIGMATEL_IRDA)              uaa->product == USB_PRODUCT_SIGMATEL_IRDA)
                 return UMATCH_VENDOR_PRODUCT;                  return UMATCH_VENDOR_PRODUCT;
Line 310  USB_ATTACH(ustir)
Line 314  USB_ATTACH(ustir)
 {  {
         USB_ATTACH_START(ustir, sc, uaa);          USB_ATTACH_START(ustir, sc, uaa);
         usbd_device_handle dev = uaa->device;          usbd_device_handle dev = uaa->device;
         usbd_interface_handle iface = uaa->iface;          usbd_interface_handle iface;
         char *devinfop;          char *devinfop;
         usb_endpoint_descriptor_t *ed;          usb_endpoint_descriptor_t *ed;
         u_int8_t epcount;          u_int8_t epcount;
Line 324  USB_ATTACH(ustir)
Line 328  USB_ATTACH(ustir)
         printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop);          printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop);
         usbd_devinfo_free(devinfop);          usbd_devinfo_free(devinfop);
   
           if (usbd_set_config_index(dev, 0, 1)
               || usbd_device2interface_handle(dev, 0, &iface)) {
                   printf("%s: Configuration failed\n", USBDEVNAME(sc->sc_dev));
                   USB_ATTACH_ERROR_RETURN;
           }
   
         sc->sc_udev = dev;          sc->sc_udev = dev;
         sc->sc_iface = iface;          sc->sc_iface = iface;
   
Line 366  USB_ATTACH(ustir)
Line 376  USB_ATTACH(ustir)
         USB_ATTACH_SUCCESS_RETURN;          USB_ATTACH_SUCCESS_RETURN;
 }  }
   
   void
   ustir_childdet(device_t self, device_t child)
   {
           struct ustir_softc *sc = device_private(self);
   
           KASSERT(sc->sc_child == child);
           sc->sc_child = NULL;
   }
   
 USB_DETACH(ustir)  USB_DETACH(ustir)
 {  {
         USB_DETACH_START(ustir, sc);          USB_DETACH_START(ustir, sc);
Line 402  USB_DETACH(ustir)
Line 421  USB_DETACH(ustir)
         }          }
         splx(s);          splx(s);
   
         if (sc->sc_child != NULL) {          if (sc->sc_child != NULL)
                 rv = config_detach(sc->sc_child, flags);                  rv = config_detach(sc->sc_child, flags);
                 sc->sc_child = NULL;  
         }  
   
         usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,          usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
                            USBDEV(sc->sc_dev));                             USBDEV(sc->sc_dev));
Line 837  ustir_start_read(struct ustir_softc *sc)
Line 854  ustir_start_read(struct ustir_softc *sc)
 }  }
   
 Static int  Static int
 ustir_activate(device_ptr_t self, enum devact act)  ustir_activate(device_t self, enum devact act)
 {  {
         struct ustir_softc *sc = (struct ustir_softc *)self;          struct ustir_softc *sc = device_private(self);
         int error = 0;          int error = 0;
   
         switch (act) {          switch (act) {
Line 857  ustir_activate(device_ptr_t self, enum d
Line 874  ustir_activate(device_ptr_t self, enum d
   
 /* ARGSUSED */  /* ARGSUSED */
 Static int  Static int
 ustir_open(void *h, int flag, int mode, usb_proc_ptr p)  ustir_open(void *h, int flag, int mode,
       struct lwp *l)
 {  {
         struct ustir_softc *sc = h;          struct ustir_softc *sc = h;
         int error;          int error;
Line 919  ustir_open(void *h, int flag, int mode, 
Line 937  ustir_open(void *h, int flag, int mode, 
         deframe_init(&sc->sc_framestate, &framedef_sir, sc->sc_ur_buf,          deframe_init(&sc->sc_framestate, &framedef_sir, sc->sc_ur_buf,
                      IRDA_MAX_FRAME_SIZE);                       IRDA_MAX_FRAME_SIZE);
   
         error = kthread_create1(ustir_thread, sc, &sc->sc_thread, "%s",  
                                 sc->sc_dev.dv_xname);  
         if (error)  
                 goto bad5;  
         /* Increment reference for thread */          /* Increment reference for thread */
         sc->sc_refcnt++;          sc->sc_refcnt++;
   
           error = kthread_create(PRI_NONE, 0, NULL, ustir_thread, sc,
               &sc->sc_thread, "%s", sc->sc_dev.dv_xname);
           if (error) {
                   sc->sc_refcnt--;
                   goto bad5;
           }
   
         return 0;          return 0;
   
  bad5:   bad5:
Line 946  ustir_open(void *h, int flag, int mode, 
Line 967  ustir_open(void *h, int flag, int mode, 
   
 /* ARGSUSED */  /* ARGSUSED */
 Static int  Static int
 ustir_close(void *h, int flag, int mode, usb_proc_ptr p)  ustir_close(void *h, int flag, int mode,
       struct lwp *l)
 {  {
         struct ustir_softc *sc = h;          struct ustir_softc *sc = h;
   
Line 1186  ustir_write(void *h, struct uio *uio, in
Line 1208  ustir_write(void *h, struct uio *uio, in
 }  }
   
 Static int  Static int
 ustir_poll(void *h, int events, usb_proc_ptr p)  ustir_poll(void *h, int events, struct lwp *l)
 {  {
         struct ustir_softc *sc = h;          struct ustir_softc *sc = h;
         int revents = 0;          int revents = 0;
Line 1199  ustir_poll(void *h, int events, usb_proc
Line 1221  ustir_poll(void *h, int events, usb_proc
                 } else {                  } else {
                         DPRINTFN(2,("%s: recording write select\n",                          DPRINTFN(2,("%s: recording write select\n",
                                     __func__));                                      __func__));
                         selrecord(p, &sc->sc_wr_sel);                          selrecord(l, &sc->sc_wr_sel);
                 }                  }
         }          }
   
Line 1210  ustir_poll(void *h, int events, usb_proc
Line 1232  ustir_poll(void *h, int events, usb_proc
                 } else {                  } else {
                         DPRINTFN(2,("%s: recording read select\n",                          DPRINTFN(2,("%s: recording read select\n",
                                     __func__));                                      __func__));
                         selrecord(p, &sc->sc_rd_sel);                          selrecord(l, &sc->sc_rd_sel);
                 }                  }
         }          }
   
Line 1281  ustir_kqfilter(void *h, struct knote *kn
Line 1303  ustir_kqfilter(void *h, struct knote *kn
                 kn->kn_fop = &ustirwrite_filtops;                  kn->kn_fop = &ustirwrite_filtops;
                 break;                  break;
         default:          default:
                 return (1);                  return (EINVAL);
         }          }
   
         kn->kn_hook = sc;          kn->kn_hook = sc;
Line 1294  ustir_kqfilter(void *h, struct knote *kn
Line 1316  ustir_kqfilter(void *h, struct knote *kn
 }  }
   
 #ifdef USTIR_DEBUG_IOCTLS  #ifdef USTIR_DEBUG_IOCTLS
 Static int ustir_ioctl(void *h, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p)  Static int ustir_ioctl(void *h, u_long cmd, void *addr, int flag, struct lwp *l)
 {  {
         struct ustir_softc *sc = h;          struct ustir_softc *sc = h;
         int error;          int error;

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.14.2.5

CVSweb <webmaster@jp.NetBSD.org>