Merge pull request #5934 from akallabeth/urbdrc_close_fix

URBDRC: Only mark closed if control is closed.
This commit is contained in:
Norbert Federa 2020-03-03 11:27:06 +01:00 committed by GitHub
commit 822ed3d7ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 4 deletions

View File

@ -1014,11 +1014,16 @@ static int libusb_udev_is_exist(IUDEVICE* idev)
static int libusb_udev_is_channel_closed(IUDEVICE* idev)
{
UDEVICE* pdev = (UDEVICE*)idev;
IUDEVMAN* udevman;
if (!pdev || !pdev->urbdrc)
return 1;
if (pdev->urbdrc->status & URBDRC_DEVICE_CHANNEL_CLOSED)
return 1;
udevman = pdev->urbdrc->udevman;
if (udevman)
{
if (udevman->status & URBDRC_DEVICE_CHANNEL_CLOSED)
return 1;
}
if (pdev->status & URBDRC_DEVICE_CHANNEL_CLOSED)
return 1;

View File

@ -645,6 +645,7 @@ static BOOL udevman_initialize(IUDEVMAN* idevman, UINT32 channelId)
if (!udevman)
return FALSE;
idevman->status &= ~URBDRC_DEVICE_CHANNEL_CLOSED;
idevman->controlChannelId = channelId;
return TRUE;
}

View File

@ -612,7 +612,15 @@ static UINT urbdrc_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*)callback->plugin;
if (urbdrc)
urbdrc->status |= URBDRC_DEVICE_CHANNEL_CLOSED;
{
IUDEVMAN* udevman = urbdrc->udevman;
if (udevman && callback->channel_mgr)
{
UINT32 control = callback->channel_mgr->GetChannelId(callback->channel);
if (udevman->controlChannelId == control)
udevman->status |= URBDRC_DEVICE_CHANNEL_CLOSED;
}
}
}
free(callback);
return CHANNEL_RC_OK;

View File

@ -83,7 +83,6 @@ struct _URBDRC_PLUGIN
UINT32 vchannel_status;
char* subsystem;
UINT32 status;
wLog* log;
};
@ -220,6 +219,7 @@ struct _IUDEVMAN
IWTSPlugin* plugin;
UINT32 controlChannelId;
UINT32 status;
};
enum