1
0
Fork 0

Only consider the port to be open if a serial number can be read within 500 milliseconds.

This commit is contained in:
Kevin Matz 2023-04-06 09:44:54 -04:00
parent e316c71a83
commit 97ae66e231
1 changed files with 5 additions and 2 deletions

View File

@ -86,8 +86,11 @@ void Widget::halt()
*/
void Widget::open()
{
std::scoped_lock lock(mtx_metadata_);
usb_mode_ = USBhost;
if (getSerialNumber(500)) // check for valid call/response from device
{
std::scoped_lock lock(mtx_metadata_);
usb_mode_ = USBhost; // note connected state
}
}