| 45 | } |
| 46 | |
| 47 | SR_PRIV int command_ctl_rd(libusb_device_handle *devhdl, struct ctl_rd_cmd cmd) |
| 48 | { |
| 49 | int ret; |
| 50 | |
| 51 | assert(devhdl); |
| 52 | |
| 53 | /* Send the control message. */ |
| 54 | ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR | |
| 55 | LIBUSB_ENDPOINT_OUT, CMD_CTL_RD_PRE, 0x0000, 0x0000, |
| 56 | (unsigned char *)&cmd, sizeof(struct ctl_header), 3000); |
| 57 | if (ret < 0) { |
| 58 | sr_err("Unable to send CMD_CTL_RD_PRE command(dest:%d/offset:%d/size:%d): %s.", |
| 59 | cmd.header.dest, cmd.header.offset, cmd.header.size, |
| 60 | libusb_error_name(ret)); |
| 61 | return SR_ERR; |
| 62 | } |
| 63 | |
| 64 | g_usleep(10*1000); |
| 65 | |
| 66 | /* Send the control message. */ |
| 67 | ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR | |
| 68 | LIBUSB_ENDPOINT_IN, CMD_CTL_RD, 0x0000, 0x0000, |
| 69 | (unsigned char *)cmd.data, cmd.header.size, 3000); |
| 70 | |
| 71 | if (ret < 0) { |
| 72 | sr_err("Unable to send CMD_CTL_RD command: %s.", |
| 73 | libusb_error_name(ret)); |
| 74 | return SR_ERR; |
| 75 | } |
| 76 | |
| 77 | return SR_OK; |
| 78 | } |
no outgoing calls
no test coverage detected