<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/3558" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2009-11-21T23:16:46+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/3558</id>

		<entry>
		<author><name><![CDATA[toface]]></name></author>
		<updated>2009-11-21T17:11:05+02:00</updated>

		<published>2009-11-21T17:11:05+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12080#p12080</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12080#p12080"/>
		<title type="html"><![CDATA[Re: HIDkeyboard report descriptor problem]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12080#p12080"><![CDATA[
Ok, for some reason it seems not all of the HID descriptor is sent. I turned on debugging, and hooked it up to an ftdi chip:<br /><div class="codebox"><p>Code: </p><pre><code>00:<br /><br />ff:<br />ff:<br />ff:<br />ff:<br />ff:<br />ff:<br />ff:<br />ff:<br />1d: 80 06 00 01 00 00<br /> 40 00 dd 94<br />20: 4b 12 01 10 01 00 00 00 08 11 77<br />20: c3 42 42 31 e1 00 01 01 02 31 bf<br />20: 4b 00 01 3f 8f<br />ff:<br />ff:<br />ff:<br />ff:<br />ff:<br />1d: 00 05 0d 00 00 00 00 00 eb e9<br />20: 4b 00 00<br />1d: 80 06 00 01 00 00 12 00 e0 f4<br />20: 4b 12 01 10 01 00 00 00 08 11 77<br />20: c3 42 42 31 e1 00 01 01 02 31 bf<br />20: 4b 00 01 3f 8f<br />1d: 80 06 00 02 00 00 09 00 ae 04<br />20: 4b 09 02 22 00 01 01 00 80 0b 40<br />20: c3 32 c1 6a<br />1d: 80 06 00 02 00 00 22 00 b0 f4<br />20: 4b 09 02 22 00 01 01 00 80 0b 40<br />20: c3 32 09 04 00 00 01 03 00 f4 8d<br />20: 4b 00 00 09 21 01 01 00 01 92 96<br />20: c3 22 23 00 07 05 81 03 08 ca e5<br />20: 4b 00 0a 7e 48<br />1d: 80 06 00 03 00 00 ff 00 d4 64<br />20: 4b 04 03 09 04 <br />09 78<br />1d: 80 06 02 03 09 04 ff 00 97 db<br />20: 4b 10 03 48 00 49 00 44 00 a7 2c<br />20: c3 4b 00 65 00 79 00 73 00 cf ee<br />20: 4b 00 00<br />1d: 80 06 01 03 09 04 ff 00 97 e8<br />20: 4b 12 03 6f 00 62 00 64 00 30 06<br />20: c3 65 00 76 00 2e 00 61 00 52 0d<br />20: 4b 74 00 d9 4f<br />1d: 00 09 01 00 00 00 00 00 27 25<br />20: 4b 00 00<br />1d: 21 0a 00 00 00 00 00 00 d6 20<br />20: 4b 00 00<br />1d: 81 06 00 22 00 00 23 00 f1 6f<br />20: 4b 05 01 09 06 a1 01 05 07 d7 3c<br />20: c3 15 00 25 01 19 4f 29 52 ec d4<br />20: 4b 75 01 95 04 81 02 95 01 a3 86<br />20: c3 19 e0 29 e0 81 02 19 e2 1b 56<br />20: 4b 29 e2 81 d7 37<br /></code></pre></div><br /><br /><br />As can be seen, the whole descriptor isn't sent.. Looking around in the .h files I found the error.. I didn't change the USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH  <img class="smilies" src="./../../../images/smilies/icon_redface.gif" alt=":oops:" title="Embarassed" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3147">toface</a> — Sat Nov 21, 2009 5:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[toface]]></name></author>
		<updated>2009-11-21T23:16:46+02:00 </updated>

		<published>2009-11-20T17:37:03+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12073#p12073</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12073#p12073"/>
		<title type="html"><![CDATA[[SOLVED] HIDkeyboard report descriptor problem]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3558&amp;p=12073#p12073"><![CDATA[
I'm using the HIDkeys (2007.03.29) project as a base to make a MAME keyboard. After reading a lot of documentation I *think* that I know how to make a HIDkeyboard that can have 10 or more simultaneous keys (2 directions + 3 buttons per player) with a report size of 3 bytes. The problem is that the linux kernel does not agree with me =\. I have constructed/parsed the report descriptor itself with the &quot;HID Descriptor Tool(DT)&quot; from usb.org, but I still suspect it is either wrong or somehow too big for vusb.<br /><br />I have tried replacing the usbdrv with the latest version, but that did not help (nor break) anything.<br /><br />The hardware is EXACTLY the same as the HIDkeys project. That means mega8 connected with a supply voltage of ~3.5V. If I compile the original HIDkeys program and flash it, it works flawlessly:<br />[ 9819.345390] usb 2-2.1: new low speed USB device using uhci_hcd and address 15<br />[ 9819.500539] usb 2-2.1: configuration #1 chosen from 1 choice<br />[ 9819.525534] input: obdev.at HIDKeys as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2.1/2-2.1:1.0/input/input7<br />[ 9819.525650] generic-usb 0003:4242:E131.0007: input,hidraw1: USB HID v1.01 Keyboard [obdev.at HIDKeys] on usb-0000:00:1d.0-2.1/input0<br /><br />However as soon as I replace the report descriptor (and change the report size), it just refuses to work and I get this:<br />[ 9777.097659] usb 2-2.1: new low speed USB device using uhci_hcd and address 14<br />[ 9777.249654] usb 2-2.1: configuration #1 chosen from 1 choice<br />[ 9777.264061] generic-usb: probe of 0003:4242:E131.0006 failed with error -22<br /><br />Here is the diff -urN between the two files:<br /><div class="codebox"><p>Code: </p><pre><code>--- main.c   2009-11-20 16:13:40.000000000 +0100<br />+++ minimal_not_working.c   2009-11-20 15:30:49.000000000 +0100<br />@@ -107,26 +107,110 @@<br /> static uchar    reportBuffer&#91;2&#93;;    /* buffer for HID reports */<br /> static uchar    idleRate;           /* in 4 ms units */<br /> <br />-PROGMEM char usbHidReportDescriptor&#91;35&#93; = { /* USB report descriptor */<br />-    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)<br />-    0x09, 0x06,                    // USAGE (Keyboard)<br />-    0xa1, 0x01,                    // COLLECTION (Application)<br />-    0x05, 0x07,                    //   USAGE_PAGE (Keyboard)<br />-    0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)<br />-    0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)<br />-    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)<br />-    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)<br />-    0x75, 0x01,                    //   REPORT_SIZE (1)<br />-    0x95, 0x08,                    //   REPORT_COUNT (8)<br />-    0x81, 0x02,                    //   INPUT (Data,Var,Abs)<br />-    0x95, 0x01,                    //   REPORT_COUNT (1)<br />-    0x75, 0x08,                    //   REPORT_SIZE (8)<br />-    0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)<br />-    0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))<br />-    0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)<br />-    0x81, 0x00,                    //   INPUT (Data,Ary,Abs)<br />-    0xc0                           // END_COLLECTION<br />+PROGMEM char usbHidReportDescriptor&#91;121&#93; = { /* USB report descriptor */<br />+  0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)<br />+  0x09, 0x06,                    // USAGE (Keyboard)<br />+  0xa1, 0x01,                    // COLLECTION (Application)<br />+  0x05, 0x07,                    //   USAGE_PAGE (Keyboard)<br />+  0x15, 0x00,                    //   LOGICAL_MINIMUM (0)<br />+  0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)<br />+/*<br />+   Player 1<br />+   Right, Left, Down, Up <br />+   Left Ctrl<br />+   Left Alt<br />+   Space<br />+   1<br />+*/<br />+  0x19, 0x4f,                    //   USAGE_MINIMUM (Keyboard Right Arrow)<br />+  0x29, 0x52,                    //   USAGE_MAXIMUM (Keyboard Up Arrow)<br />+  0x75, 0x01,                    //   REPORT_SIZE (1) 1-bit value<br />+  0x95, 0x04,                    //   REPORT_COUNT (4) 4 keys<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+  0x95, 0x01,                    //   REPORT_COUNT (1) 1 key<br />+<br />+  0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)<br />+  0x29, 0xe0,                    //   USAGE_MAXIMUM (Keyboard LeftControl)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0xe2,                    //   USAGE_MINIMUM (Keyboard LeftAlt)<br />+  0x29, 0xe2,                    //   USAGE_MAXIMUM (Keyboard LeftAlt)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x2c,                    //   USAGE_MINIMUM (Keyboard Space)<br />+  0x29, 0x2c,                    //   USAGE_MAXIMUM (Keyboard Space)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x1e,                    //   USAGE_MINIMUM (Keyboard LeftAlt)<br />+  0x29, 0x1e,                    //   USAGE_MAXIMUM (Keyboard LeftAlt)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+/*<br />+   Player 2<br />+   G, D, F, R <br />+   A<br />+   S<br />+   Q<br />+   2<br />+*/<br />+  0x19, 0x0a,                    //   USAGE_MINIMUM (Keyboard G)<br />+  0x29, 0x0a,                    //   USAGE_MAXIMUM (Keyboard G)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x07,                    //   USAGE_MINIMUM (Keyboard D)<br />+  0x29, 0x07,                    //   USAGE_MAXIMUM (Keyboard D)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x09,                    //   USAGE_MINIMUM (Keyboard F)<br />+  0x29, 0x09,                    //   USAGE_MAXIMUM (Keyboard F)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x15,                    //   USAGE_MINIMUM (Keyboard R)<br />+  0x29, 0x15,                    //   USAGE_MAXIMUM (Keyboard R)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x04,                    //   USAGE_MINIMUM (Keyboard A)<br />+  0x29, 0x04,                    //   USAGE_MAXIMUM (Keyboard A)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x16,                    //   USAGE_MINIMUM (Keyboard S)<br />+  0x29, 0x16,                    //   USAGE_MAXIMUM (Keyboard S)<br />+  0x81, 0x02,                    //   INPUT (Data,Var,Abs) add report<br />+<br />+  0x19, 0x14,                    //   usage_minimum (keyboard Q)<br />+  0x29, 0x14,                    //   usage_maximum (keyboard Q)<br />+  0x81, 0x02,                    //   input (data,var,abs) add report<br />+<br />+  0x19, 0x1f,                    //   usage_minimum (keyboard 2)<br />+  0x29, 0x1f,                    //   usage_maximum (keyboard 2)<br />+  0x81, 0x02,                    //   input (data,var,abs) add report<br />+<br />+/*<br />+   Extra<br />+   5, 6 - Coin in <br />+   ESC - Quit game<br />+*/<br />+<br />+  0x19, 0x22,                    //   usage_minimum (keyboard 5)<br />+  0x29, 0x22,                    //   usage_maximum (keyboard 5)<br />+  0x81, 0x02,                    //   input (data,var,abs) add report<br />+<br />+  0x19, 0x23,                    //   usage_minimum (keyboard 6)<br />+  0x29, 0x23,                    //   usage_maximum (keyboard 6)<br />+  0x81, 0x02,                    //   input (data,var,abs) add report<br />+<br />+  0x19, 0x29,                    //   usage_minimum (keyboard ESC)<br />+  0x29, 0x29,                    //   usage_maximum (keyboard ESC)<br />+  0x81, 0x02,                    //   input (data,var,abs) add report<br />+<br />+  0x75, 0x05,                    //   REPORT_SIZE (5) 5-bit padding<br />+  0x81, 0x03,                    //   INPUT (Const,Var,Abs) add report<br />+  0xc0                           //   END_COLLECTION<br /> };<br />+<br />+<br />+<br />+<br /> /* We use a simplifed keyboard report descriptor which does not support the<br />  * boot protocol. We don't allow setting status LEDs and we only allow one<br />  * simultaneous key press (except modifiers). We can therefore use short<br />@@ -223,7 +307,10 @@<br /> static void buildReport(uchar key)<br /> {<br /> /* This (not so elegant) cast saves us 10 bytes of program memory */<br />-    *(int *)reportBuffer = pgm_read_word(keyReport&#91;key&#93;);<br />+    //*(int *)reportBuffer = pgm_read_word(keyReport&#91;key&#93;);<br />+   reportBuffer&#91;0&#93; = 0;<br />+   reportBuffer&#91;1&#93; = 0;<br />+   reportBuffer&#91;2&#93; = 0;<br /> }<br /> <br /> uchar   usbFunctionSetup(uchar data&#91;8&#93;)<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3147">toface</a> — Fri Nov 20, 2009 5:37 pm</p><hr />
]]></content>
	</entry>
	</feed>
