0 Replies Latest reply on Jul 14, 2014 3:24 PM by 314ee68a-d163-4d8d-b785-3d792f6a6aa4

    Controlling Device Access: USB client driver is not attaching again on resetting the device if device is open by an application


      Dear All,


      I am working on USB 2.0 client driver of Solaris 5.10 server. The driver is not getting attached again with the device after resetting it by an application (Upgrade the firmware of Device). Below is the bug scenario:


      Note: xxxx_open() and xxxx_close() are DDI/DKI driver routine provided in the character/block driver  operations structure.


      1. Two applications, A and B, open the USB device by calling open(2) system call on a block special file associated with the minor device.

      2. Application A tries to upgrade the firmware of device so it fires RESET command while application B is accessing the driver. After resetting the device, application A calls the close system call. But corresponding driver routine xxxx_close is not called because one reference of xxxx_open() is kept opened by application B.


      Since one reference of xxxx_open() driver routine is kept opened by application B, So xxxx_close() call is not called by kernel. Therefore device is not got disconnected properly and fails to reconnect again.

      Please clear the following doubts:


      1. When the xxxx_close driver routine is called by kernel. Does kernel maintain any count  of xxxx_open call?


      2. Can I call xxxx_close driver routine directly from my driver or set any count to zero so that kernel will call it automatically? I don't want to depend on the close system call of application B.


      3. Can I call the xxxx_detach of driver from a kernel thread or from driver context?


      Amit Goyal