<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[James's Programming Page — DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
	<link rel="self" href="https://swforum.seekye.com/feed/atom/topic/10120/" />
	<updated>2019-07-20T21:20:20Z</updated>
	<generator>PunBB</generator>
	<id>https://swforum.seekye.com/topic/10120/</id>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13078/#p13078" />
			<content type="html"><![CDATA[<p>Try this:<br /><a href="https://www.zer7.com/files/oss/hidsharp/HIDSharp_test_2019-07-20.zip">https://www.zer7.com/files/oss/hidsharp … -07-20.zip</a></p>]]></content>
			<author>
				<name><![CDATA[Zer]]></name>
				<uri>https://swforum.seekye.com/user/2/</uri>
			</author>
			<updated>2019-07-20T21:20:20Z</updated>
			<id>https://swforum.seekye.com/post/13078/#p13078</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13077/#p13077" />
			<content type="html"><![CDATA[<p>Just on the possibility that this is Platform Invoke related, would you mind trying:</p><p>In Platform\Linux\NativeMethods.cs</p><p>change</p><p>public static extern int poll(pollfd[] fds, IntPtr nfds, int timeout);</p><p>to</p><p>public static extern int poll([In][Out] pollfd[] fds, IntPtr nfds, int timeout);</p>]]></content>
			<author>
				<name><![CDATA[Zer]]></name>
				<uri>https://swforum.seekye.com/user/2/</uri>
			</author>
			<updated>2019-07-15T14:34:36Z</updated>
			<id>https://swforum.seekye.com/post/13077/#p13077</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13076/#p13076" />
			<content type="html"><![CDATA[<p>`fds[0].revents` is always 0</p><p>So far I have only tested on x64, can try on ARM later.</p>]]></content>
			<author>
				<name><![CDATA[timothyp]]></name>
				<uri>https://swforum.seekye.com/user/14241/</uri>
			</author>
			<updated>2019-07-15T02:48:23Z</updated>
			<id>https://swforum.seekye.com/post/13076/#p13076</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13075/#p13075" />
			<content type="html"><![CDATA[<p>Hmm. I am not encountering this problem on Linux Mint 19. (Are you running 32 or 64-bit? Which architecture?)</p><p>&quot;if (0 != (fds[0].revents &amp; NativeMethods.pollev.IN))&quot; runs in an endless loop? What is the value of fds[0].revents? Thanks!</p>]]></content>
			<author>
				<name><![CDATA[Zer]]></name>
				<uri>https://swforum.seekye.com/user/2/</uri>
			</author>
			<updated>2019-07-13T13:52:57Z</updated>
			<id>https://swforum.seekye.com/post/13075/#p13075</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13074/#p13074" />
			<content type="html"><![CDATA[<p>So in my case revents always equals 0 in this check:</p><p>`if (0 != (fds[0].revents &amp; NativeMethods.pollev.IN))`</p><p>And if I remove this check, all is fine.</p><p>Also note that once a device is connected this code is executed in an endless loop,</p>]]></content>
			<author>
				<name><![CDATA[timothyp]]></name>
				<uri>https://swforum.seekye.com/user/14241/</uri>
			</author>
			<updated>2019-07-12T02:56:47Z</updated>
			<id>https://swforum.seekye.com/post/13074/#p13074</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13073/#p13073" />
			<content type="html"><![CDATA[<p>Sorry to get back to this so late.<br />Was using my version so forgot about the issue.<br />Now I switched back to your latest version (since you solved some other issues)<br />and found that this issue still exists.</p>]]></content>
			<author>
				<name><![CDATA[timothyp]]></name>
				<uri>https://swforum.seekye.com/user/14241/</uri>
			</author>
			<updated>2019-07-12T02:46:31Z</updated>
			<id>https://swforum.seekye.com/post/13073/#p13073</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13044/#p13044" />
			<content type="html"><![CDATA[<p>Very odd. What is revents returning for you, then?<br />Also, is it blocking in poll in your version, or blocking in udev_monitor_receive_device? Thanks!</p>]]></content>
			<author>
				<name><![CDATA[Zer]]></name>
				<uri>https://swforum.seekye.com/user/2/</uri>
			</author>
			<updated>2019-03-22T16:33:06Z</updated>
			<id>https://swforum.seekye.com/post/13044/#p13044</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[DeviceList.Local.Changed not triggered on Linux without modifications]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13043/#p13043" />
			<content type="html"><![CDATA[<p>Without modification `DeviceList.Local.Changed` does not get triggered on Ubuntu 18.04</p><p>Filename: `LinuxHidManager.cs`<br />Line: ~69</p><p>This is the code in the current version</p><div class="codebox"><pre><code>if (0 != (fds[0].revents &amp; (NativeMethods.pollev.ERR | NativeMethods.pollev.HUP | NativeMethods.pollev.NVAL))) { break; }                       
if (0 != (fds[0].revents &amp; NativeMethods.pollev.IN))
{                                
    IntPtr device = NativeMethodsLibudev.Instance.udev_monitor_receive_device(monitor);
    if (device != null)
    {                                    
        NativeMethodsLibudev.Instance.udev_device_unref(device);
        DeviceList.Local.RaiseChanged();
    }
}</code></pre></div><p>The following line never returns true:</p><div class="codebox"><pre><code>if (0 != (fds[0].revents &amp; NativeMethods.pollev.IN))</code></pre></div><p>However, if I disable this check I get proper change notification and no exceptions.<br />Basically, the following version works:</p><div class="codebox"><pre><code>if (ret == 1)
{

    if (0 != (fds[0].revents &amp; (NativeMethods.pollev.ERR | NativeMethods.pollev.HUP | NativeMethods.pollev.NVAL))) { break; }                       

                                   
   IntPtr device = NativeMethodsLibudev.Instance.udev_monitor_receive_device(monitor);
    if (device != null)
    {                                    
        NativeMethodsLibudev.Instance.udev_device_unref(device);
        DeviceList.Local.RaiseChanged();
    }
   
}</code></pre></div><br /><p>Do you see any issue with this? </p><p>PS: Again, it would be really great if you had an official git repo for this, it is such a useful project.</p>]]></content>
			<author>
				<name><![CDATA[timothyp]]></name>
				<uri>https://swforum.seekye.com/user/14241/</uri>
			</author>
			<updated>2019-03-19T02:15:53Z</updated>
			<id>https://swforum.seekye.com/post/13043/#p13043</id>
		</entry>
</feed>
