Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 2 | /* |
| 3 | * An inteface for configuring a hardware via u-boot environment. |
| 4 | * |
| 5 | * Copyright (c) 2009 MontaVista Software, Inc. |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 6 | * Copyright 2011 Freescale Semiconductor, Inc. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 7 | * |
| 8 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 9 | */ |
| 10 | |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 11 | #ifndef HWCONFIG_TEST |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 12 | #include <config.h> |
Tom Rini | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 13 | #include <common.h> |
Simon Glass | 5e6201b | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 14 | #include <env.h> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 15 | #include <exports.h> |
| 16 | #include <hwconfig.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 17 | #include <log.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 18 | #include <asm/global_data.h> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 19 | #include <linux/types.h> |
| 20 | #include <linux/string.h> |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 21 | #else |
| 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> |
| 24 | #include <string.h> |
| 25 | #include <assert.h> |
| 26 | #define min(a, b) (((a) < (b)) ? (a) : (b)) |
| 27 | #endif /* HWCONFIG_TEST */ |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 28 | |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 29 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 31 | static const char *hwconfig_parse(const char *opts, size_t maxlen, |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 32 | const char *opt, char *stopchs, char eqch, |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 33 | size_t *arglen) |
| 34 | { |
| 35 | size_t optlen = strlen(opt); |
| 36 | char *str; |
| 37 | const char *start = opts; |
| 38 | const char *end; |
| 39 | |
| 40 | next: |
| 41 | str = strstr(opts, opt); |
| 42 | end = str + optlen; |
| 43 | if (end - start > maxlen) |
| 44 | return NULL; |
| 45 | |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 46 | if (str && (str == opts || strpbrk(str - 1, stopchs) == str - 1) && |
| 47 | (strpbrk(end, stopchs) == end || *end == eqch || |
| 48 | *end == '\0')) { |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 49 | const char *arg_end; |
| 50 | |
| 51 | if (!arglen) |
| 52 | return str; |
| 53 | |
| 54 | if (*end != eqch) |
| 55 | return NULL; |
| 56 | |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 57 | arg_end = strpbrk(str, stopchs); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 58 | if (!arg_end) |
| 59 | *arglen = min(maxlen, strlen(str)) - optlen - 1; |
| 60 | else |
| 61 | *arglen = arg_end - end - 1; |
| 62 | |
| 63 | return end + 1; |
| 64 | } else if (str) { |
| 65 | opts = end; |
| 66 | goto next; |
| 67 | } |
| 68 | return NULL; |
| 69 | } |
| 70 | |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 71 | const char cpu_hwconfig[] __attribute__((weak)) = ""; |
| 72 | const char board_hwconfig[] __attribute__((weak)) = ""; |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 73 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 74 | static const char *__hwconfig(const char *opt, size_t *arglen, |
| 75 | const char *env_hwconfig) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 76 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 77 | const char *ret; |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 78 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 79 | /* if we are passed a buffer use it, otherwise try the environment */ |
| 80 | if (!env_hwconfig) { |
Pali Rohár | 5ee4cac | 2022-08-07 21:06:04 +0200 | [diff] [blame] | 81 | if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 82 | printf("WARNING: Calling __hwconfig without a buffer " |
Wolfgang Denk | a4de835 | 2011-02-02 22:36:10 +0100 | [diff] [blame] | 83 | "and before environment is ready\n"); |
| 84 | return NULL; |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 85 | } |
Pali Rohár | 06c9e98 | 2022-04-03 00:24:25 +0200 | [diff] [blame] | 86 | #if CONFIG_IS_ENABLED(ENV_SUPPORT) |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 87 | env_hwconfig = env_get("hwconfig"); |
Pali Rohár | 06c9e98 | 2022-04-03 00:24:25 +0200 | [diff] [blame] | 88 | #endif |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 89 | } |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 90 | |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 91 | if (env_hwconfig) { |
| 92 | ret = hwconfig_parse(env_hwconfig, strlen(env_hwconfig), |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 93 | opt, ";", ':', arglen); |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 94 | if (ret) |
| 95 | return ret; |
| 96 | } |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 97 | |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 98 | ret = hwconfig_parse(board_hwconfig, strlen(board_hwconfig), |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 99 | opt, ";", ':', arglen); |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 100 | if (ret) |
| 101 | return ret; |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 102 | |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 103 | return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig), |
| 104 | opt, ";", ':', arglen); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 108 | * hwconfig_f - query if a particular hwconfig option is specified |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 109 | * @opt: a string representing an option |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 110 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 111 | * |
| 112 | * This call can be used to find out whether U-Boot should configure |
| 113 | * a particular hardware option. |
| 114 | * |
| 115 | * Returns non-zero value if the hardware option can be used and thus |
| 116 | * should be configured, 0 otherwise. |
| 117 | * |
| 118 | * This function also returns non-zero value if CONFIG_HWCONFIG is |
| 119 | * undefined. |
| 120 | * |
| 121 | * Returning non-zero value without CONFIG_HWCONFIG has its crucial |
| 122 | * purpose: the hwconfig() call should be a "transparent" interface, |
| 123 | * e.g. if a board doesn't need hwconfig facility, then we assume |
| 124 | * that the board file only calls things that are actually used, so |
| 125 | * hwconfig() will always return true result. |
| 126 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 127 | int hwconfig_f(const char *opt, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 128 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 129 | return !!__hwconfig(opt, NULL, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 133 | * hwconfig_arg_f - get hwconfig option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 134 | * @opt: a string representing an option |
| 135 | * @arglen: a pointer to an allocated size_t variable |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 136 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 137 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 138 | * Unlike hwconfig_f() function, this function returns a pointer to the |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 139 | * start of the hwconfig arguments, if option is not found or it has |
| 140 | * no specified arguments, the function returns NULL pointer. |
| 141 | * |
| 142 | * If CONFIG_HWCONFIG is undefined, the function returns "", and |
| 143 | * arglen is set to 0. |
| 144 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 145 | const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 146 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 147 | return __hwconfig(opt, arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 151 | * hwconfig_arg_cmp_f - compare hwconfig option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 152 | * @opt: a string representing an option |
| 153 | * @arg: a string for comparing an option's argument |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 154 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 155 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 156 | * This call is similar to hwconfig_arg_f, but instead of returning |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 157 | * hwconfig argument and its length, it is comparing it to @arg. |
| 158 | * |
| 159 | * Returns non-zero value if @arg matches, 0 otherwise. |
| 160 | * |
| 161 | * If CONFIG_HWCONFIG is undefined, the function returns a non-zero |
| 162 | * value, i.e. the argument matches. |
| 163 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 164 | int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 165 | { |
| 166 | const char *argstr; |
| 167 | size_t arglen; |
| 168 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 169 | argstr = hwconfig_arg_f(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 170 | if (!argstr || arglen != strlen(arg)) |
| 171 | return 0; |
| 172 | |
| 173 | return !strncmp(argstr, arg, arglen); |
| 174 | } |
| 175 | |
| 176 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 177 | * hwconfig_sub_f - query if a particular hwconfig sub-option is specified |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 178 | * @opt: a string representing an option |
| 179 | * @subopt: a string representing a sub-option |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 180 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 181 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 182 | * This call is similar to hwconfig_f(), except that it takes additional |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 183 | * argument @subopt. In this example: |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 184 | * "dr_usb:mode=peripheral" |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 185 | * "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its |
| 186 | * argument. |
| 187 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 188 | int hwconfig_sub_f(const char *opt, const char *subopt, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 189 | { |
| 190 | size_t arglen; |
| 191 | const char *arg; |
| 192 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 193 | arg = __hwconfig(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 194 | if (!arg) |
| 195 | return 0; |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 196 | return !!hwconfig_parse(arg, arglen, subopt, ",;", '=', NULL); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 200 | * hwconfig_subarg_f - get hwconfig sub-option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 201 | * @opt: a string representing an option |
| 202 | * @subopt: a string representing a sub-option |
| 203 | * @subarglen: a pointer to an allocated size_t variable |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 204 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 205 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 206 | * This call is similar to hwconfig_arg_f(), except that it takes an |
| 207 | * additional argument @subopt, and so works with sub-options. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 208 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 209 | const char *hwconfig_subarg_f(const char *opt, const char *subopt, |
| 210 | size_t *subarglen, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 211 | { |
| 212 | size_t arglen; |
| 213 | const char *arg; |
| 214 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 215 | arg = __hwconfig(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 216 | if (!arg) |
| 217 | return NULL; |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 218 | return hwconfig_parse(arg, arglen, subopt, ",;", '=', subarglen); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 222 | * hwconfig_arg_cmp_f - compare hwconfig sub-option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 223 | * @opt: a string representing an option |
| 224 | * @subopt: a string representing a sub-option |
| 225 | * @subarg: a string for comparing an sub-option's argument |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 226 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 227 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 228 | * This call is similar to hwconfig_arg_cmp_f, except that it takes an |
| 229 | * additional argument @subopt, and so works with sub-options. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 230 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 231 | int hwconfig_subarg_cmp_f(const char *opt, const char *subopt, |
| 232 | const char *subarg, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 233 | { |
| 234 | const char *argstr; |
| 235 | size_t arglen; |
| 236 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 237 | argstr = hwconfig_subarg_f(opt, subopt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 238 | if (!argstr || arglen != strlen(subarg)) |
| 239 | return 0; |
| 240 | |
| 241 | return !strncmp(argstr, subarg, arglen); |
| 242 | } |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 243 | |
| 244 | #ifdef HWCONFIG_TEST |
| 245 | int main() |
| 246 | { |
| 247 | const char *ret; |
| 248 | size_t len; |
| 249 | |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 250 | env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;" |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 251 | "key3;:,:=;key4", 1); |
| 252 | |
| 253 | ret = hwconfig_arg("key1", &len); |
| 254 | printf("%zd %.*s\n", len, (int)len, ret); |
| 255 | assert(len == 29); |
| 256 | assert(hwconfig_arg_cmp("key1", "subkey1=value1,subkey2=value2")); |
| 257 | assert(!strncmp(ret, "subkey1=value1,subkey2=value2", len)); |
| 258 | |
| 259 | ret = hwconfig_subarg("key1", "subkey1", &len); |
| 260 | printf("%zd %.*s\n", len, (int)len, ret); |
| 261 | assert(len == 6); |
| 262 | assert(hwconfig_subarg_cmp("key1", "subkey1", "value1")); |
| 263 | assert(!strncmp(ret, "value1", len)); |
| 264 | |
| 265 | ret = hwconfig_subarg("key1", "subkey2", &len); |
| 266 | printf("%zd %.*s\n", len, (int)len, ret); |
| 267 | assert(len == 6); |
| 268 | assert(hwconfig_subarg_cmp("key1", "subkey2", "value2")); |
| 269 | assert(!strncmp(ret, "value2", len)); |
| 270 | |
| 271 | ret = hwconfig_arg("key2", &len); |
| 272 | printf("%zd %.*s\n", len, (int)len, ret); |
| 273 | assert(len == 6); |
| 274 | assert(hwconfig_arg_cmp("key2", "value3")); |
| 275 | assert(!strncmp(ret, "value3", len)); |
| 276 | |
| 277 | assert(hwconfig("key3")); |
| 278 | assert(hwconfig_arg("key4", &len) == NULL); |
| 279 | assert(hwconfig_arg("bogus", &len) == NULL); |
| 280 | |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 281 | unenv_set("hwconfig"); |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 282 | |
| 283 | assert(hwconfig(NULL) == 0); |
| 284 | assert(hwconfig("") == 0); |
| 285 | assert(hwconfig("key3") == 0); |
| 286 | |
| 287 | return 0; |
| 288 | } |
| 289 | #endif /* HWCONFIG_TEST */ |