{
/* The 3 below is the length of "xx " where xx is the hex string
* representation of a byte */
- return ((i+1) % (80/3));
+ return ((i + 1) % (80 / 3));
}
static void trace_dump_buffer(am7xxx_context *ctx, const char *message,
}
if (current_configuration != (*dev)->desc->configuration) {
- debug(ctx, "libusb configuration changed (expected: %hhu, current: %hhu\n",
+ debug(ctx, "libusb configuration changed (expected: %hhu, current: %d)\n",
(*dev)->desc->configuration, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;
*ctx = malloc(sizeof(**ctx));
if (*ctx == NULL) {
fatal("cannot allocate the context (%s)\n", strerror(errno));
- ret = -ENOMEM;
- goto out;
+ return -ENOMEM;
}
memset(*ctx, 0, sizeof(**ctx));
int ret;
struct am7xxx_header h;
- if (dev->device_info) {
- memcpy(device_info, dev->device_info, sizeof(*device_info));
- return 0;
- }
+ /* if there is a cached copy of the device info, just return that */
+ if (dev->device_info)
+ goto return_value;
ret = send_command(dev, AM7XXX_PACKET_TYPE_DEVINFO);
if (ret < 0)
dev->device_info->unknown1 = h.header_data.devinfo.unknown1;
#endif
+return_value:
+ if (device_info)
+ memcpy(device_info, dev->device_info, sizeof(*device_info));
return 0;
}
unsigned int *scaled_width,
unsigned int *scaled_height)
{
-
am7xxx_device_info device_info;
float width_ratio;
float height_ratio;