Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Added helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Sep 3, 2015
1 parent 70f3e52 commit 0bf1714
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions ScpControl/Driver/LibusbKWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ private LibusbKWrapper()

public bool SetPowerPolicyAutoSuspend(IntPtr handle, bool on = true)
{
var value = Marshal.AllocHGlobal(Marshal.SizeOf(typeof (byte)));
var value = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)));

try
{
Marshal.WriteByte(value, (byte) ((on) ? 0x01 : 0x00));
Marshal.WriteByte(value, (byte)((on) ? 0x01 : 0x00));

return SetPowerPolicy(handle, UsbKPowerPolicy.AutoSuspend,
(uint) Marshal.SizeOf(typeof (byte)), value);
(uint)Marshal.SizeOf(typeof(byte)), value);
}
finally
{
Expand Down Expand Up @@ -145,6 +145,20 @@ public bool OverlappedReUse(KOVL_HANDLE OverlappedK)
return OvlK_ReUse(OverlappedK);
}

public bool GetPipePolicy(KUSB_HANDLE InterfaceHandle, byte PipeID,
[MarshalAs(UnmanagedType.U4)] UsbKPipePolicy PolicyType,
ref UInt32 ValueLength, IntPtr Value)
{
return UsbK_GetPipePolicy(InterfaceHandle, PipeID, PolicyType, ref ValueLength, Value);
}

public bool SetPipePolicy(KUSB_HANDLE InterfaceHandle, byte PipeID,
[MarshalAs(UnmanagedType.U4)] UsbKPipePolicy PolicyType,
UInt32 ValueLength, IntPtr Value)
{
return UsbK_SetPipePolicy(InterfaceHandle, PipeID, PolicyType, ValueLength, Value);
}

#region Private wrapper methods

private bool GetPowerPolicy(KUSB_HANDLE InterfaceHandle, UsbKPowerPolicy PolicyType, ref uint ValueLength,
Expand Down

0 comments on commit 0bf1714

Please sign in to comment.