[PATCH 1/8] acpi: method: add DDN, HID, HRV, PLD, SUB, STR checks
Alex Hung
alex.hung at canonical.com
Thu Sep 27 03:18:27 UTC 2012
- Previous message: [PATCH 1/8] acpi: method: add DDN, HID, HRV, PLD, SUB, STR checks
- Next message: [PATCH 1/8] acpi: method: add DDN, HID, HRV, PLD, SUB, STR checks
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On 09/25/2012 11:23 AM, IvanHu wrote:
>
>> +
>> +static bool method_valid_HID_string(char *str)
>> +{
>> + if (strlen(str) == 7) {
>> + /* PNP ID, must be 3 capitals followed by 4 hex */
>> + if (!isupper(str[0]) ||
>> + !isupper(str[1]) ||
>> + !isupper(str[2])) return false;
>> + if (!isxdigit(str[3]) ||
>> + !isxdigit(str[4]) ||
>> + !isxdigit(str[5]) ||
>> + !isxdigit(str[6])) return false;
>> + return true;
>> + }
>> +
>> + if (strlen(str) == 8) {
>> + /* ACPI ID, must be 4 capitals followed by 4 hex */
>> + if (!isupper(str[0]) ||
>> + !isupper(str[1]) ||
>> + !isupper(str[2]) ||
>> + !isupper(str[3])) return false;
>> + if (!isxdigit(str[4]) ||
>> + !isxdigit(str[5]) ||
>> + !isxdigit(str[6]) ||
>> + !isxdigit(str[7])) return false;
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>> +
>
> Just wondering if the ACPI ID for 8 digit shouldn't be valid?
> For example,
> Name(_HID, "80860003") // PCI-assigned device identifier
>
>
>
I confirmed ACPI spec as below:
A valid ACPI ID must be of the form "NNNN####" where N is an uppercase
letter or a digit ('0'-'9') and # is a hex digit.
How about
+ if (strlen(str) == 8) {
+ /* ACPI ID, must be 4 capitals followed by 4 hex */
+ if (!isupper(str[0] && !isxdigit(str[0]) ||
+ !isupper(str[1] && !isxdigit(str[1]) ||
+ !isupper(str[2] && !isxdigit(str[2]) ||
+ !isupper(str[3] && !isxdigit(str[3])) return false;
+ if (!isxdigit(str[4]) ||
+ !isxdigit(str[5]) ||
+ !isxdigit(str[6]) ||
+ !isxdigit(str[7])) return false;
+ return true;
+ }
- Previous message: [PATCH 1/8] acpi: method: add DDN, HID, HRV, PLD, SUB, STR checks
- Next message: [PATCH 1/8] acpi: method: add DDN, HID, HRV, PLD, SUB, STR checks
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fwts-devel
mailing list