10 #include <hidapi/hidapi.h>
19 static const u8 run1[] = {0xC0, 0x08, 0x82, 0x01, 0x00, 0x84};
20 static const u8 run2[] = {0x60, 0x64, 0x03, 0x01, 0x60, 0x64, 0x00};
38 size_t exec_sz = strlen(exec) + 1;
43 mempcpy(mempcpy(mempcpy((
u8 *)&run->
bytes,
59 errmsg =
"`exec` has been successful.";
62 else if (
ev3_close == (
void (*)())hid_close)
65 if (sscanf((
const char*)reply.bytes,
"\t%08x\n", &len))
68 printf(
"%.*s", len > 1000 ? 1000 : len, (
char*)reply.bytes + 10);
70 while ((res = hid_read_timeout(
handle, reply.bytes,
71 sizeof reply + 2, 100)) > 0 )
73 printf(
"%.*s", len > 1000 ? 1000 : len, (
char*)reply.bytes);
81 errmsg =
"`exec` status unknown.";
EV3_VM_COMMAND_FIELDS u8 bytes[]
Error enumerations and decriptions.
int run(const char *exec, unsigned timeout)
run rbf file
EXTERN void(* ev3_close)(void *)
#define packet_alloc(type, extra)
EXTERN int(* ev3_read_timeout)(void *, u8 *, size_t, int milliseconds)
packed structs for the packets.
const VM_REPLY EXECUTE_FILE_REPLY_SUCCESS
EXTERN const char * errmsg
global variable for last error message
contains declarations for ev3 commands
EXTERN int(* ev3_write)(void *, const u8 *, size_t)