<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[James's Programming Page — LinuxHidStream GetFeature/SetFeature]]></title>
		<link>https://swforum.seekye.com/topic/10079/</link>
		<atom:link href="https://swforum.seekye.com/feed/rss/topic/10079/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in LinuxHidStream GetFeature/SetFeature.]]></description>
		<lastBuildDate>Tue, 04 Aug 2015 16:20:53 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature/SetFeature]]></title>
			<link>https://swforum.seekye.com/post/12940/#p12940</link>
			<description><![CDATA[<p>Both methods in LinuxHidStream.cs in v1.5 downloaded from zer7.com/software/hidsharp contain this line:<br /></p><div class="codebox"><pre><code>throw new NotSupportedException(); // TODO</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (bdunne)]]></author>
			<pubDate>Tue, 04 Aug 2015 16:20:53 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/12940/#p12940</guid>
		</item>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature/SetFeature]]></title>
			<link>https://swforum.seekye.com/post/12938/#p12938</link>
			<description><![CDATA[<p>Hello bdunne,</p><p>Hmm. The version of HidSharp I have here already has GetFeature/SetFeature on Linux. What version are you using? (Or is the current implementation broken?)</p><p>Thanks!</p><p>James</p>]]></description>
			<author><![CDATA[null@example.com (Zer)]]></author>
			<pubDate>Mon, 03 Aug 2015 21:28:37 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/12938/#p12938</guid>
		</item>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature/SetFeature]]></title>
			<link>https://swforum.seekye.com/post/12936/#p12936</link>
			<description><![CDATA[<p>I was able to get this working after coming across this c code:<br />github.com/signal11/hidapi/blob/master/linux/hid.c</p><p>The changes I made were:</p><p><strong>NativeMethods.cs</strong></p><div class="codebox"><pre><code>        public static int HIDIOCSFEATURE(int len)
        {
            return IOC(IOC_WRITE | IOC_READ, (byte)&#039;H&#039;, 6, len);
        }

        public static int HIDIOCGFEATURE(int len)
        {
            return IOC(IOC_WRITE | IOC_READ, (byte)&#039;H&#039;, 7, len);
        }

        [DllImport(libc, SetLastError = true)]
        public static extern int ioctl(int filedes, int command, IntPtr data);</code></pre></div><p><strong>LinuxHidStream.cs</strong></p><div class="codebox"><pre><code>        public override void GetFeature (byte[] buffer, int offset, int count)
        {
            byte[] data = new byte[count];
            Array.Copy (buffer, offset, data, 0, count);
            GetFeatureNative(data);
            Array.Copy (data, 0, buffer, offset, count);
        }

        unsafe void GetFeatureNative(byte[] data)
        {
            fixed (byte* ptr = data) 
            {
                NativeMethods.ioctl (_handle, NativeMethods.HIDIOCGFEATURE (data.Length), (IntPtr)ptr);
            }
        }

        public override void SetFeature(byte[] buffer, int offset, int count)
        {
            byte[] data = new byte[count];
            Array.Copy (buffer, offset, data, 0, count);
            SetFeatureNative(data);
        }

        unsafe void SetFeatureNative(byte[] data)
        {
            fixed (byte* ptr = data) 
            {
                NativeMethods.ioctl (_handle, NativeMethods.HIDIOCSFEATURE (data.Length), (IntPtr)ptr);
            }
        }</code></pre></div><p>Hopefully it will be of use to somebody else</p>]]></description>
			<author><![CDATA[null@example.com (bdunne)]]></author>
			<pubDate>Fri, 17 Jul 2015 08:41:22 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/12936/#p12936</guid>
		</item>
		<item>
			<title><![CDATA[LinuxHidStream GetFeature/SetFeature]]></title>
			<link>https://swforum.seekye.com/post/12935/#p12935</link>
			<description><![CDATA[<p>Hi,</p><p>I was looking to use your library to control a Blink(1) device.</p><p>It works fine in windows but on a raspberry pi (the real target device) it won&#039;t work because GetFeature &amp; SetFeature are not implemented.</p><p>Can you please tell me if this is something that is being looked at or if you can provide some pointers as to how I might add the functionality.</p><p>Thanks,<br />Barry.</p>]]></description>
			<author><![CDATA[null@example.com (bdunne)]]></author>
			<pubDate>Thu, 16 Jul 2015 11:09:47 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/12935/#p12935</guid>
		</item>
	</channel>
</rss>
