修复打开设备失败时的返回值

This commit is contained in:
gb 2022-05-26 17:17:37 +08:00
parent 0b046633b3
commit dbd490b67c
2 changed files with 2 additions and 1 deletions

View File

@ -497,7 +497,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
io->release();
}
return *h ? ret : SCANNER_ERR_DEVICE_NOT_SUPPORT;
return *h ? SCANNER_ERR_OK : ret;
}
scanner_err hg_scanner_mgr::hg_scanner_close(scanner_handle h, bool force)
{

View File

@ -781,6 +781,7 @@ void usb_io::open(void)
}
last_err_ = usb_manager::usb_error_2_hg_err(ret);
HG_VLOG_MINI_4(LOG_LEVEL_FATAL, "Open USB%u.%u-%s failed: %s\n", HIBYTE(dev_info_.ver), LOBYTE(dev_info_.ver) / 0x10, hg_log::format_ptr(dev_info_.device).c_str(), libusb_error_name(ret));
init_err_msg_ = hg_scanner::error_description((scanner_err)last_err_);
handle_ = NULL;
}
}