<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[James's Programming Page — Unable to open HID class device (OK) exception while open on Linux]]></title>
	<link rel="self" href="https://swforum.seekye.com/feed/atom/topic/10146/" />
	<updated>2021-03-28T14:03:56Z</updated>
	<generator>PunBB</generator>
	<id>https://swforum.seekye.com/topic/10146/</id>
		<entry>
			<title type="html"><![CDATA[Re: Unable to open HID class device (OK) exception while open on Linux]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13127/#p13127" />
			<content type="html"><![CDATA[<p>Having exactly the same error running on Ubuntu 20.10 arm64</p><p>Here&#039;s the stack trace:<br /></p><div class="codebox"><pre><code>at HidSharp.Platform.Linux.LinuxHidStream.DeviceHandleFromPath(String path, HidDevice hidDevice, oflag oflag)
   at HidSharp.Platform.Linux.LinuxHidDevice.TryParseReportDescriptor(ReportDescriptor&amp; parser, Byte[]&amp; reportDescriptor)
   at HidSharp.Platform.Linux.LinuxHidDevice.RequiresGetInfo()
   at HidSharp.Platform.Linux.LinuxHidDevice.OpenDeviceDirectly(OpenConfiguration openConfig)
   at HidSharp.Device.OpenDeviceAndRestrictAccess(OpenConfiguration openConfig)
   at HidSharp.Device.Open(OpenConfiguration openConfig)
   at HidSharp.Device.Open()
   at HidSharp.HidDevice.Open()</code></pre></div>]]></content>
			<author>
				<name><![CDATA[animaonline]]></name>
				<uri>https://swforum.seekye.com/user/14350/</uri>
			</author>
			<updated>2021-03-28T14:03:56Z</updated>
			<id>https://swforum.seekye.com/post/13127/#p13127</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Unable to open HID class device (OK) exception while open on Linux]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13126/#p13126" />
			<content type="html"><![CDATA[<p>Naive idea. Have you tried changing your if to check the out parameter (device dev) rather than the return vale of try open? Without a specific stack trace its hard to say what your problem is here. The fact this works on Windows suggests that its an issue with linuxsupport or a config or permission issue, maybe another library or process interfering.</p><p><a href="https://github.com/OpenTabletDriver/OpenTabletDriver/issues/452">https://github.com/OpenTabletDriver/Ope … issues/452</a></p><p>Check that link for a potential solution.</p>]]></content>
			<author>
				<name><![CDATA[Catbert]]></name>
				<uri>https://swforum.seekye.com/user/30/</uri>
			</author>
			<updated>2021-03-11T17:24:38Z</updated>
			<id>https://swforum.seekye.com/post/13126/#p13126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Unable to open HID class device (OK) exception while open on Linux]]></title>
			<link rel="alternate" href="https://swforum.seekye.com/post/13125/#p13125" />
			<content type="html"><![CDATA[<p>I have an issue on Linux. When I call Open method it throws &quot;Unable to open HID class device (OK)&quot;. But when I check CanOpen, it is true but cannot open. I also use TryOpen method&nbsp; but it didnt work. On windows side it works without any issue. I use HidSharpCore 1.2.1.1 at .net 5.0.&nbsp; </p><p>Please help me to solve this issue.<br /></p><div class="codebox"><pre><code>private static object lo = new object();
        public byte[] WriteAndWaitResponse(byte[] data)
        {

            lock (lo)
            {
                byte[] result;
                Console.WriteLine(&quot;vid:&quot; + vendorId + &quot; pid:&quot; + productId);

                if (!DeviceList.Local.TryGetHidDevice(out Dev, vendorId, productId))
                {
                    Console.WriteLine(&quot;Cannot GetHidDevice&quot;);
                    return null;
                }

                HidStream stream = null;
                if (Dev.CanOpen)
                {
                    
                    try
                    {
                        OpenConfiguration configuration = new OpenConfiguration();
                        stream = Dev.Open();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    if(stream == null)
                    {
                        Console.WriteLine(&quot;Try Open failed&quot;);
                    }
                }
                else
                {
                    Console.WriteLine(&quot;Cannot Open&quot;);
                }

                try
                {
                    stream.Write(data);
                    Console.WriteLine(&quot;data:&quot; + data.Length);
                    Thread.Sleep(100);
                    result = stream.Read();
                    Console.WriteLine(&quot;result:&quot; + result.Length);

                    return result;
                }
                catch (Exception ex)
                {

                    throw new RealDeviceException(&quot;error while writing to USB&quot;, ex);
                }
            }
        }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[azrael_yavuz]]></name>
				<uri>https://swforum.seekye.com/user/14348/</uri>
			</author>
			<updated>2021-03-05T13:08:59Z</updated>
			<id>https://swforum.seekye.com/post/13125/#p13125</id>
		</entry>
</feed>
