<?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/1470" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-05-28T17:19:05+02:00</updated>

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

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-05-28T17:19:05+02:00</updated>

		<published>2008-05-28T17:19:05+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5454#p5454</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5454#p5454"/>
		<title type="html"><![CDATA[Connection error with adapted Automator and LibUSB]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5454#p5454"><![CDATA[
I guess you want to send a feature report to the device. Since your device is a keyboard, a operating system driver is already attached to it. This may cause some problems.<br /><br />I have heard about problems with newer Linux kernels and HID. It seems that you must claim an interface in order to communicate.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Wed May 28, 2008 5:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Imrazor]]></name></author>
		<updated>2008-05-20T09:51:54+02:00</updated>

		<published>2008-05-20T09:51:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5405#p5405</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5405#p5405"/>
		<title type="html"><![CDATA[Connection error with adapted Automator and LibUSB]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1470&amp;p=5405#p5405"><![CDATA[
Hi!<br /><br />I'm working with an AT90USBKEY from ATMEL (demo board with an AT90USB1287 on it) and at the moment I'm working on a host application, that allows to connect to my HID device.<br /><br />On my AT90USB1287 I have a firmware running, that implements an HID Keyboard for a keymatrix connected to the AVR. Therefore I used the USB library MyUSB written by Dean Camera for the AT90USB family.<br /><br />The next step in my project is to make it possible to change the keycodes, that are sent by pressing a button. Due to this, the user can define himeself, what function the F-buttons on the keymatrix have.<br /><br />On the search how to realize this, I found the Automator application, that does similar things.<br /><br />Ok, i have adapted the Automator host application to my needs, but when I try to send a keycode that was typed into my application, I get the errormessage:<br /><br /><strong class="text-strong">Error writing to device: Communication error with device</strong><br /><br />In the Linux console from where I have startet my application, I geht following error:<br /><br /><strong class="text-strong">Warning: could not set configuration: could not set config 1: Device or resource busy<br />Error sending message: error sending control message: Broken pipe</strong><br /><br />My question is now: Where is the problem?  <img class="smilies" src="./../../../images/smilies/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /> <br /><br />I cant't find the problem in my code, perhaps someone here in the forum has any idea.<br />I have changed the communication thing from the FEATURE report to an OUT report:<br /><br /><div class="codebox"><p>Code: </p><pre><code>static int uploadData&#40;const char* data&#91;5&#93;&#41;<br />&#123;<br />usbDevice_t *dev = NULL;<br />int         err = 0, len;<br />char        buffer&#91;9&#93;;<br /><br />    if&#40;&#40;err = usbOpenDevice&#40;&amp;dev, IDENT_VENDOR_NUM, IDENT_VENDOR_STRING, IDENT_PRODUCT_NUM, IDENT_PRODUCT_STRING, 1&#41;&#41; != 0&#41;&#123;<br />        fl_alert&#40;&quot;Error opening USBKEY device: %s&quot;, usbErrorMessage&#40;err&#41;&#41;;<br />        goto errorOccurred;<br />    &#125;<br />   <br />   len = sizeof&#40;buffer&#41;;<br />        buffer&#91;0&#93; = 0;  /* report ID: setData */<br />        memcpy&#40;buffer + 1, data, 5&#41;;<br />        if&#40;&#40;err = usbSetReport&#40;dev, USB_HID_REPORT_TYPE_OUTPUT, buffer, 6&#41;&#41; != 0&#41;&#123;<br />            fl_alert&#40;&quot;Error writing to device: %s&quot;, usbErrorMessage&#40;err&#41;&#41;;<br />            goto errorOccurred;<br />        &#125;<br />    <br />errorOccurred:<br />    if&#40;dev != NULL&#41;<br />        usbCloseDevice&#40;dev&#41;;<br />    return err;<br />&#125;<br /></code></pre></div><br /><br />My device has the following descriptors:<br /><br /><div class="codebox"><p>Code: </p><pre><code>USB_Descriptor_HID_Keyboard_Report_t KeyboardReport PROGMEM =<br />&#123;<br />   ReportData:<br />   &#123;<br />      0x05, 0x01,          /* Usage Page &#40;Generic Desktop&#41;                    */<br />      0x09, 0x06,          /* Usage &#40;Keyboard&#41;                                */<br />      0xa1, 0x01,          /* Collection &#40;Application&#41;                        */<br />      0x05, 0x07,          /*   Usage Page &#40;Keyboard&#41;                         */<br />      0x19, 0xe0,          /*   Usage Minimum &#40;Keyboard LeftControl&#41;          */<br />      0x29, 0xe7,          /*   Usage Maximum &#40;Keyboard Right GUI&#41;            */<br />      0x15, 0x00,          /*   Logical Minimum &#40;0&#41;                           */<br />      0x25, 0x01,          /*   Logical Maximum &#40;1&#41;                           */<br />      0x75, 0x01,          /*   Report Size &#40;1&#41;                               */<br />      0x95, 0x08,          /*   Report Count &#40;8&#41;                              */<br />      0x81, 0x02,          /*   Input &#40;Data, Variable, Absolute&#41;              */<br />      0x95, 0x01,          /*   Report Count &#40;1&#41;                              */<br />      0x75, 0x08,          /*   Report Size &#40;8&#41;                               */<br />      0x81, 0x03,          /*   Input &#40;Const, Variable, Absolute&#41;             */<br />      0x95, 0x01,          /*   Report Count &#40;1&#41;                              */<br />      0x75, 0x08,          /*   Report Size &#40;8&#41;                               */<br />      0x15, 0x00,          /*   Logical Minimum &#40;0&#41;                           */<br />      0x25, 0x65,          /*   Logical Maximum &#40;101&#41;                         */<br />      0x05, 0x07,          /*   Usage Page &#40;Keyboard&#41;                         */<br />      0x19, 0x00,          /*   Usage Minimum &#40;Reserved &#40;no event indicated&#41;&#41; */<br />      0x29, 0x65,          /*   Usage Maximum &#40;Keyboard Application&#41;          */<br />      0x81, 0x00,          /*   Input &#40;Data, Array, Absolute&#41;                 */<br />      0xc0,                /* End Collection                                  */<br /><br />      0x05,0xFF,        /* Usage Page &#40;Vendor defined&#41;         */<br />      0xa1,0x01,        /* Collection &#40;Application&#41;         */<br />      0x09,0x01,        /*   Usage &#40;Vendor defined&#41;         */<br />      0x75,0x08,        /*   Report Size &#40;8&#41;            */<br />      0x95,0x01,           /*   Report Count &#40;1&#41;            */<br />      0x91,0x02,        /*   Output &#40;Data, Variable, Absolute&#41;      */<br />      0xc0                 /* End Collection                                  */<br />   &#125;<br />&#125;;<br /></code></pre></div><br /><br />An endpoint for the datatransmission is also defined:<br /><br /><div class="codebox"><p>Code: </p><pre><code>   DataEndpoint:<br />      &#123;<br />         Header:                 &#123;Size: sizeof&#40;USB_Descriptor_Endpoint_t&#41;, Type: DTYPE_Endpoint&#125;,<br /><br />         EndpointAddress:        &#40;ENDPOINT_DESCRIPTOR_DIR_OUT | DATA_EPNUM&#41;,<br />         Attributes:             EP_TYPE_INTERRUPT,<br />         EndpointSize:           KEYBOARD_EPSIZE,<br />         PollingIntervalMS:      0x02<br />      &#125;<br /></code></pre></div><br /><br />After this error I also tried to connect from a Windows XP, running in a VMware, but there my application can't even find the device.<br /><br />Im using Kubuntu 7.10 on my computer...<br /><br />THANKS FOR ANY HINT!  <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=":wink:" title="Wink" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1106">Imrazor</a> — Tue May 20, 2008 9:51 am</p><hr />
]]></content>
	</entry>
	</feed>
