<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91057/how-to-create-a-composite-hid-device-using-ncs</link><description>Hi, 
 
 I&amp;#39;m implementing a composite hid device using nrf connect sdk 2.0.0, I do checked the hid-cdc and hid alone samples but there&amp;#39;s still few problems that confused me a lot. 
 1. How to create as many interfaces and dedicated endpoints as I want</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Aug 2022 10:38:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91057/how-to-create-a-composite-hid-device-using-ncs" /><item><title>RE: How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/thread/382429?ContentTypeID=1</link><pubDate>Fri, 19 Aug 2022 10:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e09b0074-a536-450c-97b5-8227af1175e9</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thank you for the feedback, I have forwarded it to our developers.&lt;/p&gt;
&lt;p&gt;Let me know if you have any more questions.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/thread/382312?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 14:29:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:854038ac-a77c-4bd4-8a87-abb882796ef6</guid><dc:creator>Huckies</dc:creator><description>&lt;p&gt;Thank you Sigurd, really appreciate your&amp;nbsp;elaborate answer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The Zephyr system is somehow weird that use device tree nodes to represent cdc devices while using Kconfig to decide the number of hid devices and assumes all the endpoints have the same size and in same pattern.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also the usb driver in nrf5 sdk seems to depend on the clock module which is a part of SoftDevice. Making it barely impossible to call the nrfx usbd driver from NCS. It&amp;#39;s not even a bug as it has no affect on usage ... just wish it can be &amp;quot;fixed&amp;quot; in the near future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/thread/382290?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 13:12:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f0cd5f6-431d-4219-8773-3ca870266396</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]1. How to create as many interfaces and dedicated endpoints as I want (I&amp;#39;m well aware of the hardware limitation and it won&amp;#39;t be a problem), like both IN and OUT for interface 0 and IN alone for interface 1?[/quote]
&lt;p&gt;From the hid-cdc sample, I believe you can add interfaces by adding them to the devicetree, as seen in &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/samples/subsys/usb/hid-cdc/app.overlay"&gt;app.overlay&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the built-in HID support in Zephyr/NCS, Interrupt OUT endpoint can be enabled by the Kconfig option ENABLE_HID_INT_OUT_EP, and because it is Kconfig option the effect is global, any USB HID interface would have OUT endpoint enabled. The only workaround is to use HID core code in Zephyr as reference and implement own specific interface.&lt;/p&gt;
[quote user=""]2.How to create something like irq handler in ncs so I can handle the interrupt OUT endpoint without polling the buffer?[/quote]
&lt;p&gt;I can see that the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/usb/hid.html"&gt;USB Human Interface Devices (HID) support&lt;/a&gt; has some types for &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/usb/hid.html#hid-class-device-api-reference"&gt;callbacks&lt;/a&gt;. &lt;br /&gt;We have no examples showcasing these, so you would have to use them with only guidance from these docs.&lt;/p&gt;
&lt;p&gt;Our &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/nrf/samples/bluetooth/peripheral_hids_mouse/README.html"&gt;Bluetooth Low Energy HIDS Mouse &lt;/a&gt;has another solution to this: polling in a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/kernel/services/threads/workqueue.html"&gt;Workqueue Thread&lt;/a&gt;, see &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/053756565898659278f957e5f58000cc0491a88d/samples/bluetooth/peripheral_hids_mouse/src/main.c#L786"&gt;the sample code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I asked our developers about this as well, and they say:&lt;br /&gt;There is struct hid_ops which can be passed as argument to the function usb_hid_register_device(), see samples/subsys/usb/hid/src/main.c, int_in_ready callback can be used for notification when a packet has been transmitted (to the host) and int_out_ready when there is a new OUT packet.&lt;/p&gt;
[quote user=""]3.What Kconfig options do I need?[/quote]
&lt;p&gt;I think you will find all the configurations you need in the examples I listed above. Other than that, our &lt;a href="https://marketplace.visualstudio.com/items?itemName=nordic-semiconductor.nrf-kconfig"&gt;VS Code nRF Kconfig extension&lt;/a&gt; and our &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/kconfig/index.html"&gt;Kconfig search&lt;/a&gt; are useful tools.&lt;/p&gt;
&lt;p&gt;See options such as ENABLE_HID_INT_OUT_EP, HID_INTERRUPT_EP_MPS and anything prefixed with USB_HID_.&lt;/p&gt;
&lt;p&gt;Does this answer your questions?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/thread/382127?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 04:08:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c608b941-1fd6-4db8-8cfe-fbb1ce206591</guid><dc:creator>Huckies</dc:creator><description>&lt;p&gt;Is there any progress? I got enough endpoints (IN*2 and OUT*2) with sufficient size (all 64 bytes), but I still wonder if there is a more appropriate way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a composite HID device using NCS?</title><link>https://devzone.nordicsemi.com/thread/382063?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 13:37:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71cb6532-01c8-4043-9ed3-becc75f857d9</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will look into your case and return with more information tomorrow.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>