mirror of https://github.com/acidanthera/audk.git
MdePkg: Handle USBxxx device path when optional para is not specified
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 According to UEFI spec, for the Messaging Device Path with USB Class SubType, some paras are optional in the text device path. Take UsbClass(VID,PID,Class,SubClass,Protocol) for example, The VID is an integer between 0 and 65535 and is optional. The default value is 0xFFFF. The PID is an integer between 0 and 65535 and is optional. The default value is 0xFFFF. The Class is an integer between 0 and 255 and is optional. The default value is 0xFF. The SubClass is an integer between 0 and 255 and is optional. The default value is 0xFF. The Protocol is an integer between 0 and 255 and is optional. The default value is 0xFF. So if any the optional para is not specified in the text device, we should set related para in the node structure to default value. This commit is to do the enhancement for USB Class device path when optional para is not specified Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
6d9b9bbb61
commit
3874108034
|
@ -2061,22 +2061,42 @@ ConvertFromTextUsbClass (
|
|||
PIDStr = GetNextParamStr (&TextDeviceNode);
|
||||
if (UsbClassText->ClassExist) {
|
||||
ClassStr = GetNextParamStr (&TextDeviceNode);
|
||||
UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
|
||||
if (*ClassStr == L'\0') {
|
||||
UsbClass->DeviceClass = 0xFF;
|
||||
} else {
|
||||
UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
|
||||
}
|
||||
} else {
|
||||
UsbClass->DeviceClass = UsbClassText->Class;
|
||||
}
|
||||
if (UsbClassText->SubClassExist) {
|
||||
SubClassStr = GetNextParamStr (&TextDeviceNode);
|
||||
UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
|
||||
if (*SubClassStr == L'\0') {
|
||||
UsbClass->DeviceSubClass = 0xFF;
|
||||
} else {
|
||||
UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
|
||||
}
|
||||
} else {
|
||||
UsbClass->DeviceSubClass = UsbClassText->SubClass;
|
||||
}
|
||||
|
||||
ProtocolStr = GetNextParamStr (&TextDeviceNode);
|
||||
|
||||
UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
|
||||
UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
|
||||
UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
|
||||
if (*VIDStr == L'\0') {
|
||||
UsbClass->VendorId = 0xFFFF;
|
||||
} else {
|
||||
UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
|
||||
}
|
||||
if (*PIDStr == L'\0') {
|
||||
UsbClass->ProductId = 0xFFFF;
|
||||
} else {
|
||||
UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
|
||||
}
|
||||
if (*ProtocolStr == L'\0') {
|
||||
UsbClass->DeviceProtocol = 0xFF;
|
||||
} else {
|
||||
UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
|
||||
}
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue