name 使用root会导致一个io错误

This commit is contained in:
13038267101 2023-04-20 18:45:15 +08:00
parent 9eead04e8e
commit 63acafc433
1 changed files with 2 additions and 2 deletions

View File

@ -552,7 +552,7 @@ int usb_device::open(libusb_device_handle** dev_handle)
std::string fmt("\\%d"), root(""); std::string fmt("\\%d"), root("");
if (udev_.driver_key.length()) if (udev_.driver_key.length())
root = usb_device::usb_scan_name(udev_.driver_key.c_str()); root = usb_device::usb_scan_name(udev_.driver_key.c_str());//name使用root时会导致 IO一个异常
if (root.empty()) if (root.empty())
{ {
VLOG_MINI_1(LOG_LEVEL_WARNING, "Cannot find '\\\\.\\Usbscan' name for '%s', try run in Administrator!\r\n", udev_.name.c_str()); VLOG_MINI_1(LOG_LEVEL_WARNING, "Cannot find '\\\\.\\Usbscan' name for '%s', try run in Administrator!\r\n", udev_.name.c_str());
@ -563,7 +563,7 @@ int usb_device::open(libusb_device_handle** dev_handle)
{ {
VLOG_MINI_2(LOG_LEVEL_WARNING, "Nice: '%s' for '%s'.\r\n", root.c_str(), udev_.name.c_str()); VLOG_MINI_2(LOG_LEVEL_WARNING, "Nice: '%s' for '%s'.\r\n", root.c_str(), udev_.name.c_str());
} }
h = open_usb(root.c_str()); h = open_usb(udev_.name.c_str());
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
{ {
*dev_handle = NULL; *dev_handle = NULL;