<?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 buffer offset]]></title>
		<link>https://swforum.seekye.com/topic/10142/</link>
		<atom:link href="https://swforum.seekye.com/feed/rss/topic/10142/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in LinuxHidStream GetFeature buffer offset.]]></description>
		<lastBuildDate>Tue, 25 Feb 2020 11:35:52 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature buffer offset]]></title>
			<link>https://swforum.seekye.com/post/13115/#p13115</link>
			<description><![CDATA[<p>Haha looks like we&#039;ve implemented the exact same fix, and are both equally puzzled by it.<br />Great minds think alike.</p>]]></description>
			<author><![CDATA[null@example.com (itamaram)]]></author>
			<pubDate>Tue, 25 Feb 2020 11:35:52 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/13115/#p13115</guid>
		</item>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature buffer offset]]></title>
			<link>https://swforum.seekye.com/post/13114/#p13114</link>
			<description><![CDATA[<p>Had the same issue...see my post on Ubuntu and Byte Ordering and scroll to the last message....https://forum.zer7.com/topic/10140/</p>]]></description>
			<author><![CDATA[null@example.com (johnbizios)]]></author>
			<pubDate>Tue, 11 Feb 2020 18:01:00 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/13114/#p13114</guid>
		</item>
		<item>
			<title><![CDATA[Re: LinuxHidStream GetFeature buffer offset]]></title>
			<link>https://swforum.seekye.com/post/13113/#p13113</link>
			<description><![CDATA[<p>I have amended the fixed block from the LinuxHidStream.GetFeature from:<br /></p><div class="codebox"><pre><code>buffer[offset + 1] = reportID;
int bytes = NativeMethods.ioctl(_handle, NativeMethods.HIDIOCGFEATURE(count - 1), (IntPtr)(ptr + offset + 1));
if (bytes &lt; 0) { throw new IOException(&quot;GetFeature failed.&quot;); }
Array.Clear(buffer, 1 + bytes, count - (1 + bytes));</code></pre></div><p>to<br /></p><div class="codebox"><pre><code>int bytes = NativeMethods.ioctl(_handle, NativeMethods.HIDIOCGFEATURE(count), (IntPtr)(ptr + offset));
if (bytes &lt; 0) { throw new IOException(&quot;GetFeature failed.&quot;); }
if(buffer.Length &lt; offset + bytes)
    Array.Clear(buffer, offset + bytes, buffer.Length - offset - bytes);</code></pre></div><p>I am not sure why the whole operation was shifted by one in the first place, but reading over the original buffer, without an offset of 1, seems to work for my use case.</p>]]></description>
			<author><![CDATA[null@example.com (itamaram)]]></author>
			<pubDate>Sat, 08 Feb 2020 19:46:03 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/13113/#p13113</guid>
		</item>
		<item>
			<title><![CDATA[LinuxHidStream GetFeature buffer offset]]></title>
			<link>https://swforum.seekye.com/post/13112/#p13112</link>
			<description><![CDATA[<p>I am trying to use HidSharp on Ubuntu 18.04 to interface with a blink(1) mk2 device.</p><p>SetFeature works great, but I seem to be running into an issue with GetFeature, which I believe to be with the library.</p><p>Whenever I try to read data from the device, all bytes after the report id appears to be shifted by one.</p><p>eg, reading the color back from the device, I expect back the following sequence:</p><div class="codebox"><pre><code>ReportId, &#039;r&#039;, R, G, B, 0, 0, 0</code></pre></div><p>But instead I get <br /></p><div class="codebox"><pre><code>ReportId, 0, &#039;r&#039;, R, G, B, 0, 0</code></pre></div><p>Other reads are similarly suffering from an added zero byte after the report id.</p><p>Looking at the source for the LinuxHidStream class, in the GetFeature method, the call to ioctl passes numPtr + offset + 1 as the value argument. While I admit to not fully understand that low level call, I was wondering if perhaps that value should not have one added to it, as this amendment might already be taken into account by the system call.</p><p>Is anyone else experiencing a similar issue? Or is it just me?</p><p>My next step is to remove the NuGet reference, clone the source, make the change, and see if it solves the problem. I&#039;ll report back with my findings.</p>]]></description>
			<author><![CDATA[null@example.com (itamaram)]]></author>
			<pubDate>Sat, 08 Feb 2020 10:30:41 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/13112/#p13112</guid>
		</item>
	</channel>
</rss>
