Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for compilation with libusbgx 0.2.0 #2

Closed
MerlijnWajer opened this issue Mar 3, 2018 · 3 comments

Comments

@MerlijnWajer
Copy link

@MerlijnWajer MerlijnWajer commented Mar 3, 2018

Checked out repo today, didn't compile. This fixes compilation, sorry for not making a PR, but I find that a hassle usually.

From f0916276fd8f40e49144d2638f8f994c63a69315 Mon Sep 17 00:00:00 2001
From: Merlijn Wajer <merlijn@wizzup.org>
Date: Sat, 3 Mar 2018 12:32:45 +0100
Subject: [PATCH] Update to libusbgx 0.2.0

---
 source/config/src/configuration_libusbg.c |  4 ++--
 source/function/src/function_libusbg.c    | 26 +++++++++++++-------------
 source/gadget/src/gadget.c                | 16 ++++++++--------
 source/gadget/src/gadget_libusbg.c        | 22 +++++++++++-----------
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/source/config/src/configuration_libusbg.c b/source/config/src/configuration_l
ibusbg.c
index ccbbbaa..dcd0a84 100644
--- a/source/config/src/configuration_libusbg.c
+++ b/source/config/src/configuration_libusbg.c
@@ -165,8 +165,8 @@ int gt_print_config_libusbg(usbg_config *c, int opts)
        usbg_function *f;
        const char *label, *instance, *bname;
        usbg_function_type type;
-       usbg_config_attrs c_attrs;
-       usbg_config_strs c_strs;
+       struct usbg_config_attrs c_attrs;
+       struct usbg_config_strs c_strs;
        int usbg_ret, id;

        label = usbg_get_config_label(c);
