From 65324dec076d1f4947fbd0a61d1d3e48b67260c5 Mon Sep 17 00:00:00 2001 From: Mike Kuznetsov Date: Mon, 23 Mar 2020 14:01:22 -0500 Subject: [PATCH] Removed Kernel32 library use. "As Tested" on-site and "approved" version. --- bin/purejavahidapi-src.jar | Bin 73551 -> 73505 bytes bin/purejavahidapi.jar | Bin 131902 -> 131803 bytes src/purejavahidapi/windows/HidDevice.java | 70 ++++++++++++---------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/bin/purejavahidapi-src.jar b/bin/purejavahidapi-src.jar index 6be2c2fe8658db39151684c5a50f519007d405f4..597d3e01072baf874aaaab745c047722dd4d31f7 100644 GIT binary patch delta 3734 zcmV;H4r%evz67DZ1P)M30|W{H00;m8Hd{SVkq##WHCsJUu{nSN1p8V&P_w-Okj)PJ zT0Kw(MH*~pR>&^S|> zDHReei3|b?kUdVy|Gww+1sa5G*^|xgi;d{hr_cS?^iJNsAtz)ICl6_`-sD7EcF4Qa zv!8VG%Pz}3kBlESakwQt;v`;5-C#>c-XdeWj4&i@S4L8r(e#e`U0h&`HZApoEKh^Q zE)U{}c#%(b86`nPvUry+DSNXBA}@U)t2o_eI=K(>4T)3sKi=h&HqbKy^8u4<&?|q} z2!bP*p$Fni56LJ);V2T3gaDiV4v2e>7KRe(c>yg%@aV_O-IhkVCzaI$J;bn*GOSxK zr)l7YSt)a-EVfl)p=51L1KiCZB5zBPCVZ}16&zAAE8wTx!W0waoG;*qpAx4Tkn=zm z6zvH(iwTW+ z78Y?^%d!e*?zQC*XL9M@8n#K`d1_DITSIe5`X6A?B!kKHgKb@1yX1N@8k)94jPVfO zj$Pa8&)f;TXd4dfY;!MyMPvMdn7>YK({aeeCf3b#WC21r!8XROWjZ>s#)E&+Y-o+I zbOK1oc;b?gbz`{z=1z2Wu-L}1mRrf>lH8c~;2M4!eQRX7AK00fmOIAtF5y6fOby$$ z2D6c2lj+Q!P8^dUdqc|^j123>95Mj_6>u^!-E#)W|XNP~o?40$<<^sWP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Oj7Ctqt1VI=1wOWG88^s1VeX>PnXdW0XGCfcZ^TB3=;v30R+f)j8C_n6ajJw4#;+l zPZCfIi8c-Z03R}!9UTE<0lb%i9RXGXi{q1#_ZgS+9RWE4#qN`l_ZgGS?i81;8vzWL nW*z|^0;Bhnk@qc^ts4Ohm%knX9s&mjm){-%JO=L)0RR91be0=u diff --git a/bin/purejavahidapi.jar b/bin/purejavahidapi.jar index 8cc869e3f95c6946517f8979f9578b17053d6163..c93572b433a84dc718713df37cc4db687776c70a 100644 GIT binary patch delta 4689 zcmY+Hc|26#`@mgOF_b0B5;Gx#kv;pasO(}w)~t!_I~io(v&^-xp|WJ(N+P?+5|SaZ zXV2KT-!%EXKCkcn)_h69aZVWj z4G^yu2T~B{{<_)`1keXi|NXVE9rq%mAR_976A>Z60egTE^cMx7XkK%>$1X0_`cOlI z-RGw#{hK#7NtNg&m9GcTOI{D!d?^NPwXbKI?UVyT&9HGK-u`w=_meU|sk{7Kt+DDU z#nd>(=8s)ncf12cHP&tvq# z@BGo9M2;lVg;PRgGU%cy7c#$A5(wY^hL-PS=)z_N9s8aZ-{n04E73C4(oqloU6)_5vx#gBQ8$rsU2~&8;cw?D`S(!6Opl4a!E}NjTS@Ips-fsEDtT)rpSP ziK_c?J=H$>dGu1VsPE#Z(eoQ7T{uz8855OF(FeXN5lu^S3dOd|cp7ukldv6t^j6F5dn6DP}0K z16zD<&}MvIV*2c#I0F_%mRQP!*=>1_EV%lEd=#S1jVy_~N->8lkWu8K^aR7GAcOSn z4Me*{Rk(HoH9MB^zU9!t{bx#PF^bhX#g-ygcM>X7FwSo|ny~Q>mku$xxTE z(yNU|FYOh~Em%{YbXi1W5<*7eBW&j_1T&}v4|kz2Cvy(44-nHpIcBs?5VQT{s4qv7)qScTlNGV}pZ|Mn|=d@&ft(!P+t`tZH}H!-M*f2+?Sc zCGH^Uk}7&XWH?c>FWK8lj9Ex+;(B6~;9z&F-giA0lKH-V*GHrD0kW(scHy?|Ix6;2 zOBh7^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_v?gSu8oafB_71RK{Wk8}(}TckQUagf9wzyq;tliDf~b1dAq z0Tg&6{;z;Rv)iN^Y7&nKFQl>qTn29@9gCDB5tn={mUc*2;SK&+WZ+4?W;r1B5xq;w zbUx)6=j;M9fEXmcN9y3-E-9>a+L2)jx~Cs6DA^;ytc)YUgWo5$!7%I3Gla+@b?{F> z|9#TE^o0`lN!#*rj@<`20Ns%*1h(fMlk8klZc=MWZ9jTn`GWtsO$i0Zt6m+DUO?*U zv7mnn(EPtG5{IP1ZHtaQ_e0<+-~?430_Gq`$sd+13?c!~WE;>FOe{Sn-#|H#z5M8z z8@ddD;^0E{k>G$90FVZX13*<^1nL7oGf=(d$bdtvEx?82OM4dtxxm)fe=!Vt1%k{J LHf^LYS7iSISO)6A diff --git a/src/purejavahidapi/windows/HidDevice.java b/src/purejavahidapi/windows/HidDevice.java index b4a7bae..a527c65 100644 --- a/src/purejavahidapi/windows/HidDevice.java +++ b/src/purejavahidapi/windows/HidDevice.java @@ -48,7 +48,6 @@ import com.sun.jna.NativeLong; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.WinBase.*; import com.sun.jna.platform.win32.WinNT.HANDLE; @@ -92,13 +91,13 @@ public class HidDevice extends purejavahidapi.HidDevice { HIDP_PREPARSED_DATA[] ppd = new HIDP_PREPARSED_DATA[1]; res = HidD_GetPreparsedData(handle, ppd); if (!res) { - Kernel32.INSTANCE.CloseHandle(handle); + CloseHandle(handle); return; } HIDP_CAPS caps = new HIDP_CAPS(); int nt_res = HidP_GetCaps(ppd[0], caps); if (nt_res != HIDP_STATUS_SUCCESS) { - Kernel32.INSTANCE.CloseHandle(handle); + CloseHandle(handle); return; } m_OutputReportLength = caps.OutputReportByteLength; @@ -137,7 +136,7 @@ public void run() { m_ForceControlOutput = System.getProperty("purejavahidapi.forceControlOutput") != null; // bManualReset parameter has to be set to true to work with WaitForSingleObject - m_OutputReportOverlapped.hEvent = Kernel32.INSTANCE.CreateEvent(null, true, false, null); + m_OutputReportOverlapped.hEvent = CreateEvent(null, true, false, null); } @Override @@ -151,8 +150,8 @@ synchronized public void close() { m_Thread.interrupt(); m_SyncShutdown.waitAndSync(); } - Kernel32.INSTANCE.CloseHandle(m_OutputReportOverlapped.hEvent); - Kernel32.INSTANCE.CloseHandle(m_Handle); + CloseHandle(m_OutputReportOverlapped.hEvent); + CloseHandle(m_Handle); m_Backend.removeDevice(m_HidDeviceInfo.getDeviceId()); m_Open = false; } @@ -165,13 +164,13 @@ synchronized public int setOutputReport(byte reportID, byte[] data, int length) throw new IllegalArgumentException("this device supports no output reports"); // In Windows writeFile() to HID device data has to be preceded with the report // number, regardless - Arrays.fill(m_OutputReportArray, (byte)0); - m_OutputReportArray[0] = reportID; - System.arraycopy(data, 0, m_OutputReportArray, 1, length); - + m_OutputReportMemory.write(0, new byte[] { + reportID + }, 0, 1); + m_OutputReportMemory.write(1, data, 0, length); if (!m_ForceControlOutput) { - Kernel32.INSTANCE.ResetEvent(m_OutputReportOverlapped.hEvent); + ResetEvent(m_OutputReportOverlapped.hEvent); m_OutputReportOverlapped.Internal = null; m_OutputReportOverlapped.InternalHigh = null; m_OutputReportOverlapped.Offset = 0; @@ -179,16 +178,23 @@ synchronized public int setOutputReport(byte reportID, byte[] data, int length) // In windows always attempt to write as many bytes as there are in the longest // report plus one for the report number (even if zero ie not used) - if (!Kernel32.INSTANCE.WriteFile(m_Handle, m_OutputReportArray, m_OutputReportLength, null, m_OutputReportOverlapped)) { - if (Kernel32.INSTANCE.GetLastError() != ERROR_IO_PENDING) { + if (!WriteFile(m_Handle, m_OutputReportMemory, m_OutputReportLength, null, m_OutputReportOverlapped)) { + if (GetLastError() != ERROR_IO_PENDING) { // WriteFile() failed. Return error. // register_error(dev, "WriteFile"); + System.err.println("WriteFile failed with GetLastError()==" + GetLastError()); return -1; } } - if (WAIT_OBJECT_0 != Kernel32.INSTANCE.WaitForSingleObject(m_OutputReportOverlapped.hEvent, 1000)) { - return -2; + if (WAIT_OBJECT_0 != WaitForSingleObject(m_OutputReportOverlapped.hEvent, 1000)) { + // This could be an overkill and not needed. When there is a chance need to be tested without this block + m_OutputReportOverlapped.read(); + + if (WAIT_OBJECT_0 != WaitForSingleObject(m_OutputReportOverlapped.hEvent, 1000)) { + System.err.println("WaitForSingleObject failed with GetLastError()==" + GetLastError()); + return -2; + } } // Update structure from native code @@ -197,16 +203,12 @@ synchronized public int setOutputReport(byte reportID, byte[] data, int length) if (!GetOverlappedResult(m_Handle, m_OutputReportOverlapped, m_OutputReportBytesWritten, false/* don't need to wait */)) { // The Write operation failed. // register_error(dev, "WriteFile"); + System.err.println("GetOverlappedResult failed with GetLastError()==" + GetLastError()); return -3; } return m_OutputReportBytesWritten[0] - 1; } else { - m_OutputReportMemory.write(0, new byte[] { - reportID - }, 0, 1); - m_OutputReportMemory.write(1, data, 0, length); - if (!HidD_SetOutputReport(m_Handle, m_OutputReportMemory.getByteArray(0, length + 1), length + 1)) { // HidD_SetOutputReport() failed. Return error. // register_error(dev, "HidD_SetOutputReport"); @@ -257,7 +259,7 @@ synchronized public int getFeatureReport(byte[] data, int length) { Pointer buffer = new Memory(data.length); if (!DeviceIoControl(m_Handle, IOCTL_HID_GET_FEATURE, buffer, length, buffer, length, bytes, ol)) { // System.out.println(GetLastError()); - if (Kernel32.INSTANCE.GetLastError() != ERROR_IO_PENDING) + if (GetLastError() != ERROR_IO_PENDING) return -1; } @@ -274,11 +276,11 @@ private void runReadOnBackground() { int[] numBytesRead = { 0 }; OVERLAPPED overlapped = new OVERLAPPED(); - overlapped.hEvent = Kernel32.INSTANCE.CreateEvent(null, true, true, null); + overlapped.hEvent = CreateEvent(null, true, true, null); Memory readBuffer = new Memory(m_InputReportLength); while (!m_StopThread) { - Kernel32.INSTANCE.ResetEvent(overlapped.hEvent); + ResetEvent(overlapped.hEvent); numBytesRead[0] = 0; overlapped.Internal = null; overlapped.InternalHigh = null; @@ -291,33 +293,35 @@ private void runReadOnBackground() { // is always preceded with the report number (even if not used in // case of which it is zero) if (!ReadFile(m_Handle, readBuffer, m_InputReportLength, numBytesRead, overlapped)) { - if (Kernel32.INSTANCE.GetLastError() == ERROR_DEVICE_NOT_CONNECTED) + if (GetLastError() == ERROR_DEVICE_NOT_CONNECTED) break; // early exit if the device disappears - if (Kernel32.INSTANCE.GetLastError() != ERROR_IO_PENDING) { + if (GetLastError() != ERROR_IO_PENDING) { CancelIo(m_Handle); - System.err.println("ReadFile failed with GetLastError()==" + Kernel32.INSTANCE.GetLastError()); + System.err.println("ReadFile failed with GetLastError()==" + GetLastError()); + //Log("runReadOnBackground ReadFile error"); } if (WAIT_OBJECT_0 != WaitForSingleObject(overlapped.hEvent, INFINITE)) { - System.err.println("WaitForSingleObject failed with GetLastError()==" + Kernel32.INSTANCE.GetLastError()); + System.err.println("WaitForSingleObject failed with GetLastError()==" + GetLastError()); + //Log("runReadOnBackground WaitForSingleObject error"); } // Update structure from native code overlapped.read(); if (!GetOverlappedResult(m_Handle, overlapped, numBytesRead, false/* don't need to wait */)) { - if (Kernel32.INSTANCE.GetLastError() == ERROR_DEVICE_NOT_CONNECTED) + if (GetLastError() == ERROR_DEVICE_NOT_CONNECTED) break; // early exit if the device disappears - if (m_StopThread && Kernel32.INSTANCE.GetLastError() == ERROR_OPERATION_ABORTED) + if (m_StopThread && GetLastError() == ERROR_OPERATION_ABORTED) break; // on close - System.err.println("GetOverlappedResult failed with GetLastError()==" + Kernel32.INSTANCE.GetLastError()); + System.err.println("GetOverlappedResult failed with GetLastError()==" + GetLastError()); } } processInputReport(readBuffer, numBytesRead[0]); } - Kernel32.INSTANCE.CloseHandle(overlapped.hEvent); + CloseHandle(overlapped.hEvent); m_SyncShutdown.waitAndSync(); } @@ -327,10 +331,14 @@ private void processInputReport(Memory readBuffer, int numBytesRead) { int len = numBytesRead - 1; byte[] inputReport = new byte[len]; readBuffer.read(1, inputReport, 0, len); + //Log("HB: " + inputReport[1]); if (m_InputReportListener != null) { m_InputReportListener.onInputReport(this, reportID, inputReport, len); } } + else { + //Log("processInputReport error 1"); + } } private void Log(String sMessage) {