-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsbSwitch.cs
More file actions
63 lines (52 loc) · 1.96 KB
/
Copy pathUsbSwitch.cs
File metadata and controls
63 lines (52 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
namespace NvkCommon
{
public abstract class UsbSwitch
{
public abstract String Filter { get; }
public abstract void SwitchDeviceRemoteToLocal(string devicePath);
public abstract void SwitchDeviceLocalToRemote(string devicePath);
}
/// <summary>
/// https://iogear.com/products/gub231
/// Commands were found by using Wireshark USB sniffer to monitor USB commands
/// of their shitty Windows sharing app (available at the above website).
/// </summary>
public class IoGearGub231UsbSwitch : UsbSwitch
{
public const string FILTER = "vid_0557&pid_2405";
public override string Filter => FILTER;
public override void SwitchDeviceRemoteToLocal(string devicePath)
{
byte[] buffer = [0x02, 0x11];
UsbManager.WriteDeviceData(devicePath, buffer);
}
public override void SwitchDeviceLocalToRemote(string devicePath)
{
byte[] buffer = [0x01, 0x11];
UsbManager.WriteDeviceData(devicePath, buffer);
}
}
/// <summary>
/// Commands were found by using Wireshark USB sniffer to monitor USB commands.
/// The ActionStar usbshare.exe app was very similar to the IoGear USB sharing app.
/// </summary>
class ActionStarUnknownUsbSwitch : UsbSwitch
{
public const string FILTER = "vid_2101&pid_0201";
public override string Filter => FILTER;
/// <summary>
/// The ActionStar usbshare.exe app writes [0x00, 0x02, 0x00] to the switch
/// </summary>
/// <param name="devicePath"></param>
public override void SwitchDeviceRemoteToLocal(string devicePath)
{
byte[] buffer = new byte[] { 0x00, 0x02, 0x00 };
UsbManager.WriteDeviceData(devicePath, buffer);
}
public override void SwitchDeviceLocalToRemote(string devicePath)
{
throw new NotImplementedException();
}
}
}