MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers         usbregisterhotplugcbs(9F)



NAME
     usbregisterhotplugcbs,    usbunregisterhotplugcbs    -
     Register/unregister   for  notification  of  device  hotplug
     events

SYNOPSIS
     #include 



     int usbregisterhotplugcbs(devinfot *dip,
          int (*disconnectioneventhandler)(devinfot *dip,
          int (*reconnectioneventhandler)(devinfot *dip);


      void usbunregisterhotplugcbs(devinfot *dip);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI)

PARAMETERS
     For usbregisterhotplugcbs()

     dip

         Pointer to the device's devinfo structure.


     disconnectioneventhandler

         Called when device is disconnected. This handler takes a
         devinfot as an argument (representing the device being
         disconnected) and always returns USBSUCES.


     reconnectioneventhandler

         Called when device is reconnected. This handler takes  a
         devinfot as an argument (representing the device being
         reconnected) and always returns USBSUCES.



     For usbunregisterhotplugcbs():

     dip    Pointer to the device's devinfo structure.


DESCRIPTION
     The usbregisterhotplugcbs() function registers  callbacks
     to  be  executed  when  the USB device represented by dip is



SunOS 5.11          Last change: 17 Aug 2004                    1






Kernel Functions for Drivers         usbregisterhotplugcbs(9F)



     hotplugged or removed.


     The  usbunregisterhotplugcbs()  function  unregisters  or
     disengages  callbacks  from  executing  when  the USB device
     represented by dip is hotplugged or removed.

RETURN VALUES
     For usbregisterhotplugcbs():

     USBSUCES    Callbacks were successfully registered.


     USBFAILURE    One or more arguments were NUL.

                    Callbacks   could   not    be    successfully
                    registered.



     For usbunregisterhotplugcbs(): None

CONTEXT
     The usbregisterhotplugcbs() function may be  called  only
     from attach(9E).


     The usbunregisterhotplugcbs() function may be called only
     from detach(9E).


     Registered callback handlers requiring the use  of  any  DI
     (section 9F) function (except dditaskq* functions), should
     launch a separate thread using dditaskq* routines for pro-
     cessing  their event, to avoid deadlocks. The new thread can
     then safely call any DI function it  needs  to  handle  the
     event.


     The registered callback handlers execute in kernel context.

EXAMPLES

           int removedevice(devinfot *)
           {
                   ...
                   ...
                   return (USBSUCES);
           }

           int accommodatedevice(devinfot *)
           {



SunOS 5.11          Last change: 17 Aug 2004                    2






Kernel Functions for Drivers         usbregisterhotplugcbs(9F)



                   ...
                   ...
                   return (USBSUCES);
           }

           if (usbregisterhotplugcbs(
               dip, removedevice, accommodatedevice) == USBFAILURE) {
                   cmnerr (CEWARN,
                       "%s%d: Could not register hotplug handlers.",
                       ddidrivername(dip), ddigetinstance(dip));
           }



ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Architecture                 PCI-based systems           
    
     Interface stability          Committed                   
    
     Availability                 SUNWusb                     
    


SEE ALSO
     attributes(5), attach(9E), detach(9E), usbgetstatus(9F)






















SunOS 5.11          Last change: 17 Aug 2004                    3



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™