diff --git a/source/function/src/function_libusbg.c b/source/function/src/function_libusbg
.c
index 74dba21..dc3e674 100644
--- a/source/function/src/function_libusbg.c
+++ b/source/function/src/function_libusbg.c
@@ -126,18 +126,18 @@ int gt_print_function_libusbg(usbg_function *f, int opts)
                return 0;

        switch (type) {
-       case F_ACM:
-       case F_OBEX:
-       case F_SERIAL:
+       case USBG_F_ACM:
+       case USBG_F_OBEX:
+       case USBG_F_SERIAL:
                fprintf(stdout, "    port_num\t\t%d\n",
                        f_attrs.serial_port_num);
                break;

-       case F_ECM:
-       case F_SUBSET:
-       case F_NCM:
-       case F_EEM:
-       case F_RNDIS:
+       case USBG_F_ECM:
+       case USBG_F_SUBSET:
+       case USBG_F_NCM:
+       case USBG_F_EEM:
+       case USBG_F_RNDIS:
                fprintf(stdout, "    dev_addr\t\t%s\n",
                        ether_ntoa(&f_attrs.net.dev_addr));
                fprintf(stdout, "    host_addr\t\t%s\n",
@@ -146,15 +146,15 @@ int gt_print_function_libusbg(usbg_function *f, int opts)
                fprintf(stdout, "    qmult\t\t%d\n", f_attrs.net.qmult);
                break;

-       case F_PHONET:
+       case USBG_F_PHONET:
                fprintf(stdout, "    ifname\t\t%s\n", f_attrs.phonet_ifname);
                break;

-       case F_FFS:
+       case USBG_F_FFS:
                fprintf(stdout, "    dev_name\t\t%s\n", f_attrs.ffs_dev_name);
                break;

-       case F_MASS_STORAGE:
+       case USBG_F_MASS_STORAGE:
        {
                struct usbg_f_ms_attrs *attrs = &f_attrs.ms;
                int i;
@@ -172,7 +172,7 @@ int gt_print_function_libusbg(usbg_function *f, int opts)
                break;
        }

-       case F_MIDI:
+       case USBG_F_MIDI:
        {
                struct usbg_f_midi_attrs *attrs = &f_attrs.midi;

@@ -185,7 +185,7 @@ int gt_print_function_libusbg(usbg_function *f, int opts)
                break;
        }

-       case F_LOOPBACK:
+       case USBG_F_LOOPBACK:
        {
                struct usbg_f_loopback_attrs *attrs = &f_attrs.loopback;

diff --git a/source/gadget/src/gadget.c b/source/gadget/src/gadget.c
index 1fedb83..2d853ed 100644
--- a/source/gadget/src/gadget.c
+++ b/source/gadget/src/gadget.c
@@ -55,16 +55,16 @@ static void gt_gadget_create_destructor(void *data)
 char *attr_type_get(usbg_gadget_attr a)
 {
        switch (a) {
-       case B_DEVICE_CLASS:
-       case B_DEVICE_SUB_CLASS:
-       case B_DEVICE_PROTOCOL:
-       case B_MAX_PACKET_SIZE_0:
+       case USBG_B_DEVICE_CLASS:
+       case USBG_B_DEVICE_SUB_CLASS:
+       case USBG_B_DEVICE_PROTOCOL:
+       case USBG_B_MAX_PACKET_SIZE_0:
                return "y";

-       case BCD_USB:
-       case ID_VENDOR:
-       case ID_PRODUCT:
-       case BCD_DEVICE:
+       case USBG_BCD_USB:
+       case USBG_ID_VENDOR:
+       case USBG_ID_PRODUCT:
+       case USBG_BCD_DEVICE:
                return "q";

        default:
diff --git a/source/gadget/src/gadget_libusbg.c b/source/gadget/src/gadget_libusbg.c
index 7fb1ebd..8bdecfb 100644
--- a/source/gadget/src/gadget_libusbg.c
+++ b/source/gadget/src/gadget_libusbg.c
@@ -234,25 +234,25 @@ static int disable_func(void *data)
        return 0;
 }

-static void print_gadget_attrs(usbg_gadget_attrs *g_attrs, int *mask) {
-       if (!mask || mask[BCD_USB])
+static void print_gadget_attrs(struct usbg_gadget_attrs *g_attrs, int *mask) {
+       if (!mask || mask[USBG_BCD_USB])
                printf("  bcdUSB\t\t%x.%02x\n",
                        g_attrs->bcdUSB >> 8,
                        g_attrs->bcdUSB & 0x00ff);

-       if (!mask || mask[B_DEVICE_CLASS])
+       if (!mask || mask[USBG_B_DEVICE_CLASS])
                printf("  bDeviceClass\t\t0x%02x\n", g_attrs->bDeviceClass);
-       if (!mask || mask[B_DEVICE_SUB_CLASS])
+       if (!mask || mask[USBG_B_DEVICE_SUB_CLASS])
                printf("  bDeviceSubClass\t0x%02x\n", g_attrs->bDeviceSubClass);
-       if (!mask || mask[B_DEVICE_PROTOCOL])
+       if (!mask || mask[USBG_B_DEVICE_PROTOCOL])
                printf("  bDeviceProtocol\t0x%02x\n", g_attrs->bDeviceProtocol);
-       if (!mask || mask[B_MAX_PACKET_SIZE_0])
+       if (!mask || mask[USBG_B_MAX_PACKET_SIZE_0])
                printf("  bMaxPacketSize0\t%d\n", g_attrs->bMaxPacketSize0);
-       if (!mask || mask[ID_VENDOR])
+       if (!mask || mask[USBG_ID_VENDOR])
                printf("  idVendor\t\t0x%04x\n", g_attrs->idVendor);
-       if (!mask || mask[ID_PRODUCT])
+       if (!mask || mask[USBG_ID_PRODUCT])
                printf("  idProduct\t\t0x%04x\n", g_attrs->idProduct);
-       if (!mask || mask[BCD_DEVICE])
+       if (!mask || mask[USBG_BCD_DEVICE])
                printf("  bcdDevice\t\t%x.%02x\n",
                        g_attrs->bcdDevice >> 8,
                        g_attrs->bcdDevice & 0x00ff);
@@ -263,7 +263,7 @@ static int get_func(void *data)
        struct gt_gadget_get_data *dt;

        usbg_gadget *g;
-       usbg_gadget_attrs g_attrs;
+       struct usbg_gadget_attrs g_attrs;
        int usbg_ret;

        dt = (struct gt_gadget_get_data *)data;
@@ -288,7 +288,7 @@ static int get_func(void *data)

 static int print_gadget(usbg_gadget *g, int opts)
 {
-       usbg_gadget_attrs g_attrs;
+       struct usbg_gadget_attrs g_attrs;
        usbg_udc *u;
        usbg_function *f;
        usbg_config *c;
--
2.16.2
@pszewczyk

This comment has been minimized.

Copy link
Contributor

@pszewczyk pszewczyk commented Mar 5, 2018

Thanks a lot, that looks good. I was just about to send the same fix.
I understand that PRs can be messy, but this is also not the best, you somehow changed indentation to spaces.

@MerlijnWajer

This comment has been minimized.

Copy link
Author

@MerlijnWajer MerlijnWajer commented Mar 5, 2018

Acknowledged, I don't recall changing the indentation, by I do default to softtabs, so that might be the reason. Thanks.

@MerlijnWajer

This comment has been minimized.

Copy link
Author

@MerlijnWajer MerlijnWajer commented Mar 5, 2018

(I'm assuming you do not need me to make a PR?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.