Skip to content

Commit

Permalink
string compatible should not have leading zeroes
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
  • Loading branch information
SergeySlice committed Apr 14, 2020
1 parent 12d9715 commit 95976da
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions rEFIt_UEFI/Platform/FixBiosDsdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2961,7 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
if (gSettings.FakeLAN) {
FakeID = gSettings.FakeLAN >> 16;
FakeVen = gSettings.FakeLAN & 0xFFFF;
snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
snprintf(NameCard, 32, "pci%x,%x", FakeVen, FakeID);
Netmodel[card] = get_net_model((FakeVen << 16) + FakeID);
}

Expand Down Expand Up @@ -3163,7 +3163,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
if (gSettings.FakeWIFI) {
FakeID = gSettings.FakeWIFI >> 16;
FakeVen = gSettings.FakeWIFI & 0xFFFF;
snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
snprintf(NameCard, 32, "pci%x,%x", FakeVen, FakeID);
}

PCIADR = GetPciDevice(dsdt, len);
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6863,7 +6863,7 @@ GetDevices ()

default:
gfx->Vendor = Unknown;
snprintf (gfx->Model, 64, "pci%04x,%04x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
snprintf (gfx->Model, 64, "pci%x,%x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
gfx->Ports = 1;
gfx->Connectors = (1 << NGFX);
gfx->ConnChanged = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions rEFIt_UEFI/Platform/ati.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
return FALSE;
}

snprintf(pciName, 15, "pci1002,%04x", gSettings.FakeATI >> 16);
snprintf(pciName, 15, "pci1002,%x", gSettings.FakeATI >> 16);
val->type = kStr;
val->size = 13;
val->data = (UINT8 *)pciName;
Expand Down Expand Up @@ -2112,7 +2112,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
FakeID = gSettings.FakeATI >> 16;
devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4);
devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2);
snprintf(compatible, 64, "pci1002,%04x", FakeID);
snprintf(compatible, 64, "pci1002,%x", FakeID);
devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeATI & 0xFFFF;
devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4);
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/device_inject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
if (gSettings.FakeLAN) {
UINT32 FakeID = gSettings.FakeLAN >> 16;
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
snprintf(compatible, 64, "pci%04x,%04x", (gSettings.FakeLAN & 0xFFFF), FakeID);
snprintf(compatible, 64, "pci%x,%x", (gSettings.FakeLAN & 0xFFFF), FakeID);
devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeLAN & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
Expand Down
4 changes: 2 additions & 2 deletions rEFIt_UEFI/refit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
CHAR8 compatible[64];
UINT32 FakeLAN = 0x0030168c;
UINT32 FakeID = FakeLAN >> 16;
UINTN FakeVendor = FakeLAN & 0xFFFF;
snprintf(compatible, 64, "pci%04llx,%04x", FakeVendor, FakeID);
UINT32 FakeVendor = FakeLAN & 0xFFFF;
snprintf(compatible, 64, "pci%x,%x", FakeVendor, FakeID);
DBG(" FakeLAN = 0x%x\n", FakeLAN);
DBG(" Compatible=%s strlen=%ld sizeof=%ld iStrLen=%lld\n", compatible,
strlen(compatible), sizeof(compatible), iStrLen(compatible, 64));
Expand Down

0 comments on commit 95976da

Please sign in to comment.