summaryrefslogtreecommitdiffstats
path: root/app/consumer.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/consumer.c')
-rw-r--r--app/consumer.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/app/consumer.c b/app/consumer.c
index c61c4cc..79d25bb 100644
--- a/app/consumer.c
+++ b/app/consumer.c
@@ -10,25 +10,25 @@ static const uint8_t consumer_report_descriptor[] = {
0x75, 0x01, /* Report size (1) */
0x95, 0x10, /* Report count (16) */
- 0x09, 0xb5, /* USAGE (Scan Next Track) */
- 0x09, 0xb6, /* USAGE (Scan Prev Track) */
- 0x09, 0xb7, /* USAGE (Stop) */
- 0x09, 0xcd, /* USAGE (Play/Pause) */
-
- 0x09, 0xe2, /* USAGE (Mute) */
- 0x09, 0xe9, /* USAGE (Volume up) */
- 0x09, 0xea, /* USAGE (Volume down) */
- 0x0a, 0x21, 0x02, /* USAGE (www search) */
-
- 0x0a, 0x23, 0x02, /* USAGE (www home) */
- 0x0a, 0x24, 0x02, /* USAGE (www back) */
- 0x0a, 0x25, 0x02, /* USAGE (www forward) */
- 0x0a, 0x26, 0x02, /* USAGE (www stop) */
-
- 0x0a, 0x27, 0x02, /* USAGE (www refresh) */
- 0x0a, 0x2a, 0x02, /* USAGE (www favourites) */
- 0x0a, 0x8a, 0x01, /* USAGE (Mail) */
- 0x0a, 0x92, 0x01, /* USAGE (Calculator) */
+ 0x09, 0xb5, /* USAGE (Scan Next Track) */
+ 0x09, 0xb6, /* USAGE (Scan Prev Track) */
+ 0x09, 0xb7, /* USAGE (Stop) */
+ 0x09, 0xcd, /* USAGE (Play/Pause) */
+
+ 0x09, 0xe2, /* USAGE (Mute) */
+ 0x09, 0xe9, /* USAGE (Volume up) */
+ 0x09, 0xea, /* USAGE (Volume down) */
+ 0x0a, 0x21, 0x02, /* USAGE (www search) */
+
+ 0x0a, 0x23, 0x02, /* USAGE (www home) */
+ 0x0a, 0x24, 0x02, /* USAGE (www back) */
+ 0x0a, 0x25, 0x02, /* USAGE (www forward) */
+ 0x0a, 0x26, 0x02, /* USAGE (www stop) */
+
+ 0x0a, 0x27, 0x02, /* USAGE (www refresh) */
+ 0x0a, 0x2a, 0x02, /* USAGE (www favourites) */
+ 0x0a, 0x8a, 0x01, /* USAGE (Mail) */
+ 0x0a, 0x92, 0x01, /* USAGE (Calculator) */
0x81, 0x62, /* Input (data, variable, relative, preferreed) */
0xC0 /* End Collection */
@@ -61,7 +61,7 @@ const struct usb_endpoint_descriptor consumer_endpoint = {
.bEndpointAddress = CONSUMER_EP,
.bmAttributes = USB_ENDPOINT_ATTR_INTERRUPT,
.wMaxPacketSize = 2,
- .bInterval = 0x1 //0x20,
+ .bInterval = 0x1 //0x20,
};
const struct usb_interface_descriptor consumer_iface = {
@@ -92,33 +92,32 @@ consumer_get_descriptor (uint8_t ** buf, uint16_t * len)
}
-
+
static void
consumer_send (uint16_t keys)
{
/*Last byte is the power wakeup stuff that we don't yet support */
uint8_t buf[CONSUMER_EP_TXN_SIZE] = { keys & 0xff, keys >> 8 };
- usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof(buf));
+ usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof (buf));
}
-void consumer_dispatch(int bit,int updown)
+void
+consumer_dispatch (int bit, int updown)
{
-static uint16_t keys;
+ static uint16_t keys;
-if (updown)
- keys|=bit;
-else
- keys &= ~bit;
+ if (updown)
+ keys |= bit;
+ else
+ keys &= ~bit;
#ifdef DEBUG
-printf("CNS> %02x %02x\r\n",keys & 0xff, keys >>8 );
+ printf ("CNS> %02x %02x\r\n", keys & 0xff, keys >> 8);
#endif
-consumer_send(keys);
+ consumer_send (keys);
}
-
-