aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_usb.h
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2019-12-11 18:45:13 +0100
committerAndrey Konovalov <andreyknvl@gmail.com>2019-12-11 19:20:07 +0100
commitd973f52833e0e3cec5406aa9cdf606a463d85c46 (patch)
treef45b613d6a74f235489f1735285ea6c4ce1fc5c1 /executor/common_usb.h
parent0d368675f84a2d7f3389d4204bdd6a20d1989006 (diff)
executor: update raw gadget interface
Diffstat (limited to 'executor/common_usb.h')
-rw-r--r--executor/common_usb.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/executor/common_usb.h b/executor/common_usb.h
index d036128de..687baf095 100644
--- a/executor/common_usb.h
+++ b/executor/common_usb.h
@@ -76,10 +76,12 @@ static bool parse_usb_descriptor(char* buffer, size_t length, struct usb_device_
return true;
}
+#define UDC_NAME_LENGTH_MAX 128
+
struct usb_raw_init {
- __u64 speed;
- const __u8* driver_name;
- const __u8* device_name;
+ __u8 driver_name[UDC_NAME_LENGTH_MAX];
+ __u8 device_name[UDC_NAME_LENGTH_MAX];
+ __u8 speed;
};
enum usb_raw_event_type {
@@ -121,9 +123,9 @@ static int usb_raw_open()
static int usb_raw_init(int fd, uint32 speed, const char* driver, const char* device)
{
struct usb_raw_init arg;
+ strncpy((char*)&arg.driver_name[0], driver, sizeof(arg.driver_name));
+ strncpy((char*)&arg.device_name[0], device, sizeof(arg.device_name));
arg.speed = speed;
- arg.driver_name = (const __u8*)driver;
- arg.device_name = (const __u8*)device;
return ioctl(fd, USB_RAW_IOCTL_INIT, &arg);
}