diff options
author | INSUN PYO <insun.pyo@samsung.com> | 2020-03-24 14:25:42 +0900 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2020-03-26 04:53:05 +0000 |
commit | 39dec821c92e4022ac6326b459d55f9c55ad0b92 (patch) | |
tree | 1bba8c42f465745c3493d655046b1f568cbb1a96 /hw/usb_cfs_client_common.c | |
parent | 8b2718ffda53041b5a5c4692178f052643cc2e95 (diff) | |
download | libdevice-node-39dec821c92e4022ac6326b459d55f9c55ad0b92.tar.gz libdevice-node-39dec821c92e4022ac6326b459d55f9c55ad0b92.tar.bz2 libdevice-node-39dec821c92e4022ac6326b459d55f9c55ad0b92.zip |
Refactoring usb gadget
Move common USB gadget attribute value to header
Change-Id: Id06fefc9af78876d46364b39893b4f25ebd9ed82
(cherry picked from commit a3a343526d84ad3c7097014bce38e7ca79bb3a0d)
Diffstat (limited to 'hw/usb_cfs_client_common.c')
-rw-r--r-- | hw/usb_cfs_client_common.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/hw/usb_cfs_client_common.c b/hw/usb_cfs_client_common.c index f03395c..3c4740d 100644 --- a/hw/usb_cfs_client_common.c +++ b/hw/usb_cfs_client_common.c @@ -26,6 +26,7 @@ #include <usbg/function/net.h> #include <libsyscommon/dbus-systemd.h> +#include <hw/usb_gadget.h> #include <hw/usb_client.h> #define CONFIGFS_PATH "/sys/kernel/config" @@ -57,16 +58,15 @@ struct cfs_client { /* Based on values in slp-gadget kernel module */ struct usbg_gadget_attrs default_g_attrs = { - .bcdUSB = 0x0200, - .idVendor = 0x04e8, - .idProduct = 0x6860, - .bcdDevice = 0x0100, + .idVendor = DEFAULT_VID, + .idProduct = DEFAULT_PID, + .bcdDevice = DEFAULT_BCD_DEVICE, }; struct usbg_gadget_strs default_g_strs = { - .manufacturer = "Samsung", - .product = "TIZEN", - .serial = "01234TEST", + .manufacturer = DEFAULT_MANUFACTURER, + .product = DEFAULT_PRODUCT, + .serial = DEFAULT_SERIAL, }; static struct usb_function *cfs_find_usb_function(usbg_function *function) @@ -162,12 +162,8 @@ static int cfs_set_gadget_attrs(struct cfs_client *cfs_client, static int cfs_set_gadget_strs(struct cfs_client *cfs_client, struct usb_gadget_strings *strs) { - int ret = 0; + int ret; - /* - * TODO - * Here is a good place to ensure that serial is immutable - */ #define SET_STR(FIELD, STR_ID) \ if (strs->FIELD) { \ ret = usbg_set_gadget_str(cfs_client->gadget, \ @@ -182,7 +178,8 @@ static int cfs_set_gadget_strs(struct cfs_client *cfs_client, SET_STR(product, USBG_STR_PRODUCT); SET_STR(serial, USBG_STR_SERIAL_NUMBER); #undef SET_STR - return ret; + + return 0; } static int cfs_ensure_dir(char *path) @@ -449,8 +446,7 @@ static int cfs_set_gadget_config(struct cfs_client *cfs_client, int config_id, s return 0; } -static int cfs_reconfigure_gadget(struct usb_client *usb, - struct usb_gadget *gadget) +static int cfs_reconfigure_gadget(struct usb_client *usb, struct usb_gadget *gadget) { int i; int ret; |