string compatible should not have leading zeroes

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-04-14 07:34:10 +03:00
parent 12d9715a1c
commit 95976da8c6
5 changed files with 8 additions and 8 deletions

View File

@ -2961,7 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
if (gSettings.FakeLAN) { if (gSettings.FakeLAN) {
FakeID = gSettings.FakeLAN >> 16; FakeID = gSettings.FakeLAN >> 16;
FakeVen = gSettings.FakeLAN & 0xFFFF; 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); Netmodel[card] = get_net_model((FakeVen << 16) + FakeID);
} }
@ -3163,7 +3163,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
if (gSettings.FakeWIFI) { if (gSettings.FakeWIFI) {
FakeID = gSettings.FakeWIFI >> 16; FakeID = gSettings.FakeWIFI >> 16;
FakeVen = gSettings.FakeWIFI & 0xFFFF; FakeVen = gSettings.FakeWIFI & 0xFFFF;
snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID); snprintf(NameCard, 32, "pci%x,%x", FakeVen, FakeID);
} }
PCIADR = GetPciDevice(dsdt, len); PCIADR = GetPciDevice(dsdt, len);

View File

@ -6863,7 +6863,7 @@ GetDevices ()
default: default:
gfx->Vendor = Unknown; 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->Ports = 1;
gfx->Connectors = (1 << NGFX); gfx->Connectors = (1 << NGFX);
gfx->ConnChanged = FALSE; gfx->ConnChanged = FALSE;

View File

@ -1322,7 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
return FALSE; return FALSE;
} }
snprintf(pciName, 15, "pci1002,%04x", gSettings.FakeATI >> 16); snprintf(pciName, 15, "pci1002,%x", gSettings.FakeATI >> 16);
val->type = kStr; val->type = kStr;
val->size = 13; val->size = 13;
val->data = (UINT8 *)pciName; val->data = (UINT8 *)pciName;
@ -2112,7 +2112,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
FakeID = gSettings.FakeATI >> 16; FakeID = gSettings.FakeATI >> 16;
devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4); devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4);
devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2); 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); devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeATI & 0xFFFF; FakeID = gSettings.FakeATI & 0xFFFF;
devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4); devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4);

View File

@ -408,7 +408,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
if (gSettings.FakeLAN) { if (gSettings.FakeLAN) {
UINT32 FakeID = gSettings.FakeLAN >> 16; UINT32 FakeID = gSettings.FakeLAN >> 16;
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4); 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); devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeLAN & 0xFFFF; FakeID = gSettings.FakeLAN & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4); devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);

View File

@ -2232,8 +2232,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
CHAR8 compatible[64]; CHAR8 compatible[64];
UINT32 FakeLAN = 0x0030168c; UINT32 FakeLAN = 0x0030168c;
UINT32 FakeID = FakeLAN >> 16; UINT32 FakeID = FakeLAN >> 16;
UINTN FakeVendor = FakeLAN & 0xFFFF; UINT32 FakeVendor = FakeLAN & 0xFFFF;
snprintf(compatible, 64, "pci%04llx,%04x", FakeVendor, FakeID); snprintf(compatible, 64, "pci%x,%x", FakeVendor, FakeID);
DBG(" FakeLAN = 0x%x\n", FakeLAN); DBG(" FakeLAN = 0x%x\n", FakeLAN);
DBG(" Compatible=%s strlen=%ld sizeof=%ld iStrLen=%lld\n", compatible, DBG(" Compatible=%s strlen=%ld sizeof=%ld iStrLen=%lld\n", compatible,
strlen(compatible), sizeof(compatible), iStrLen(compatible, 64)); strlen(compatible), sizeof(compatible), iStrLen(compatible, 64));