summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2016-12-14 13:23:12 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2016-12-14 13:23:12 +0100
commit67aaf8ea7ecf6f609e09816750fd1bb3aaa4bab6 (patch)
tree26713eab5f96afd635638e40caed2233bd819ec4
parent4fe38766f7c48c2e05e6e62013f822001fcee494 (diff)
downloadlibusbg-67aaf8ea7ecf6f609e09816750fd1bb3aaa4bab6.tar.gz
libusbg-67aaf8ea7ecf6f609e09816750fd1bb3aaa4bab6.tar.bz2
libusbg-67aaf8ea7ecf6f609e09816750fd1bb3aaa4bab6.zip
libusbgx: Use string name similar to USB spec
str_ser, str_prd and str_mnf are a little bit weird names so let's replace them with names defined by USB spec. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
-rw-r--r--examples/gadget-acm-ecm.c6
-rw-r--r--examples/gadget-ffs.c6
-rw-r--r--examples/gadget-midi.c6
-rw-r--r--examples/gadget-ms.c6
-rw-r--r--examples/show-gadgets.c6
-rw-r--r--include/usbg/usbg.h6
-rw-r--r--src/usbg.c12
-rw-r--r--src/usbg_schemes_libconfig.c12
-rw-r--r--tests/test.c18
-rw-r--r--tests/usbg-test.c6
10 files changed, 42 insertions, 42 deletions
diff --git a/examples/gadget-acm-ecm.c b/examples/gadget-acm-ecm.c
index a531ca9..1c5e2ca 100644
--- a/examples/gadget-acm-ecm.c
+++ b/examples/gadget-acm-ecm.c
@@ -53,9 +53,9 @@ int main(void)
};
struct usbg_gadget_strs g_strs = {
- .str_ser = "0123456789", /* Serial number */
- .str_mnf = "Foo Inc.", /* Manufacturer */
- .str_prd = "Bar Gadget" /* Product string */
+ .serial = "0123456789", /* Serial number */
+ .manufacturer = "Foo Inc.", /* Manufacturer */
+ .product = "Bar Gadget" /* Product string */
};
struct usbg_config_strs c_strs = {
diff --git a/examples/gadget-ffs.c b/examples/gadget-ffs.c
index 289be3b..13ab2e3 100644
--- a/examples/gadget-ffs.c
+++ b/examples/gadget-ffs.c
@@ -54,9 +54,9 @@ int main(void)
};
struct usbg_gadget_strs g_strs = {
- .str_ser = "0123456789", /* Serial number */
- .str_mnf = "Foo Inc.", /* Manufacturer */
- .str_prd = "Bar Gadget" /* Product string */
+ .serial = "0123456789", /* Serial number */
+ .manufacturer = "Foo Inc.", /* Manufacturer */
+ .product = "Bar Gadget" /* Product string */
};
struct usbg_config_strs c_strs = {
diff --git a/examples/gadget-midi.c b/examples/gadget-midi.c
index 2e5e5a0..74639b7 100644
--- a/examples/gadget-midi.c
+++ b/examples/gadget-midi.c
@@ -43,9 +43,9 @@ int main() {
};
struct usbg_gadget_strs g_strs = {
- .str_ser = "0123456789", /* Serial number */
- .str_mnf = "Foo Inc.", /* Manufacturer */
- .str_prd = "Bar Gadget" /* Product string */
+ .serial = "0123456789", /* Serial number */
+ .manufacturer = "Foo Inc.", /* Manufacturer */
+ .product = "Bar Gadget" /* Product string */
};
struct usbg_config_strs c_strs = {
diff --git a/examples/gadget-ms.c b/examples/gadget-ms.c
index 699d56f..478c370 100644
--- a/examples/gadget-ms.c
+++ b/examples/gadget-ms.c
@@ -51,9 +51,9 @@ int main(int argc, char **argv)
};
struct usbg_gadget_strs g_strs = {
- .str_ser = "0123456789", /* Serial number */
- .str_mnf = "Foo Inc.", /* Manufacturer */
- .str_prd = "Bar Gadget" /* Product string */
+ .serial = "0123456789", /* Serial number */
+ .manufacturer = "Foo Inc.", /* Manufacturer */
+ .product = "Bar Gadget" /* Product string */
};
struct usbg_f_ms_lun_attrs f_ms_luns_array[] = {
diff --git a/examples/show-gadgets.c b/examples/show-gadgets.c
index 4fd7d40..b77ca8f 100644
--- a/examples/show-gadgets.c
+++ b/examples/show-gadgets.c
@@ -91,9 +91,9 @@ void show_gadget(usbg_gadget *g)
usbg_strerror(usbg_ret));
return;
}
- fprintf(stdout, " Manufacturer\t\t%s\n", g_strs.str_mnf);
- fprintf(stdout, " Product\t\t%s\n", g_strs.str_prd);
- fprintf(stdout, " Serial Number\t\t%s\n", g_strs.str_ser);
+ fprintf(stdout, " Manufacturer\t\t%s\n", g_strs.manufacturer);
+ fprintf(stdout, " Product\t\t%s\n", g_strs.product);
+ fprintf(stdout, " Serial Number\t\t%s\n", g_strs.serial);
}
void show_function(usbg_function *f)
diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h
index 4626fd0..d2bffba 100644
--- a/include/usbg/usbg.h
+++ b/include/usbg/usbg.h
@@ -147,9 +147,9 @@ typedef enum {
*/
struct usbg_gadget_strs
{
- char str_ser[USBG_MAX_STR_LENGTH];
- char str_mnf[USBG_MAX_STR_LENGTH];
- char str_prd[USBG_MAX_STR_LENGTH];
+ char serial[USBG_MAX_STR_LENGTH];
+ char manufacturer[USBG_MAX_STR_LENGTH];
+ char product[USBG_MAX_STR_LENGTH];
};
/**
diff --git a/src/usbg.c b/src/usbg.c
index ca14d2a..eda5712 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -773,15 +773,15 @@ static int usbg_parse_gadget_strs(const char *path, const char *name, int lang,
}
closedir(dir);
- ret = usbg_read_string(spath, "", "serialnumber", g_strs->str_ser);
+ ret = usbg_read_string(spath, "", "serialnumber", g_strs->serial);
if (ret != USBG_SUCCESS)
goto out;
- ret = usbg_read_string(spath, "", "manufacturer", g_strs->str_mnf);
+ ret = usbg_read_string(spath, "", "manufacturer", g_strs->manufacturer);
if (ret != USBG_SUCCESS)
goto out;
- ret = usbg_read_string(spath, "", "product", g_strs->str_prd);
+ ret = usbg_read_string(spath, "", "product", g_strs->product);
if (ret != USBG_SUCCESS)
goto out;
@@ -1691,15 +1691,15 @@ int usbg_set_gadget_strs(usbg_gadget *g, int lang,
if (ret != USBG_SUCCESS)
goto out;
- ret = usbg_write_string(path, "", "serialnumber", g_strs->str_ser);
+ ret = usbg_write_string(path, "", "serialnumber", g_strs->serial);
if (ret != USBG_SUCCESS)
goto out;
- ret = usbg_write_string(path, "", "manufacturer", g_strs->str_mnf);
+ ret = usbg_write_string(path, "", "manufacturer", g_strs->manufacturer);
if (ret != USBG_SUCCESS)
goto out;
- ret = usbg_write_string(path, "", "product", g_strs->str_prd);
+ ret = usbg_write_string(path, "", "product", g_strs->product);
out:
return ret;
diff --git a/src/usbg_schemes_libconfig.c b/src/usbg_schemes_libconfig.c
index 84006f5..8da763b 100644
--- a/src/usbg_schemes_libconfig.c
+++ b/src/usbg_schemes_libconfig.c
@@ -453,9 +453,9 @@ static int usbg_export_gadget_strs_lang(usbg_gadget *g, const char *lang_str,
} \
} while (0)
- ADD_GADGET_STR("manufacturer", str_mnf);
- ADD_GADGET_STR("product", str_prd);
- ADD_GADGET_STR("serialnumber", str_ser);
+ ADD_GADGET_STR("manufacturer", manufacturer);
+ ADD_GADGET_STR("product", product);
+ ADD_GADGET_STR("serialnumber", serial);
#undef ADD_GADGET_STR
ret = USBG_SUCCESS;
@@ -1263,9 +1263,9 @@ static int usbg_import_gadget_strs_lang(config_setting_t *root, usbg_gadget *g)
} \
} while (0)
- GET_OPTIONAL_GADGET_STR(manufacturer, str_mnf);
- GET_OPTIONAL_GADGET_STR(product, str_prd);
- GET_OPTIONAL_GADGET_STR(serialnumber, str_ser);
+ GET_OPTIONAL_GADGET_STR(manufacturer, manufacturer);
+ GET_OPTIONAL_GADGET_STR(product, product);
+ GET_OPTIONAL_GADGET_STR(serialnumber, serial);
#undef GET_OPTIONAL_GADGET_STR
diff --git a/tests/test.c b/tests/test.c
index 0063d55..80b6fec 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -438,9 +438,9 @@ static int setup_random_len_gadget_strs_data(void **state)
srand(time(NULL));
- memset(strs->str_ser, 'x', rand() % USBG_MAX_STR_LENGTH);
- memset(strs->str_mnf, 'x', rand() % USBG_MAX_STR_LENGTH);
- memset(strs->str_prd, 'x', rand() % USBG_MAX_STR_LENGTH);
+ memset(strs->serial, 'x', rand() % USBG_MAX_STR_LENGTH);
+ memset(strs->manufacturer, 'x', rand() % USBG_MAX_STR_LENGTH);
+ memset(strs->product, 'x', rand() % USBG_MAX_STR_LENGTH);
data->strs = strs;
@@ -1440,15 +1440,15 @@ static void test_set_gadget_strs(void **data)
get_gadget_str(ts->strs, i));
ret = usbg_set_gadget_serial_number(g, LANG_US_ENG,
- ts->strs->str_ser);
+ ts->strs->serial);
assert_int_equal(ret, 0);
ret = usbg_set_gadget_manufacturer(g, LANG_US_ENG,
- ts->strs->str_mnf);
+ ts->strs->manufacturer);
assert_int_equal(ret, 0);
ret = usbg_set_gadget_product(g, LANG_US_ENG,
- ts->strs->str_prd);
+ ts->strs->product);
assert_int_equal(ret, 0);
for (i = 0; i < GADGET_STR_MAX; i++)
@@ -1457,15 +1457,15 @@ static void test_set_gadget_strs(void **data)
ret = usbg_set_gadget_str(g, USBG_STR_SERIAL_NUMBER,
- LANG_US_ENG, ts->strs->str_ser);
+ LANG_US_ENG, ts->strs->serial);
assert_int_equal(ret, 0);
ret = usbg_set_gadget_str(g, USBG_STR_MANUFACTURER,
- LANG_US_ENG, ts->strs->str_mnf);
+ LANG_US_ENG, ts->strs->manufacturer);
assert_int_equal(ret, 0);
ret = usbg_set_gadget_str(g, USBG_STR_PRODUCT,
- LANG_US_ENG, ts->strs->str_prd);
+ LANG_US_ENG, ts->strs->product);
assert_int_equal(ret, 0);
}
}
diff --git a/tests/usbg-test.c b/tests/usbg-test.c
index 52bb890..09703cc 100644
--- a/tests/usbg-test.c
+++ b/tests/usbg-test.c
@@ -860,13 +860,13 @@ const char *get_gadget_str(struct usbg_gadget_strs *strs, gadget_str str)
switch (str) {
case STR_SER:
- ret = strs->str_ser;
+ ret = strs->serial;
break;
case STR_MNF:
- ret = strs->str_mnf;
+ ret = strs->manufacturer;
break;
case STR_PRD:
- ret = strs->str_prd;
+ ret = strs->product;
break;
default:
ret = NULL;