Refs #1839. Reset bulkUsbDev after close.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@1083 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2023-09-17 10:02:38 +00:00
parent fda0af2658
commit 74c8b78e17
2 changed files with 4 additions and 0 deletions

View File

@ -232,6 +232,7 @@ static uint8_t UblOpen(LPCGUID guid)
/* Init device members. */
bulkUsbDev.hDev = NULL;
bulkUsbDev.hWinUSBDev = NULL;
bulkUsbDev.evReader = NULL;
bulkUsbDev.pipeBulkIn = INVALID_PIPE_ID;
bulkUsbDev.pipeBulkOut = INVALID_PIPE_ID;
/* Open the usb device. */
@ -306,11 +307,13 @@ static void UblClose(void)
if (bulkUsbDev.evReader != NULL)
{
(void)CloseHandle(bulkUsbDev.evReader);
bulkUsbDev.evReader = NULL;
}
/* close the winusb device */
if (bulkUsbDev.hWinUSBDev != NULL)
{
(void)WinUsb_Free(bulkUsbDev.hWinUSBDev);
bulkUsbDev.hWinUSBDev = NULL;
}
/* reset bulk OUT and IN pipes */
bulkUsbDev.pipeBulkOut = INVALID_PIPE_ID;
@ -319,6 +322,7 @@ static void UblClose(void)
if (bulkUsbDev.hDev != NULL)
{
(void)CloseHandle(bulkUsbDev.hDev);
bulkUsbDev.hDev = NULL;
}
} /*** end of UblClose ***/

Binary file not shown.