summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-10-02 20:29:33 +0100
committerRichard Hughes <richard@hughsie.com>2016-10-02 20:29:33 +0100
commit2198524b489f934ce357e9f7c39767adc67bab14 (patch)
tree73e14305ff50beea6349d76beb45e6d980392c8d
parentc0c2a42ec2142de4f84dfc0649fd49610fdd4ed3 (diff)
downloadcolord-2198524b489f934ce357e9f7c39767adc67bab14.tar.gz
colorhug: Increase the size of the EP0 transfer
-rw-r--r--lib/colorhug/ch-common.h3
-rw-r--r--lib/colorhug/ch-device.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/colorhug/ch-common.h b/lib/colorhug/ch-common.h
index 854b910..f04fb5b 100644
--- a/lib/colorhug/ch-common.h
+++ b/lib/colorhug/ch-common.h
@@ -1416,8 +1416,9 @@ G_BEGIN_DECLS
**/
#define CH_CMD_SET_CRYPTO_KEY 0x70
-/* these are not yet in the API */
+/* the values here are not really API */
#define CH_EP0_TRANSFER_SIZE 64
+#define CH_EP0_TRANSFER_SIZE_V2 0x400 /* since 1.3.4 */
/* secret code */
#define CH_WRITE_EEPROM_MAGIC "Un1c0rn2"
diff --git a/lib/colorhug/ch-device.c b/lib/colorhug/ch-device.c
index c09f927..8e43880 100644
--- a/lib/colorhug/ch-device.c
+++ b/lib/colorhug/ch-device.c
@@ -2251,7 +2251,7 @@ CdSpectrum *
ch_device_get_spectrum (GUsbDevice *device, GCancellable *cancellable, GError **error)
{
gboolean ret;
- guint16 buf[CH_EP0_TRANSFER_SIZE / sizeof(guint16)];
+ guint16 buf[CH_EP0_TRANSFER_SIZE_V2 / sizeof(guint16)];
gsize actual_length;
guint16 i;
guint16 j;
@@ -2271,7 +2271,7 @@ ch_device_get_spectrum (GUsbDevice *device, GCancellable *cancellable, GError **
"Getting a spectrum is not supported");
return NULL;
}
- for (i = 0; i < 1024 * sizeof(guint16) / CH_EP0_TRANSFER_SIZE; i++) {
+ for (i = 0; i < 1024 * sizeof(guint16) / CH_EP0_TRANSFER_SIZE_V2; i++) {
ret = g_usb_device_control_transfer (device,
G_USB_DEVICE_DIRECTION_DEVICE_TO_HOST,
G_USB_DEVICE_REQUEST_TYPE_CLASS,
@@ -2297,7 +2297,7 @@ ch_device_get_spectrum (GUsbDevice *device, GCancellable *cancellable, GError **
}
/* add data */
- for (j = 0; j < CH_EP0_TRANSFER_SIZE / sizeof(guint16); j++) {
+ for (j = 0; j < CH_EP0_TRANSFER_SIZE_V2 / sizeof(guint16); j++) {
gdouble tmp = (gdouble) buf[j] / (gdouble) 0xffff;
cd_spectrum_add_value (sp, tmp);
}