memcpy(&out[0x0f], msg, msg[0] + 1);
memset(rdata, 0, sizeof(struct recv_data));
- hmcfgusb_send(dev, out, sizeof(out), 2);
+ hmcfgusb_send(dev, out, sizeof(out), 1);
while (1) {
if (rdata->message_type == MESSAGE_TYPE_R) {
((rdata->status & 0xff) == 0x02)) {
break;
} else {
- fprintf(stderr, "\n\nInvalid status: %04x\n\n", rdata->status);
+ fprintf(stderr, "\nInvalid status: %04x\n", rdata->status);
return 0;
}
}
out[0] = 'G';
out[1] = speed;
- hmcfgusb_send(dev, out, sizeof(out), 2);
+ hmcfgusb_send(dev, out, sizeof(out), 1);
while (1) {
errno = 0;
out[2] = (hmid >> 8) & 0xff;
out[3] = hmid & 0xff;
- hmcfgusb_send(dev, out, sizeof(out), 2);
+ hmcfgusb_send(dev, out, sizeof(out), 1);
switchcnt = 3;
do {
}
} while ((!switched) && (switchcnt--));
+ if (!switched) {
+ fprintf(stderr, "Too many errors, giving up!\n");
+ exit(EXIT_FAILURE);
+ }
printf("Yes!\n");