Added wildcards to driver registration

git-svn-id: https://spexeah.com:8443/svn/Asuro@292 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2018-04-04 21:08:45 +00:00
parent a805f22354
commit f82f12fd8b
2 changed files with 16 additions and 13 deletions

View File

@ -19,12 +19,12 @@ var
devID : TDeviceIdentifier; devID : TDeviceIdentifier;
begin begin
devID.bus:= biPCI; devID.bus:= biPCI; { PCI BUS }
devID.id0:= $00008086; devID.id0:= idANY; { ANY DEVICE MANUFACTURER }
devID.id1:= $00000006; devID.id1:= $00000006; { CLASS }
devID.id2:= $00000000; devID.id2:= $00000000; { SUBCLASS }
devID.id3:= $00000000; devID.id3:= $00000000; { PROGIF }
devID.ex:= nil; devID.ex:= nil; { NO EXTENDED INFO }
drivermanagement.register_driver(@devID, @load); drivermanagement.register_driver(@devID, @load);
end; end;

View File

@ -13,6 +13,9 @@ interface
uses uses
console, util, strings, lmemorymanager; console, util, strings, lmemorymanager;
const
idANY = $FFFFFFFF;
type type
PDevEx = ^TDevEx; PDevEx = ^TDevEx;
TDevEx = record TDevEx = record
@ -20,7 +23,7 @@ type
ex : PDevEx; ex : PDevEx;
end; end;
TBusIdentifier = (biUnknown, biPCI, biUSB, bii2c, biPCIe); TBusIdentifier = (biUnknown, biPCI, biUSB, bii2c, biPCIe, biANY);
PDeviceIdentifier = ^TDeviceIdentifier; PDeviceIdentifier = ^TDeviceIdentifier;
TDeviceIdentifier = record TDeviceIdentifier = record
@ -57,11 +60,11 @@ var
begin begin
identifiers_match:= true; identifiers_match:= true;
identifiers_match:= identifiers_match and (i1^.Bus = i2^.Bus); identifiers_match:= identifiers_match and ((i1^.Bus = i2^.Bus) OR (i1^.Bus = biANY) OR (i2^.Bus = biANY));
identifiers_match:= identifiers_match and (i1^.id0 = i2^.id0); identifiers_match:= identifiers_match and ((i1^.id0 = i2^.id0) OR (i1^.id0 = $FFFFFFFF) OR (i2^.id0 = $FFFFFFFF));
identifiers_match:= identifiers_match and (i1^.id1 = i2^.id1); identifiers_match:= identifiers_match and ((i1^.id1 = i2^.id1) OR (i1^.id1 = $FFFFFFFF) OR (i2^.id1 = $FFFFFFFF));
identifiers_match:= identifiers_match and (i1^.id2 = i2^.id2); identifiers_match:= identifiers_match and ((i1^.id2 = i2^.id2) OR (i1^.id2 = $FFFFFFFF) OR (i2^.id2 = $FFFFFFFF));
identifiers_match:= identifiers_match and (i1^.id3 = i2^.id3); identifiers_match:= identifiers_match and ((i1^.id3 = i2^.id3) OR (i1^.id3 = $FFFFFFFF) OR (i2^.id3 = $FFFFFFFF));
ll1:= i1^.ex; ll1:= i1^.ex;
ll2:= i2^.ex; ll2:= i2^.ex;
while true do begin while true do begin
@ -70,7 +73,7 @@ begin
identifiers_match:= identifiers_match and (b1 = b2); identifiers_match:= identifiers_match and (b1 = b2);
if not (b1 and b2) then exit; if not (b1 and b2) then exit;
if b1 = b2 then begin if b1 = b2 then begin
identifiers_match:= identifiers_match and (ll1^.idN = ll2^.idN); identifiers_match:= identifiers_match and ((ll1^.idN = ll2^.idN) OR (ll1^.idN = $FFFFFFFF) OR (ll2^.idN = $FFFFFFFF));
end else begin end else begin
identifiers_match:= false; identifiers_match:= false;
exit; exit;