Browse Source

account for cases when a USB device driver has been already installed but not via DriverDatabase, e.g. when UsbHidDriver.Install is called before a HID device insertion; before the fix ConsultDriverDatabase(dev) returned TRUE at the very first device insertion (because DriverDatabase did not have UsbHidDriver command execution in its command history), and therefore required to replug the device to actually initialize the driver instance

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8676 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova 6 năm trước cách đây
mục cha
commit
c6907d90bc
1 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 7 4
      source/Usb.Mod

+ 7 - 4
source/Usb.Mod

@@ -804,10 +804,13 @@ TYPE
 			interface := dev.actConfiguration.interfaces[interfaceIdx] (InterfaceDescriptor);
 			(* Search an USB device driver for this device (See USB Common Class Specification, 3.10 Locating USB Drivers) *)
 			(* we have to consult the database first always because of priorities. If a driver has already been loaded previously, this will return FALSE anyway *)
-			IF ConsultDriverDatabase(dev) THEN
-				RETURN;  (* Appropriate device driver has been loaded from driver database. Loading will force bus enumeration, so don't continue here. *)
-			ELSE
-				drv := LookupDriver(dev, interface, temp);
+			drv := LookupDriver(dev, interface, temp); (* account for cases when a driver has been installed directly, not via DriverDatabase *)
+			IF drv = NIL THEN
+				IF ConsultDriverDatabase(dev) THEN
+					RETURN;  (* Appropriate device driver has been loaded from driver database. Loading will force bus enumeration, so don't continue here. *)
+				ELSE
+					drv := LookupDriver(dev, interface, temp);
+				END;
 			END;
 
 			BEGIN {EXCLUSIVE}