├── .gitignore
├── .gitmodules
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── Build
├── Module.xml
└── Projects
│ ├── Common.definition
│ ├── DeviceInterface.definition
│ ├── FormApp.definition
│ ├── LibUsbDotNet.definition
│ ├── LinFormReferences.definition
│ ├── MatlabFileIO.definition
│ ├── Mono.Zeroconf.definition
│ ├── MonoPlatformSpecific.definition
│ ├── SmartScopeConsole.definition
│ ├── SmartScopeServer.definition
│ ├── SmartScopeServerUI.definition
│ ├── WinFormReferences.definition
│ └── WinUSB.definition
├── Mono.Zeroconf.Providers.Bonjour.dll.config
├── Protobuild.exe
├── README.md
├── blobs
├── SmartScopeHackerSpecial.bin
├── SmartScope_A10.bin
├── SmartScope_A12.bin
├── SmartScope_A14.bin
├── SmartScope_A15.bin
├── SmartScope_A16.bin
├── SmartScope_A17.bin
├── SmartScope_A18.bin
└── i2c_sequence.mat
├── bootstrap.sh
├── driver
├── .gitignore
├── install_smartscope_driver.bat
└── wdi-simple.exe
├── examples
├── MakerKit
│ ├── Info.plist
│ ├── MainActivity.cs
│ ├── MakerKitApp.cs
│ ├── MakerKitForm.Designer.cs
│ ├── MakerKitForm.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AndroidManifest.xml
│ │ └── AssemblyInfo.cs
│ ├── Resources.cs
│ ├── Resources
│ │ ├── drawable-hdpi
│ │ │ └── icon.png
│ │ ├── drawable-xhdpi
│ │ │ └── icon.png
│ │ ├── drawable-xxhdpi
│ │ │ └── icon.png
│ │ ├── drawable
│ │ │ └── icon.png
│ │ └── labnation-logo.png
│ ├── YamlHelper.cs
│ ├── packages.Android.config
│ └── packages.config
├── SmartScopeConsole
│ ├── Info.plist
│ ├── Info.plist.tpl
│ ├── Main.cs
│ └── README.md
├── SmartScopeServer
│ ├── .gitignore
│ ├── Info.plist
│ ├── Info.plist.tpl
│ └── Program.cs
└── SmartScopeServerUI
│ ├── .gitignore
│ ├── AppDelegate.cs
│ ├── AppDelegate.designer.cs
│ ├── Info.plist.tpl
│ ├── MacMenu.xib
│ ├── MacWindow.cs
│ ├── MacWindow.designer.cs
│ ├── MacWindow.xib
│ ├── MacWindowController.cs
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── ServerTable.cs
│ ├── smartscopeserver.icns
│ └── smartscopeserver.ico
├── libs
├── LibUsbDotNet
│ ├── .gitignore
│ ├── Descriptors
│ │ ├── ClassCodeType.cs
│ │ ├── DescriptorType.cs
│ │ ├── LangStringDescriptor.cs
│ │ ├── StringDescriptor.cs
│ │ ├── UsbConfigDescriptor.cs
│ │ ├── UsbDescriptor.cs
│ │ ├── UsbDeviceDescriptor.cs
│ │ ├── UsbEndpointDescriptor.cs
│ │ └── UsbInterfaceDescriptor.cs
│ ├── DeviceNotify
│ │ ├── DeviceNotifier.cs
│ │ ├── DeviceNotifyEventArgs.cs
│ │ ├── DeviceType.cs
│ │ ├── EventType.cs
│ │ ├── IDeviceNotifier.cs
│ │ ├── Info
│ │ │ ├── IPortNotifyInfo.cs
│ │ │ ├── IUsbDeviceNotifyInfo.cs
│ │ │ ├── IVolumeNotifyInfo.cs
│ │ │ ├── PortNotifyInfo.cs
│ │ │ ├── UsbDeviceNotifyInfo.cs
│ │ │ └── VolumeNotifyInfo.cs
│ │ ├── Internal
│ │ │ ├── DevBroadcastDeviceinterface.cs
│ │ │ ├── DevBroadcastHdr.cs
│ │ │ ├── DevBroadcastPort.cs
│ │ │ ├── DevBroadcastVolume.cs
│ │ │ ├── DevNotifyNativeWindow.cs
│ │ │ └── SafeNotifyHandle.cs
│ │ ├── Linux
│ │ │ ├── LinuxDevItem.cs
│ │ │ ├── LinuxDevItemList.cs
│ │ │ ├── LinuxDeviceNotifier.DevMonitor.cs
│ │ │ ├── LinuxDeviceNotifier.DeviceListPolling.cs
│ │ │ ├── LinuxDeviceNotifier.cs
│ │ │ ├── LinuxDeviceNotifierMode.cs
│ │ │ ├── LinuxDeviceNotifyEventArgs.cs
│ │ │ └── LinuxUsbDeviceNotifyInfo.cs
│ │ ├── WindowsDeviceNotifier.cs
│ │ └── WindowsDeviceNotifyEventArgs.cs
│ ├── IUsbDevice.cs
│ ├── IUsbInterface.cs
│ ├── Info
│ │ ├── UsbBaseInfo.cs
│ │ ├── UsbConfigInfo.cs
│ │ ├── UsbDeviceInfo.cs
│ │ ├── UsbEndpointInfo.cs
│ │ └── UsbInterfaceInfo.cs
│ ├── Internal
│ │ ├── Kernel32.cs
│ │ ├── OverlappedTransferContext.cs
│ │ ├── SafeOverlapped.cs
│ │ ├── SetupApi.cs
│ │ ├── TransferContextBase.cs
│ │ ├── UsbApiBase.cs
│ │ └── UsbRegex
│ │ │ ├── BaseRegSymbolicName.cs
│ │ │ ├── NamedGroup.cs
│ │ │ ├── RegHardwareID.cs
│ │ │ └── RegSymbolicName.cs
│ ├── LibUsb
│ │ ├── Internal
│ │ │ ├── LibUsbAPI.cs
│ │ │ ├── LibUsbDriverIO.cs
│ │ │ ├── LibUsbDriverIO_IOControlMessage.cs
│ │ │ ├── LibUsbIoCtl.cs
│ │ │ └── LibUsbRequest.cs
│ │ ├── LibUsbDevice.cs
│ │ ├── LibUsbDeviceRegistryKeyRequest.cs
│ │ ├── LibUsbKernelType.cs
│ │ └── LibUsbRegistry.cs
│ ├── LibUsbDotNet.csproj
│ ├── LibUsbDotNet.dll.config
│ ├── Main
│ │ ├── ControlEpLockType.cs
│ │ ├── DataEpLockType.cs
│ │ ├── DataReceivedEnabledChangedEventArgs.cs
│ │ ├── DeviceLockType.cs
│ │ ├── DevicePropertyType.cs
│ │ ├── EndpointDataEventArgs.cs
│ │ ├── EndpointType.cs
│ │ ├── ErrorCode.cs
│ │ ├── Helper.cs
│ │ ├── LegacyUsbRegistry.cs
│ │ ├── ReadEndpointID.cs
│ │ ├── SPDRP.cs
│ │ ├── SafeContextHandle.cs
│ │ ├── SetupApiRegistry.cs
│ │ ├── UsbConstants.cs
│ │ ├── UsbCtrlFlags.cs
│ │ ├── UsbDeviceFinder.cs
│ │ ├── UsbEndpointBase.cs
│ │ ├── UsbEndpointDirection.cs
│ │ ├── UsbEndpointList.cs
│ │ ├── UsbException.cs
│ │ ├── UsbKernelVersion.cs
│ │ ├── UsbLockStyle.cs
│ │ ├── UsbRegDeviceList.cs
│ │ ├── UsbRegistry.cs
│ │ ├── UsbRequestRecipient.cs
│ │ ├── UsbRequestType.cs
│ │ ├── UsbSetupPacket.cs
│ │ ├── UsbStandardRequest.cs
│ │ ├── UsbStatusClodes.cs
│ │ ├── UsbStream.cs
│ │ ├── UsbSymbolicName.cs
│ │ ├── UsbTransfer.cs
│ │ └── WriteEndpointID.cs
│ ├── MonoLibUsb
│ │ ├── CallbackDelegates.cs
│ │ ├── Descriptors
│ │ │ ├── MonoUsbAltInterfaceDescriptor.cs
│ │ │ ├── MonoUsbConfigDescriptor.cs
│ │ │ ├── MonoUsbDeviceDescriptor.cs
│ │ │ ├── MonoUsbEndpointDescriptor.cs
│ │ │ └── MonoUsbInterface.cs
│ │ ├── MonoLibUsbApi.cs
│ │ ├── MonoUsbDevice.cs
│ │ ├── MonoUsbDeviceHandle.cs
│ │ ├── MonoUsbEndpointReader.cs
│ │ ├── MonoUsbEndpointWriter.cs
│ │ ├── MonoUsbError.cs
│ │ ├── MonoUsbEventHandler.cs
│ │ ├── MonoUsbSessionHandle.cs
│ │ ├── Profile
│ │ │ ├── AddRemoveEventArgs.cs
│ │ │ ├── AddRemoveType.cs
│ │ │ ├── MonoUsbConfigHandle.cs
│ │ │ ├── MonoUsbProfile.cs
│ │ │ ├── MonoUsbProfileHandle.cs
│ │ │ ├── MonoUsbProfileHandleEnumerator.cs
│ │ │ ├── MonoUsbProfileList.cs
│ │ │ ├── MonoUsbProfileListHandle.cs
│ │ │ └── PollfdItem.cs
│ │ ├── Transfer
│ │ │ ├── Internal
│ │ │ │ ├── libusb_control_setup.cs
│ │ │ │ ├── libusb_iso_packet_descriptor.cs
│ │ │ │ └── libusb_transfer.cs
│ │ │ ├── MonoUsbControlSetup.cs
│ │ │ ├── MonoUsbControlSetupHandle.cs
│ │ │ ├── MonoUsbIsoPacket.cs
│ │ │ ├── MonoUsbTansferStatus.cs
│ │ │ ├── MonoUsbTransfer.cs
│ │ │ ├── MonoUsbTransferContext.cs
│ │ │ └── MonoUsbTransferFlags.cs
│ │ └── UnixNativeTimeval.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UsbDevice.Common.cs
│ ├── UsbDevice.Error.cs
│ ├── UsbDevice.OS.Specific.cs
│ ├── UsbDevice.cs
│ ├── UsbEndpointReader.cs
│ ├── UsbEndpointWriter.cs
│ ├── UsbGlobals.cs
│ ├── WinUsb
│ │ ├── DeviceInformationTypes.cs
│ │ ├── DeviceSpeedTypes.cs
│ │ ├── Internal
│ │ │ ├── SafeWinUsbInterfaceHandle.cs
│ │ │ └── WinUsbAPI.cs
│ │ ├── PipeInformation.cs
│ │ ├── PipePolicies.cs
│ │ ├── PipePolicyType.cs
│ │ ├── PowerPolicies.cs
│ │ ├── PowerPolicyType.cs
│ │ ├── WinUsbDevice.cs
│ │ └── WinUsbRegistry.cs
│ └── libusb-1.0.0.dylib
├── common
│ ├── .gitignore
│ ├── FileLogger.cs
│ ├── LinqExtensions.cs
│ ├── Logger.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SerialNumber.cs
│ ├── Trendline.cs
│ └── Utils.cs
├── matlab
│ ├── .gitignore
│ ├── MatlabFileArrayWriter.cs
│ ├── MatlabFileHelper.cs
│ ├── MatlabFileReader.cs
│ ├── MatlabFileWriter.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
└── winusb
│ ├── .gitignore
│ ├── Changelog.md
│ ├── HelpProject
│ ├── WinUSBNet.shfbproj
│ └── cleanweb.bat
│ ├── README.md
│ ├── WinUSBNet
│ ├── API
│ │ ├── APIException.cs
│ │ ├── DeviceDetails.cs
│ │ ├── DeviceManagement.cs
│ │ ├── DeviceManagementAPI.cs
│ │ ├── FileAPI.cs
│ │ ├── WinUSBDevice.cs
│ │ └── WinUSBDeviceAPI.cs
│ ├── DeviceNotifyHook.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── USB.cs
│ ├── USBAsyncResult.cs
│ ├── USBDevice.cs
│ ├── USBDeviceDescriptor.cs
│ ├── USBDeviceInfo.cs
│ ├── USBException.cs
│ ├── USBInterface.cs
│ ├── USBInterfaceCollection.cs
│ ├── USBNotifier.cs
│ ├── USBPipe.cs
│ ├── USBPipeCollection.cs
│ ├── USBPipePolicy.cs
│ └── WinUSBNet.csproj
│ └── license.txt
├── packages.config
├── script
└── fetch_last_fpga_bitstreams.sh
└── src
├── DataSources
├── DataPackageScope.cs
└── DataSourceScope.cs
├── Devices
├── .gitignore
├── DeviceManager.cs
├── DummyScope.cs
├── DummyScopeFile.cs
├── DummyScopeWaves.cs
├── HackerSpecial.cs
├── IDevice.cs
├── IScope.cs
├── IWaveGenerator.cs
├── IWifiBridge.cs
├── ScopeChannel.cs
├── SmartScope.cs
├── SmartScopeAwg.cs
├── SmartScopeRom.cs
├── SmartScopeSettings.cs
└── WifiBridge.cs
├── Hardware
├── DummyInterface.cs
├── IHardwareInterface.cs
├── ISmartScopeHardwareUsb.cs
├── ISmartScopeInterface.cs
├── InterfaceManager.cs
├── InterfaceManagerApple.cs
├── InterfaceManagerLibUsb.cs
├── InterfaceManagerServiceDiscovery.cs
├── InterfaceManagerWinUsb.cs
├── InterfaceManagerXamarin.cs
├── InterfaceManagerZeroConf.cs
├── ScopeConstants_GEN.cs
├── ScopeConstants_GEN.tt
├── SmartScopeHardwareLibUsb.cs
├── SmartScopeHardwareWinUsb.cs
├── SmartScopeHardwareXamarin.cs
├── SmartScopeInterfaceEthernet.cs
└── SmartScopeInterfaceUsb.cs
├── Memories
├── ByteMemory.cs
├── ByteMemoryEnum.cs
├── DeviceMemory.cs
├── MAX19506Memory.cs
├── Registers
│ ├── BoolRegister.cs
│ ├── ByteRegister.cs
│ └── MemoryRegister.cs
├── ScopeFpgaI2cMemory.cs
├── ScopeFpgaRom.cs
├── ScopePicRegisterMemory.cs
└── ScopeStrobeMemory.cs
├── Net
├── Constants.cs
├── InterfaceServer.cs
└── Monitor.cs
├── Properties
└── AssemblyInfo.cs
├── Resources.cs
└── Tools.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | *bak
3 | obj/
4 | Release/
5 | *.suo
6 | /*.userprefs
7 | Resource.designer.cs
8 | *csproj.user
9 | .DS_Store
10 | /packages/
11 | /Resources.resources
12 | *.csproj
13 | *.speccache
14 | *.sln
15 | *~
16 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "libs/Zeroconf"]
2 | path = libs/Zeroconf
3 | url = https://github.com/labnation/Mono.Zeroconf.git
4 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/Build/Module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | DeviceInterface
4 | Generate
5 | Linux
6 | MacOS
7 | Windows
8 | SmartScopeConsole
9 | Android,Linux,Windows,MacOS,iOS
10 | true
11 |
--------------------------------------------------------------------------------
/Build/Projects/Common.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | v9.0
7 |
8 |
9 | v4.5
10 |
11 |
12 | v4.0
13 |
14 |
15 | v4.5
16 |
17 |
18 | v4.5
19 |
20 |
21 | 5
22 | LabNation.Common
23 | True
24 |
25 | TRACE;ANDROID
26 | IOS
27 | TRACE;LINUX
28 | MONOMAC
29 | TRACE;WINDOWS
30 | TRACE;WINDOWS
31 |
32 | 1591
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Build/Projects/FormApp.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Build/Projects/LibUsbDotNet.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Build/Projects/LinFormReferences.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Build/Projects/MatlabFileIO.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 5
5 | 1591
6 | MatlabFileIO
7 | True
8 |
9 |
10 | v9.0
11 |
12 |
13 | v4.5
14 |
15 |
16 | v4.0
17 |
18 |
19 | v4.5
20 |
21 |
22 | v4.5
23 |
24 |
25 |
26 | TRACE;ANDROID
27 | IOS
28 | TRACE;LINUX
29 | MONOMAC
30 | TRACE;WINDOWS
31 | TRACE;WINDOWS
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Build/Projects/Mono.Zeroconf.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
20 |
21 |
25 |
26 |
30 |
31 |
32 |
33 |
37 |
38 |
42 |
43 |
44 |
45 |
49 |
50 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Build/Projects/MonoPlatformSpecific.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Build/Projects/SmartScopeConsole.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 1591
11 | SmartScopeConsole
12 | True
13 |
14 | TRACE;LINUX
15 | MONOMAC
16 | TRACE;WINDOWS
17 |
18 |
19 |
20 |
21 |
22 | libusb-1.0.0.dylib
23 | Always
24 | MacOS
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Build/Projects/SmartScopeServer.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | v4.5
7 |
8 |
9 | v4.0
10 |
11 |
12 | v4.5
13 |
14 |
15 | v4.5
16 |
17 |
18 | LabNation.SmartScopeServer
19 | True
20 |
21 | TRACE;LINUX
22 | MONOMAC
23 | TRACE;WINDOWS;WINUSB
24 | TRACE;WINDOWS;WINUSB
25 |
26 | 1591
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | Always
45 | MacOS
46 |
47 |
48 | Always
49 | Linux,MacOS
50 |
51 |
52 | Always
53 | MacOS,Windows
54 |
55 |
56 | libusb-1.0.0.dylib
57 | Always
58 | MacOS
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/Build/Projects/SmartScopeServerUI.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | v4.5
7 |
8 |
9 | v4.0
10 |
11 |
12 | v4.5
13 |
14 |
15 | v4.5
16 |
17 |
18 | LabNation.SmartScopeServerUI
19 | True
20 | smartscopeserver.ico
21 |
22 | TRACE;LINUX
23 | MONOMAC
24 | TRACE;WINDOWS;WINUSB
25 | TRACE;WINDOWS;WINUSB
26 |
27 | 1591
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | Form
45 | MacOS
46 |
47 |
48 | MainForm.cs
49 | MacOS
50 |
51 |
52 | MacOS
53 |
54 |
55 |
56 |
57 | MacOS
58 |
59 |
60 | AppDelegate.cs
61 | MacOS
62 |
63 |
64 | MacOS
65 |
66 |
67 | MacOS
68 |
69 |
70 | MacWindow.cs
71 | MacOS
72 |
73 |
74 | MacOS
75 |
76 |
77 | MacOS
78 |
79 |
80 | MacOS
81 |
82 |
83 |
84 | MacOS
85 |
86 |
87 |
88 |
89 | MacOS
90 |
91 |
92 | Always
93 | Linux,MacOS
94 |
95 |
96 | Always
97 | MacOS,Windows
98 |
99 |
100 | libusb-1.0.0.dylib
101 | Always
102 | MacOS
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/Build/Projects/WinFormReferences.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Build/Projects/WinUSB.definition:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Mono.Zeroconf.Providers.Bonjour.dll.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Protobuild.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/Protobuild.exe
--------------------------------------------------------------------------------
/blobs/SmartScopeHackerSpecial.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScopeHackerSpecial.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A10.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A10.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A12.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A12.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A14.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A14.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A15.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A15.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A16.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A16.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A17.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A17.bin
--------------------------------------------------------------------------------
/blobs/SmartScope_A18.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/SmartScope_A18.bin
--------------------------------------------------------------------------------
/blobs/i2c_sequence.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/blobs/i2c_sequence.mat
--------------------------------------------------------------------------------
/bootstrap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [[ -z "$1" ]]; then
5 | echo Usage:
6 | echo
7 | echo "$0 [NoClean]"
8 | echo
9 | echo "Where can be Linux|MacOS|Windows"
10 | echo
11 | echo "If NoClean is specified, submodules won't be updated"
12 | exit -1
13 | fi
14 |
15 | HOST=`uname`
16 | if [[ x$HOST != xMINGW* ]]; then
17 | CMD_PREFIX="mono ./"
18 | else
19 | CMD_PREFIX="./"
20 | fi
21 | echo Current directory: `pwd`
22 |
23 | if [[ x$2 != xNoClean ]]; then
24 | git submodule init
25 | git submodule update
26 | fi
27 |
28 | ${CMD_PREFIX}Protobuild.exe --generate $1
29 | sed -i~ -e "s/\(False<\/UseSGen>\)/\1true<\/Externalconsole>/" examples/SmartScopeConsole/SmartScopeConsole.$1.csproj
30 |
31 | ${CMD_PREFIX}.nuget/NuGet.exe restore DeviceInterface.$1.sln
32 |
--------------------------------------------------------------------------------
/driver/.gitignore:
--------------------------------------------------------------------------------
1 | /usb_driver/
2 |
--------------------------------------------------------------------------------
/driver/install_smartscope_driver.bat:
--------------------------------------------------------------------------------
1 | wdi-simple.exe -n SmartScope -f smartscope.inf -m LabNation -v 0x04D8 -p 0xF4B5 -g {7d2c7901-f90b-434d-aae1-38e3e39a3ca1} -t 0 -b
--------------------------------------------------------------------------------
/driver/wdi-simple.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/driver/wdi-simple.exe
--------------------------------------------------------------------------------
/examples/MakerKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSApplicationCategoryType
6 | public.app-category.utilities
7 | CFBundleName
8 | MakerKit
9 | CFBundleIdentifier
10 | com.lab-nation.makerkit
11 | CFBundleShortVersionString
12 | 1.0
13 | CFBundleVersion
14 | 1.0
15 | LSMinimumSystemVersion
16 | 10.7
17 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/MakerKit/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using Android.App;
5 | using Android.Content.PM;
6 | using Android.OS;
7 |
8 | using LabNation.DeviceInterface;
9 | using LabNation.DeviceInterface.Devices;
10 | using LabNation.DeviceInterface.Hardware;
11 |
12 | namespace MakerKit
13 | {
14 | [Activity (
15 | Label = "MakerKitApp.Droid",
16 | Theme="@android:style/Theme.Holo.Light",
17 | Icon = "@drawable/icon",
18 | MainLauncher = true,
19 | ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation
20 | )]
21 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
22 | {
23 | static DeviceManager hsManager;
24 | private App mainApp;
25 |
26 | protected override void OnCreate (Bundle bundle)
27 | {
28 | base.OnCreate (bundle);
29 |
30 | global::Xamarin.Forms.Forms.Init (this, bundle);
31 |
32 | //load yaml file
33 | string regDefinitionPath = System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "LabNation");
34 | regDefinitionPath = System.IO.Path.Combine (regDefinitionPath, "DevApp");
35 | System.IO.Directory.CreateDirectory (regDefinitionPath);
36 | List registerDefinitions = MakerKit.YamlHelper.ReadYaml(System.IO.Path.Combine(regDefinitionPath, "regDefinition.yaml"));
37 |
38 | //start deviceManager, converting any incoming SmartScope into HackerSpecial instance
39 | hsManager = new DeviceManager(Application.Context, null, connectHandler, new Dictionary() { { typeof(ISmartScopeInterface), typeof(HackerSpecial) } });
40 | hsManager.Start();
41 |
42 | mainApp = new App(registerDefinitions.ToArray ());
43 | LoadApplication (mainApp);
44 |
45 | mainApp.SetStatus("Loaded registerbank information from file");
46 | }
47 |
48 | private void connectHandler(IDevice dev, bool connected)
49 | {
50 | //Only accept devices of the IScope type (i.e. not IWaveGenerator)
51 | //and block out the fallback device (dummy scope)
52 | if (connected && dev is HackerSpecial && !(dev is DummyScope))
53 | {
54 | mainApp.SetStatus("SmartScope connected");
55 |
56 | mainApp.device = (HackerSpecial)dev;
57 |
58 | //Get FW contents
59 | string fwName = "SmartScopeCustom.bin";
60 | string regDefinitionPath = System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "LabNation");
61 | regDefinitionPath = System.IO.Path.Combine (regDefinitionPath, "DevApp");
62 | string fullFileName = System.IO.Path.Combine(regDefinitionPath, fwName);
63 |
64 | //load FW from file
65 | byte[] firmware = null;
66 | try
67 | {
68 | firmware = System.IO.File.ReadAllBytes(fullFileName);
69 | mainApp.SetStatus(fullFileName + " loaded");
70 | }
71 | catch
72 | {
73 | var files = System.IO.Directory.GetFiles (regDefinitionPath);
74 | mainApp.SetStatus(fullFileName + " not found!");
75 | }
76 |
77 | //Flash FW to FPGA
78 | if (firmware != null) {
79 | if (mainApp.device.FlashFPGA (firmware)) {
80 | mainApp.SetStatus("FPGA configured successfully");
81 | } else {
82 | mainApp.SetStatus("Firmware loaded, but configuring FPGA failed");
83 | }
84 | }
85 | }
86 | else
87 | {
88 | mainApp.device = null;
89 | }
90 | }
91 | }
92 | }
93 |
94 |
--------------------------------------------------------------------------------
/examples/MakerKit/MakerKitForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 | using System.Drawing;
5 | using System.IO;
6 | using LabNation.DeviceInterface.Devices;
7 | using LabNation.DeviceInterface.Hardware;
8 |
9 | namespace MakerKit
10 | {
11 | public partial class MakerKitForm : Form
12 | {
13 | static DeviceManager hsManager;
14 | static HackerSpecial device;
15 |
16 | public MakerKitForm()
17 | {
18 | //load yaml file
19 | List registerDefinitions = YamlHelper.ReadYaml("regDefinition.yaml");
20 |
21 | InitializeComponent(registerDefinitions);
22 | this.pictureBox1.Image = Image.FromStream(new MemoryStream(Resources.Load("labnation-logo.png")));
23 | statusLabel.Text = "Loaded registerbank information from file";
24 |
25 | //starts DeviceManaging, converting any incoming SmartScope interfacei into a HackerSpecial instance. See connectHandler on what's going on next.
26 | hsManager = new DeviceManager(null, connectHandler, new Dictionary()
27 | {
28 | { typeof(ISmartScopeInterfaceUsb), typeof(HackerSpecial) },
29 | { typeof(SmartScopeInterfaceEthernet), typeof(HackerSpecial) }
30 | });
31 | hsManager.Start();
32 |
33 | }
34 |
35 | protected override void OnFormClosing(System.Windows.Forms.FormClosingEventArgs e)
36 | {
37 | hsManager.Stop();
38 | base.OnFormClosing(e);
39 | }
40 |
41 | static void connectHandler(IDevice dev, bool connected)
42 | {
43 | //Only accept devices of the IScope type (i.e. not IWaveGenerator)
44 | //and block out the fallback device (dummy scope)
45 | if (connected && dev is HackerSpecial && !(dev is DummyScope))
46 | {
47 | statusLabel.Text = "SmartScope connected";
48 |
49 | device = (HackerSpecial)dev;
50 |
51 | //Get FW contents
52 | string fwName = "SmartScopeCustom.bin";
53 |
54 | //load FW from file
55 | byte[] firmware = null;
56 | try
57 | {
58 | firmware = System.IO.File.ReadAllBytes(fwName);
59 | statusLabel.Text = fwName + " file loaded";
60 | }
61 | catch
62 | {
63 | statusLabel.Text = fwName + " file not found!";
64 | }
65 |
66 | //Flash FW to FPGA
67 | if (firmware != null)
68 | {
69 | if (device.FlashFPGA(firmware))
70 | {
71 | statusLabel.Text = "FPGA configured successfully";
72 | }
73 | else
74 | {
75 | statusLabel.Text = "Firmware loaded, but configuring FPGA failed";
76 | }
77 | }
78 | }
79 | else
80 | {
81 | device = null;
82 | }
83 | }
84 |
85 | //whenever the value in a textbox is updated, the new value is sent to the FPGA immediately
86 | void textbox_TextChanged(object sender, System.EventArgs e)
87 | {
88 | TextBox textbox = (TextBox)sender;
89 | int registerIndex = (int)textbox.Tag;
90 |
91 | uint entryValue;
92 | if (!uint.TryParse (textbox.Text, out entryValue))
93 | entryValue = 0;
94 | else if (entryValue < 0)
95 | entryValue = 0;
96 | else if (entryValue > 255)
97 | entryValue = 255;
98 | textbox.Text = entryValue.ToString();
99 |
100 | if (device != null)
101 | device.FpgaUserMemory[(uint)registerIndex].WriteImmediate((byte)entryValue);
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/examples/MakerKit/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace MakerKit
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new MakerKitForm());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/examples/MakerKit/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/MakerKit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | #if ANDROID
4 | using Android.App;
5 | #else
6 | using System.Runtime.InteropServices;
7 | #endif
8 |
9 | [assembly: AssemblyTitle("MakerKit")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("LabNation")]
13 | [assembly: AssemblyProduct("SmartScope MakerKit")]
14 | [assembly: AssemblyCopyright("Copyright © 2016")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | #if ANDROID
18 | [assembly: Application(Icon = "@drawable/icon")]
19 | #else
20 | [assembly: ComVisible(false)]
21 | [assembly: Guid("cb6f0484-50fc-405a-baec-cf5d1c5f7d5c")]
22 | [assembly: AssemblyFileVersion("1.0.0.0")]
23 | #endif
24 | [assembly: AssemblyVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/examples/MakerKit/Resources.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.IO;
4 |
5 | namespace MakerKit
6 | {
7 | public static class Resources
8 | {
9 | internal static byte[] Load(string name)
10 | {
11 | Assembly ass = Assembly.GetExecutingAssembly();
12 |
13 | using(Stream s = ass.GetManifestResourceStream(String.Format("{0}.Resources.{1}", ass.GetName().Name, name)))
14 | using(BinaryReader r = new BinaryReader(s))
15 | return r.ReadBytes((int)s.Length);
16 |
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/examples/MakerKit/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/MakerKit/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/examples/MakerKit/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/MakerKit/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/examples/MakerKit/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/MakerKit/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/examples/MakerKit/Resources/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/MakerKit/Resources/drawable/icon.png
--------------------------------------------------------------------------------
/examples/MakerKit/Resources/labnation-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/MakerKit/Resources/labnation-logo.png
--------------------------------------------------------------------------------
/examples/MakerKit/YamlHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace MakerKit
6 | {
7 | public class RegisterBankDefinition
8 | {
9 | public byte I2CAddress { get; set; }
10 | public string Name { get; set; }
11 | public string[] Registers { get; set; }
12 | }
13 |
14 | public static class YamlHelper
15 | {
16 | public static void WriteYaml(List allRegisters, string filePath)
17 | {
18 | TextWriter writer;
19 | try
20 | {
21 | writer = File.CreateText(filePath);
22 | }
23 | catch
24 | {
25 | throw new Exception("Error while trying to create Yaml file");
26 | }
27 | var serializer = new YamlDotNet.Serialization.Serializer();
28 | serializer.Serialize(writer, allRegisters);
29 | writer.Close();
30 |
31 | }
32 |
33 | public static List ReadYaml(string filePath)
34 | {
35 | //check if file exists, if not: make default file
36 | if (!File.Exists(filePath))
37 | {
38 | RegisterBankDefinition rd = new RegisterBankDefinition();
39 | rd.Name = "userBank";
40 | rd.I2CAddress = 22;
41 | rd.Registers = new string[] { "reg0", "reg1" };
42 |
43 | List allRegisters = new List();
44 | allRegisters.Add(rd);
45 | WriteYaml(allRegisters, filePath);
46 | }
47 |
48 | //file is sure to exist: read and parse
49 | StreamReader reader = File.OpenText(filePath);
50 | var deserializer = new YamlDotNet.Serialization.Deserializer();
51 | List registerBanks = deserializer.Deserialize>(reader);
52 |
53 | return registerBanks;
54 | }
55 | }
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/examples/MakerKit/packages.Android.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/MakerKit/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/examples/SmartScopeConsole/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIdentifier
6 | com.lab-nation.consoledemo
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/SmartScopeConsole/Info.plist.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | CFBundleIdentifier
7 | com.lab-nation.SmartScopeConsole
8 | CFBundleName
9 | SmartScope Console
10 | LSMinimumSystemVersion
11 | 10.10
12 | NSPrincipalClass
13 | NSApplication
14 | CFBundleDisplayName
15 | SmartScope
16 | LSApplicationCategoryType
17 | public.app-category.developer-tools
18 | CFBundleIconFile
19 | smartscopeserver
20 | CFBundleShortVersionString
21 | VersionPlaceHolder
22 | CFBundleVersion
23 | 2
24 | NSMainNibFile
25 | MacMenu
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/SmartScopeServer/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /obj/
3 | /Properties/
4 | /packages/
5 |
--------------------------------------------------------------------------------
/examples/SmartScopeServer/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/SmartScopeServer/Info.plist.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | CFBundleIdentifier
7 | com.lab-nation.SmartScopeServer
8 | CFBundleName
9 | SmartScope Server Command Line
10 | LSMinimumSystemVersion
11 | 10.10
12 | NSPrincipalClass
13 | NSApplication
14 | CFBundleDisplayName
15 | SmartScope
16 | LSApplicationCategoryType
17 | public.app-category.developer-tools
18 | CFBundleIconFile
19 | smartscopeserver
20 | CFBundleShortVersionString
21 | VersionPlaceHolder
22 | CFBundleVersion
23 | 2
24 | NSMainNibFile
25 | MacMenu
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/SmartScopeServer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using LabNation.Common;
7 | using LabNation.DeviceInterface.Net;
8 | using System.IO;
9 | #if WINDOWS
10 | using System.Windows.Forms;
11 | #endif
12 |
13 | namespace SmartScopeServer
14 | {
15 | class Program
16 | {
17 | [STAThread]
18 | static void Main(string[] args)
19 | {
20 | ConsoleLogger consoleLog = new ConsoleLogger(LogLevel.INFO);
21 | Logger.LogC(LogLevel.INFO, "--- Press 'q' to stop server ---\n", ConsoleColor.Green);
22 |
23 |
24 | Monitor interfaceMonitor = new Monitor();
25 |
26 |
27 |
28 | #if WINDOWS
29 | //Need the Application thread to enable winusb device detection
30 | Application.EnableVisualStyles();
31 | #endif
32 | while (true)
33 | {
34 | #if WINDOWS
35 | Application.DoEvents();
36 | #endif
37 | System.Threading.Thread.Sleep(60);
38 | if (Console.KeyAvailable) {
39 | ConsoleKeyInfo key = Console.ReadKey ();
40 | if (key.KeyChar == 'q') {
41 | Logger.Info ("Quitting");
42 | break;
43 | }
44 | }
45 | }
46 |
47 | Logger.Info ("Stopping interface monitor");
48 | interfaceMonitor.Stop();
49 |
50 | Logger.Info ("Stopping console logger");
51 | consoleLog.Stop();
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/.gitignore:
--------------------------------------------------------------------------------
1 | /Info.plist
2 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreGraphics;
3 | using Foundation;
4 | using AppKit;
5 | using ObjCRuntime;
6 | using System.Collections.Generic;
7 | using LabNation.DeviceInterface.Net;
8 | using LabNation.Common;
9 |
10 | namespace LabNation.SmartScopeServerUI
11 | {
12 | public partial class AppDelegate : NSApplicationDelegate
13 | {
14 | MacWindowController mainWindowController;
15 |
16 | public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
17 | {
18 | return true;
19 | }
20 |
21 | Monitor m;
22 | ServerTable stv;
23 |
24 | public override void DidFinishLaunching (NSNotification notification)
25 | {
26 | new ConsoleLogger(LogLevel.DEBUG);
27 |
28 | mainWindowController = new MacWindowController ();
29 |
30 | // This is where we setup our visual tree. These could be setup in MainWindow.xib, but
31 | // this example is showing programmatic creation.
32 |
33 | // We create a tab control to insert both examples into, and set it to take the entire window and resize
34 | CGRect frame = mainWindowController.Window.ContentView.Frame;
35 |
36 | stv = new ServerTable(frame);
37 | NSScrollView scrollView = new NSScrollView(frame)
38 | {
39 | AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable,
40 | HasHorizontalScroller = true,
41 | HasVerticalScroller = true,
42 | };
43 | scrollView.DocumentView = stv.Table;
44 |
45 |
46 | mainWindowController.Window.ContentView.AddSubview (scrollView);
47 | mainWindowController.Window.MakeKeyAndOrderFront (this);
48 |
49 | autostartitem.State = NSCellStateValue.On;
50 | m = new Monitor(autostartitem.State == NSCellStateValue.On, ServerChanged);
51 | }
52 |
53 | partial void autostart(Foundation.NSObject sender)
54 | {
55 |
56 | NSMenuItem startitem = (NSMenuItem)sender;
57 | startitem.State = startitem.State == NSCellStateValue.On ? NSCellStateValue.Off : NSCellStateValue.On;
58 | m.Autostart = autostartitem.State == NSCellStateValue.On;
59 | }
60 |
61 | void ServerChanged(InterfaceServer s, bool present)
62 | {
63 | stv.ServerChanged(s, present);
64 | if (s.State == ServerState.Stopped && autostartitem.State == NSCellStateValue.On)
65 | s.Start();
66 | }
67 |
68 | partial void quit(Foundation.NSObject sender)
69 | {
70 | mainWindowController.Close();
71 | }
72 | public override void WillTerminate(Foundation.NSNotification notification)
73 | {
74 | FileLogger.StopAll();
75 | }
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/AppDelegate.designer.cs:
--------------------------------------------------------------------------------
1 | // WARNING
2 | //
3 | // This file has been generated automatically by Xamarin Studio to store outlets and
4 | // actions made in the UI designer. If it is removed, they will be lost.
5 | // Manual changes to this file may not be handled correctly.
6 | //
7 | using Foundation;
8 | using System.CodeDom.Compiler;
9 |
10 | namespace LabNation.SmartScopeServerUI
11 | {
12 | [Register ("AppDelegate")]
13 | partial class AppDelegate
14 | {
15 | [Outlet]
16 | AppKit.NSMenuItem autostartitem { get; set; }
17 |
18 | [Action ("autostart:")]
19 | partial void autostart (Foundation.NSObject sender);
20 |
21 | [Action ("quit:")]
22 | partial void quit (Foundation.NSObject sender);
23 |
24 | void ReleaseDesignerOutlets ()
25 | {
26 | if (autostartitem != null) {
27 | autostartitem.Dispose ();
28 | autostartitem = null;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/Info.plist.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | CFBundleIdentifier
7 | com.lab-nation.SmartScopeServerUI
8 | CFBundleName
9 | SmartScope Server
10 | LSMinimumSystemVersion
11 | 10.10
12 | NSPrincipalClass
13 | NSApplication
14 | CFBundleDisplayName
15 | SmartScope
16 | LSApplicationCategoryType
17 | public.app-category.developer-tools
18 | CFBundleIconFile
19 | smartscopeserver
20 | CFBundleShortVersionString
21 | VersionPlaceHolder
22 | CFBundleVersion
23 | 2
24 | NSMainNibFile
25 | MacMenu
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/MacMenu.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/MacWindow.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using Foundation;
6 | using AppKit;
7 |
8 | namespace LabNation.SmartScopeServerUI
9 | {
10 | public partial class MacWindow : AppKit.NSWindow
11 | {
12 | #region Constructors
13 |
14 | // Called when created from unmanaged code
15 | public MacWindow (IntPtr handle) : base (handle)
16 | {
17 | Initialize ();
18 | }
19 |
20 | // Called when created directly from a XIB file
21 | [Export ("initWithCoder:")]
22 | public MacWindow (NSCoder coder) : base (coder)
23 | {
24 | Initialize ();
25 | }
26 |
27 | // Shared initialization code
28 | void Initialize ()
29 | {
30 | }
31 |
32 | #endregion
33 | }
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/MacWindow.designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace LabNation.SmartScopeServerUI
3 | {
4 |
5 | // Should subclass MonoMac.AppKit.NSWindow
6 | [Foundation.Register ("MacWindow")]
7 | public partial class MacWindow
8 | {
9 | }
10 |
11 | // Should subclass MonoMac.AppKit.NSWindowController
12 | [Foundation.Register ("MacWindowController")]
13 | public partial class MacWindowController
14 | {
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/MacWindow.xib:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/MacWindowController.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using Foundation;
6 | using AppKit;
7 |
8 | namespace LabNation.SmartScopeServerUI
9 | {
10 | public partial class MacWindowController : AppKit.NSWindowController
11 | {
12 | #region Constructors
13 |
14 | // Called when created from unmanaged code
15 | public MacWindowController (IntPtr handle) : base (handle)
16 | {
17 | Initialize ();
18 | }
19 |
20 | // Called when created directly from a XIB file
21 | [Export ("initWithCoder:")]
22 | public MacWindowController (NSCoder coder) : base (coder)
23 | {
24 | Initialize ();
25 | }
26 |
27 | // Call to load from the XIB/NIB file
28 | public MacWindowController () : base ("MacWindow")
29 | {
30 | Initialize ();
31 | }
32 |
33 | // Shared initialization code
34 | void Initialize ()
35 | {
36 | }
37 |
38 | #endregion
39 |
40 | //strongly typed window accessor
41 | public new MacWindow Window {
42 | get {
43 | return (MacWindow)base.Window;
44 | }
45 | }
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | #if MONOMAC
3 | using CoreGraphics;
4 | using Foundation;
5 | using AppKit;
6 | using ObjCRuntime;
7 | #else
8 | using System.Windows.Forms;
9 | #endif
10 |
11 | namespace LabNation.SmartScopeServerUI
12 | {
13 | static class Program
14 | {
15 | #if MONOMAC
16 | static void Main (string[] args)
17 | {
18 | NSApplication.Init ();
19 | NSApplication.Main (args);
20 | }
21 | #else
22 | [STAThread]
23 | static void Main()
24 | {
25 | Application.EnableVisualStyles();
26 | Application.SetCompatibleTextRenderingDefault(false);
27 | Application.Run(new MainForm());
28 | }
29 | #endif
30 | }
31 | }
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SmartScopeServerUI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("LabNation")]
12 | [assembly: AssemblyProduct("SmartScopeServerUI")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5a01ba09-753f-409d-bbf3-0b346a59b5b2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/smartscopeserver.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/SmartScopeServerUI/smartscopeserver.icns
--------------------------------------------------------------------------------
/examples/SmartScopeServerUI/smartscopeserver.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/examples/SmartScopeServerUI/smartscopeserver.ico
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/.gitignore:
--------------------------------------------------------------------------------
1 | !LibUsbDotNet.csproj
2 | /bin/
3 | /obj/
4 |
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/ClassCodeType.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 |
24 | namespace LibUsbDotNet.Descriptors
25 | {
26 | /// Device and/or Interface Class codes
27 | [Flags]
28 | public enum ClassCodeType : byte
29 | {
30 | ///In the context of a "device descriptor", this bDeviceClass value indicates that each interface specifies its own class information and all interfaces operate independently.
31 | PerInterface = 0,
32 |
33 | ///Audio class
34 | Audio = 1,
35 |
36 | /// Communications class
37 | Comm = 2,
38 |
39 | /// Human Interface Device class
40 | Hid = 3,
41 |
42 | /// Printer dclass
43 | Printer = 7,
44 |
45 | /// Picture transfer protocol class
46 | Ptp = 6,
47 |
48 | /// Mass storage class
49 | MassStorage = 8,
50 |
51 | /// Hub class
52 | Hub = 9,
53 |
54 | /// Data class
55 | Data = 10,
56 |
57 | /// Class is vendor-specific
58 | VendorSpec = 0xff
59 | }
60 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/DescriptorType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/DescriptorType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/LangStringDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/LangStringDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/StringDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/StringDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/UsbConfigDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/UsbConfigDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/UsbDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/UsbDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/UsbDeviceDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/UsbDeviceDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/UsbEndpointDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/UsbEndpointDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Descriptors/UsbInterfaceDescriptor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Descriptors/UsbInterfaceDescriptor.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/DeviceNotifier.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/DeviceNotifier.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/DeviceNotifyEventArgs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/DeviceNotifyEventArgs.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/DeviceType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/DeviceType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/EventType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/EventType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/IDeviceNotifier.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 |
24 | namespace LibUsbDotNet.DeviceNotify
25 | {
26 | ///
27 | /// Notifies an application of a change to the hardware Configuration of a device or
28 | /// the computer.
29 | ///
30 | ///
31 | /// For devices that offer software-controllable features, such as ejection and locking,
32 | /// the system typically sends a message to
33 | /// let applications and device drivers end their use of the device gracefully. If the
34 | /// system forcibly removes a device, it may not send a
35 | /// message before doing so.
36 | ///
37 | ///
38 | ///
39 | ///
40 | public interface IDeviceNotifier
41 | {
42 | ///
43 | /// Enables/Disables notification events.
44 | ///
45 | bool Enabled { get; set; }
46 |
47 | ///
48 | /// Main Notify event for all device notifications.
49 | ///
50 | event EventHandler OnDeviceNotify;
51 | }
52 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/IPortNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/IPortNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/IUsbDeviceNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/IUsbDeviceNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/IVolumeNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/IVolumeNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/PortNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/PortNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/UsbDeviceNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/UsbDeviceNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Info/VolumeNotifyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Info/VolumeNotifyInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastDeviceinterface.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastDeviceinterface.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastHdr.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastHdr.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastPort.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastPort.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastVolume.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/DevBroadcastVolume.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/DevNotifyNativeWindow.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/DevNotifyNativeWindow.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Internal/SafeNotifyHandle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Internal/SafeNotifyHandle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDevItem.cs:
--------------------------------------------------------------------------------
1 | // Copyright � 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System.Runtime.InteropServices;
23 | using LibUsbDotNet.Descriptors;
24 | using MonoLibUsb.Descriptors;
25 |
26 | namespace LibUsbDotNet.DeviceNotify.Linux
27 | {
28 | internal class LinuxDevItem
29 | {
30 | public readonly byte BusNumber;
31 | public readonly byte DeviceAddress;
32 | public readonly UsbDeviceDescriptor DeviceDescriptor;
33 | public readonly string DeviceFileName;
34 | public readonly string Serial;
35 |
36 | public LinuxDevItem(string deviceFileName, byte busNumber, byte deviceAddress, byte[] fileDescriptor, string serial)
37 | {
38 | DeviceFileName = deviceFileName;
39 | BusNumber = busNumber;
40 | DeviceAddress = deviceAddress;
41 | Serial = serial;
42 |
43 | DeviceDescriptor = new UsbDeviceDescriptor();
44 | GCHandle gcFileDescriptor = GCHandle.Alloc(DeviceDescriptor, GCHandleType.Pinned);
45 | Marshal.Copy(fileDescriptor, 0, gcFileDescriptor.AddrOfPinnedObject(), Marshal.SizeOf(DeviceDescriptor));
46 |
47 | gcFileDescriptor.Free();
48 | }
49 |
50 | public LinuxDevItem(string deviceFileName, byte busNumber, byte deviceAddress, MonoUsbDeviceDescriptor monoUsbDeviceDescriptor, string serial)
51 | {
52 | DeviceFileName = deviceFileName;
53 | BusNumber = busNumber;
54 | DeviceAddress = deviceAddress;
55 | Serial = serial;
56 |
57 |
58 | DeviceDescriptor = new UsbDeviceDescriptor(monoUsbDeviceDescriptor);
59 | }
60 |
61 | public bool Equals(LinuxDevItem other)
62 | {
63 | if (ReferenceEquals(null, other)) return false;
64 | if (ReferenceEquals(this, other)) return true;
65 | return Equals(other.DeviceFileName, DeviceFileName) && other.BusNumber == BusNumber && other.DeviceAddress == DeviceAddress &&
66 | Equals(other.DeviceDescriptor, DeviceDescriptor);
67 | }
68 |
69 | public override bool Equals(object obj)
70 | {
71 | if (ReferenceEquals(null, obj)) return false;
72 | if (ReferenceEquals(this, obj)) return true;
73 | if (obj.GetType() != typeof (LinuxDevItem)) return false;
74 | return Equals((LinuxDevItem) obj);
75 | }
76 |
77 | public override int GetHashCode()
78 | {
79 | unchecked
80 | {
81 | int result = (DeviceFileName != null ? DeviceFileName.GetHashCode() : 0);
82 | result = (result*397) ^ BusNumber.GetHashCode();
83 | result = (result*397) ^ DeviceAddress.GetHashCode();
84 | result = (result*397) ^ (DeviceDescriptor != null ? DeviceDescriptor.GetHashCode() : 0);
85 | return result;
86 | }
87 | }
88 |
89 | public static bool operator ==(LinuxDevItem left, LinuxDevItem right) { return Equals(left, right); }
90 | public static bool operator !=(LinuxDevItem left, LinuxDevItem right) { return !Equals(left, right); }
91 | }
92 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDevItemList.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDevItemList.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDeviceNotifier.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDeviceNotifier.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDeviceNotifierMode.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDeviceNotifierMode.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/Linux/LinuxDeviceNotifyEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 |
24 | namespace LibUsbDotNet.DeviceNotify.Linux
25 | {
26 | ///
27 | /// Describes the device notify event
28 | ///
29 | public class LinuxDeviceNotifyEventArgs : DeviceNotifyEventArgs
30 | {
31 | internal LinuxDeviceNotifyEventArgs(LinuxDevItem linuxDevItem, DeviceType deviceType, EventType eventType)
32 | {
33 | mEventType = eventType;
34 | mDeviceType = deviceType;
35 | switch (mDeviceType)
36 | {
37 | case DeviceType.Volume:
38 | throw new NotImplementedException(mDeviceType.ToString());
39 | case DeviceType.Port:
40 | throw new NotImplementedException(mDeviceType.ToString());
41 | case DeviceType.DeviceInterface:
42 | mDevice = new LinuxUsbDeviceNotifyInfo(linuxDevItem);
43 | mObject = mDevice;
44 | break;
45 | }
46 | }
47 |
48 | //internal LinuxDeviceNotifyEventArgs(DevBroadcastHdr hdr, IntPtr ptrHdr, EventType eventType)
49 | //{
50 | // mBaseHdr = hdr;
51 | // mEventType = eventType;
52 | // mDeviceType = mBaseHdr.DeviceType;
53 | // switch (mDeviceType)
54 | // {
55 | // case DeviceType.Volume:
56 | // mVolume = new VolumeNotifyInfo(ptrHdr);
57 | // mObject = mVolume;
58 | // break;
59 | // case DeviceType.Port:
60 | // mPort = new PortNotifyInfo(ptrHdr);
61 | // mObject = mPort;
62 | // break;
63 | // case DeviceType.DeviceInterface:
64 | // mDevice = new UsbDeviceNotifyInfo(ptrHdr);
65 | // mObject = mDevice;
66 | // break;
67 | // }
68 | //}
69 | }
70 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/WindowsDeviceNotifier.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/WindowsDeviceNotifier.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/DeviceNotify/WindowsDeviceNotifyEventArgs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/DeviceNotify/WindowsDeviceNotifyEventArgs.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/IUsbDevice.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/IUsbDevice.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/IUsbInterface.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/IUsbInterface.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Info/UsbBaseInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Info/UsbBaseInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Info/UsbConfigInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Info/UsbConfigInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Info/UsbDeviceInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Info/UsbDeviceInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Info/UsbEndpointInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Info/UsbEndpointInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Info/UsbInterfaceInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Info/UsbInterfaceInfo.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/Kernel32.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/Kernel32.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/OverlappedTransferContext.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/OverlappedTransferContext.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/SafeOverlapped.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/SafeOverlapped.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/SetupApi.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/SetupApi.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/TransferContextBase.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/TransferContextBase.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/UsbApiBase.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/UsbApiBase.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/UsbRegex/BaseRegSymbolicName.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/UsbRegex/BaseRegSymbolicName.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/UsbRegex/NamedGroup.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/UsbRegex/NamedGroup.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/UsbRegex/RegHardwareID.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/UsbRegex/RegHardwareID.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Internal/UsbRegex/RegSymbolicName.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Internal/UsbRegex/RegSymbolicName.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/Internal/LibUsbAPI.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/Internal/LibUsbAPI.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/Internal/LibUsbDriverIO.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/Internal/LibUsbDriverIO.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/Internal/LibUsbDriverIO_IOControlMessage.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/Internal/LibUsbDriverIO_IOControlMessage.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/Internal/LibUsbIoCtl.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/Internal/LibUsbIoCtl.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/Internal/LibUsbRequest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/Internal/LibUsbRequest.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/LibUsbDevice.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/LibUsbDevice.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/LibUsbDeviceRegistryKeyRequest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/LibUsbDeviceRegistryKeyRequest.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/LibUsbKernelType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/LibUsbKernelType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsb/LibUsbRegistry.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/LibUsb/LibUsbRegistry.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/LibUsbDotNet.dll.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/ControlEpLockType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/ControlEpLockType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/DataEpLockType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/DataEpLockType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/DataReceivedEnabledChangedEventArgs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/DataReceivedEnabledChangedEventArgs.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/DeviceLockType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/DeviceLockType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/DevicePropertyType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/DevicePropertyType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/EndpointDataEventArgs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/EndpointDataEventArgs.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/EndpointType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/EndpointType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/ErrorCode.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/ErrorCode.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/Helper.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/Helper.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/ReadEndpointID.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/ReadEndpointID.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/SPDRP.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/SPDRP.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/SafeContextHandle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/SafeContextHandle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/SetupApiRegistry.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/SetupApiRegistry.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbConstants.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbConstants.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbCtrlFlags.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbCtrlFlags.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbDeviceFinder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbDeviceFinder.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbEndpointBase.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbEndpointBase.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbEndpointDirection.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbEndpointDirection.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbEndpointList.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbEndpointList.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbException.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbException.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbKernelVersion.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbKernelVersion.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbLockStyle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbLockStyle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbRegDeviceList.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbRegDeviceList.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbRegistry.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbRegistry.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbRequestRecipient.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbRequestRecipient.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbRequestType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbRequestType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbSetupPacket.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbSetupPacket.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbStandardRequest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbStandardRequest.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbStatusClodes.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbStatusClodes.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbSymbolicName.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbSymbolicName.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/UsbTransfer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/UsbTransfer.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Main/WriteEndpointID.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/Main/WriteEndpointID.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/CallbackDelegates.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using MonoLibUsb.Transfer;
4 |
5 | namespace MonoLibUsb
6 | {
7 | ///
8 | /// Asynchronous transfer callback delegate
9 | ///
10 | /// The transfer previously allocated with .
11 | [UnmanagedFunctionPointer(MonoUsbApi.CC)]
12 | public delegate void MonoUsbTransferDelegate(IntPtr transfer);
13 |
14 | ///
15 | /// Callback delegate, invoked when a new file descriptor should be added to the set of file descriptors monitored for events.
16 | ///
17 | /// The new file descriptor.
18 | /// Events to monitor for, see PollfdItem for a description.
19 | /// User data pointer specified in call.
20 | [UnmanagedFunctionPointer(MonoUsbApi.CC)]
21 | public delegate void PollfdAddedDelegate(int fd, short events, IntPtr user_data);
22 |
23 | ///
24 | /// Callback delegate, invoked when a file descriptor should be removed from the set of file descriptors being monitored for events.
25 | ///
26 | /// After returning from this callback, do not use that file descriptor again.
27 | /// The file descriptor to stop monitoring.
28 | /// User data pointer specified in call.
29 | [UnmanagedFunctionPointer(MonoUsbApi.CC)]
30 | public delegate void PollfdRemovedDelegate(int fd, IntPtr user_data);
31 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Descriptors/MonoUsbEndpointDescriptor.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 | using System.Runtime.InteropServices;
24 | using LibUsbDotNet.Descriptors;
25 |
26 | namespace MonoLibUsb.Descriptors
27 | {
28 | ///
29 | /// A structure representing the standard USB endpoint descriptor. This
30 | /// descriptor is documented in section 9.6.3 of the USB 2.0 specification.
31 | /// All multiple-byte fields are represented in host-endian format.
32 | ///
33 | [StructLayout(LayoutKind.Sequential, Pack = MonoUsbApi.LIBUSB_PACK)]
34 | public class MonoUsbEndpointDescriptor
35 | {
36 | /// Size of this descriptor (in bytes)
37 | public readonly Byte bLength;
38 |
39 | /// Descriptor type. Will have value LIBUSB_DT_ENDPOINT in this context.
40 | public readonly DescriptorType bDescriptorType;
41 |
42 | /// The address of the endpoint described by this descriptor. Bits 0:3 are the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, see \ref libusb_endpoint_direction.
43 | public readonly Byte bEndpointAddress;
44 |
45 | /// Attributes which apply to the endpoint when it is configured using the bConfigurationValue. Bits 0:1 determine the transfer type and correspond to \ref libusb_transfer_type. Bits 2:3 are only used for isochronous endpoints and correspond to \ref libusb_iso_sync_type. Bits 4:5 are also only used for isochronous endpoints and correspond to \ref libusb_iso_usage_type. Bits 6:7 are reserved.
46 | public readonly Byte bmAttributes;
47 |
48 | /// Maximum packet size this endpoint is capable of sending/receiving.
49 | public readonly short wMaxPacketSize;
50 |
51 | /// Interval for polling endpoint for data transfers.
52 | public readonly Byte bInterval;
53 |
54 | /// For audio devices only: the rate at which synchronization feedback is provided.
55 | public readonly Byte bRefresh;
56 |
57 | /// For audio devices only: the address if the synch endpoint
58 | public readonly Byte bSynchAddress;
59 |
60 | /// Extra descriptors. If libusb encounters unknown endpoint descriptors, it will store them here, should you wish to parse them.
61 | private readonly IntPtr pExtraBytes;
62 |
63 | /// Length of the extra descriptors, in bytes.
64 | public readonly int ExtraLength;
65 |
66 | /// Extra descriptors. If libusb encounters unknown endpoint descriptors, it will store them here, should you wish to parse them.
67 | public byte[] ExtraBytes
68 | {
69 | get
70 | {
71 | byte[] bytes = new byte[ExtraLength];
72 | Marshal.Copy(pExtraBytes, bytes, 0, bytes.Length);
73 | return bytes;
74 | }
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Descriptors/MonoUsbInterface.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: http://sourceforge.net/projects/libusbdotnet
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 | using System.Collections.Generic;
24 | using System.Runtime.InteropServices;
25 |
26 | namespace MonoLibUsb.Descriptors
27 | {
28 | ///A collection of alternate settings for a particular USB interface.
29 | [StructLayout(LayoutKind.Sequential, Pack = MonoUsbApi.LIBUSB_PACK)]
30 | public class MonoUsbInterface
31 | {
32 | /// Array of interface descriptors. The length of this array is determined by the num_altsetting field.
33 | private IntPtr pAltSetting;
34 |
35 | /// The number of alternate settings that belong to this interface
36 | public readonly int num_altsetting;
37 |
38 |
39 | /// Array of interface descriptors. The length of this array is determined by the num_altsetting field.
40 | public List AltInterfaceList
41 | {
42 | get
43 | {
44 | List altInterfaceList = new List();
45 | int iAltInterface;
46 | for (iAltInterface = 0; iAltInterface < num_altsetting; iAltInterface++)
47 | {
48 | IntPtr pNextInterface = new IntPtr(pAltSetting.ToInt64() + (Marshal.SizeOf(typeof (MonoUsbAltInterfaceDescriptor))*iAltInterface));
49 | MonoUsbAltInterfaceDescriptor monoUSBAltInterfaceDescriptor = new MonoUsbAltInterfaceDescriptor();
50 | Marshal.PtrToStructure(pNextInterface, monoUSBAltInterfaceDescriptor);
51 |
52 | altInterfaceList.Add(monoUSBAltInterfaceDescriptor);
53 | }
54 |
55 | return altInterfaceList;
56 | }
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/MonoLibUsbApi.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/MonoLibUsbApi.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEndpointReader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEndpointReader.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEndpointWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEndpointWriter.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/MonoUsbError.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/MonoUsbError.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEventHandler.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/MonoUsbEventHandler.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/AddRemoveEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace MonoLibUsb.Profile
4 | {
5 | ///
6 | /// Describes a device arrival/removal notification event
7 | ///
8 | public class AddRemoveEventArgs : EventArgs
9 | {
10 | private readonly AddRemoveType mAddRemoveType;
11 | private readonly MonoUsbProfile mMonoUSBProfile;
12 |
13 | internal AddRemoveEventArgs(MonoUsbProfile monoUSBProfile, AddRemoveType addRemoveType)
14 | {
15 | mMonoUSBProfile = monoUSBProfile;
16 | mAddRemoveType = addRemoveType;
17 | }
18 | ///
19 | /// The that was added or removed.
20 | ///
21 | public MonoUsbProfile MonoUSBProfile
22 | {
23 | get { return mMonoUSBProfile; }
24 | }
25 |
26 | ///
27 | /// The type of event that occured.
28 | ///
29 | public AddRemoveType EventType
30 | {
31 | get { return mAddRemoveType; }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/AddRemoveType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/AddRemoveType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbConfigHandle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using LibUsbDotNet.Main;
4 | using MonoLibUsb.Descriptors;
5 |
6 | namespace MonoLibUsb.Profile
7 | {
8 | ///
9 | /// The class hold the internal pointer to a libusb .
10 | ///
11 | ///
12 | ///
13 | /// To acquire a use:
14 | ///
15 | ///
16 | ///
17 | ///
18 | ///
19 | ///
20 | /// To access configuration information see .
21 | ///
22 | ///
23 | public class MonoUsbConfigHandle:SafeContextHandle
24 | {
25 | private MonoUsbConfigHandle() : base(IntPtr.Zero,true) {}
26 |
27 | ///
28 | ///
29 | ///
30 | ///
31 | protected override bool ReleaseHandle()
32 | {
33 | if (!IsInvalid)
34 | {
35 | MonoUsbApi.FreeConfigDescriptor(handle);
36 | SetHandleAsInvalid();
37 | }
38 | return true;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfile.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfile.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileHandle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileHandle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileHandleEnumerator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileHandleEnumerator.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileList.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileList.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileListHandle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Profile/MonoUsbProfileListHandle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Profile/PollfdItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Runtime.InteropServices;
5 |
6 | namespace MonoLibUsb.Profile
7 | {
8 | ///
9 | /// File descriptor for polling. More..
10 | ///
11 | [StructLayout(LayoutKind.Sequential)]
12 | public class PollfdItem
13 | {
14 | internal PollfdItem(IntPtr pPollfd)
15 | {
16 | Marshal.PtrToStructure(pPollfd, this);
17 | }
18 | ///
19 | /// Numeric file descriptor.
20 | ///
21 | public readonly int fd;
22 |
23 | ///
24 | /// Event flags to poll for from poll.h.
25 | ///
26 | public readonly short events;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/Internal/libusb_control_setup.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using LibUsbDotNet.Main;
3 |
4 | namespace MonoLibUsb.Transfer.Internal
5 | {
6 | [StructLayout(LayoutKind.Sequential)]
7 | internal class libusb_control_setup
8 | {
9 |
10 | /** Request type. Bits 0:4 determine recipient, see
11 | * \ref libusb_request_recipient. Bits 5:6 determine type, see
12 | * \ref libusb_request_type. Bit 7 determines data transfer direction, see
13 | * \ref libusb_endpoint_direction.
14 | */
15 | public readonly byte bmRequestType;
16 |
17 | /** Request. If the type bits of bmRequestType are equal to
18 | * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD
19 | * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to
20 | * \ref libusb_standard_request. For other cases, use of this field is
21 | * application-specific. */
22 | public readonly byte bRequest;
23 |
24 | /** Value. Varies according to request */
25 | public readonly short wValue;
26 |
27 | /** Index. Varies according to request, typically used to pass an index
28 | * or offset */
29 | public readonly short wIndex;
30 |
31 | /** Number of bytes to transfer */
32 | public readonly short wLength;
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/Internal/libusb_iso_packet_descriptor.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace MonoLibUsb.Transfer.Internal
4 | {
5 | ///
6 | /// This class is never instantiated in .NET. Instead it is used as a template by the class.
7 | ///
8 | [StructLayout(LayoutKind.Sequential, Pack = MonoUsbApi.LIBUSB_PACK)]
9 | internal class libusb_iso_packet_descriptor
10 | {
11 | ///
12 | /// Length of data to request in this packet
13 | ///
14 | uint length;
15 |
16 | ///
17 | /// Amount of data that was actually transferred
18 | ///
19 | uint actual_length;
20 |
21 | ///
22 | /// Status code for this packet
23 | ///
24 | MonoUsbTansferStatus status;
25 |
26 | private libusb_iso_packet_descriptor() { }
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/Internal/libusb_transfer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Transfer/Internal/libusb_transfer.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbIsoPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using MonoLibUsb.Transfer.Internal;
4 |
5 | namespace MonoLibUsb.Transfer
6 | {
7 | ///
8 | /// Wraps an iso packet structure
9 | ///
10 | [StructLayout(LayoutKind.Sequential)]
11 | public class MonoUsbIsoPacket
12 | {
13 | private static readonly int OfsActualLength = Marshal.OffsetOf(typeof(libusb_iso_packet_descriptor), "actual_length").ToInt32();
14 | private static readonly int OfsLength = Marshal.OffsetOf(typeof(libusb_iso_packet_descriptor), "length").ToInt32();
15 | private static readonly int OfsStatus = Marshal.OffsetOf(typeof(libusb_iso_packet_descriptor), "status").ToInt32();
16 |
17 | private IntPtr mpMonoUsbIsoPacket = IntPtr.Zero;
18 |
19 | ///
20 | /// Creates a structure that wraps an iso packet.
21 | ///
22 | /// The pointer to the iso packet to wrap.
23 | public MonoUsbIsoPacket(IntPtr isoPacketPtr) { mpMonoUsbIsoPacket = isoPacketPtr; }
24 |
25 | ///
26 | /// Returns the location in memory of this iso packet.
27 | ///
28 | public IntPtr PtrIsoPacket
29 | {
30 | get { return mpMonoUsbIsoPacket; }
31 | }
32 | ///
33 | /// Amount of data that was actually transferred.
34 | ///
35 | public int ActualLength
36 | {
37 | get { return Marshal.ReadInt32(mpMonoUsbIsoPacket, OfsActualLength); }
38 | set { Marshal.WriteInt32(mpMonoUsbIsoPacket, OfsActualLength, value); }
39 | }
40 | ///
41 | /// Length of data to request in this packet.
42 | ///
43 | public int Length
44 | {
45 | get { return Marshal.ReadInt32(mpMonoUsbIsoPacket, OfsLength); }
46 | set { Marshal.WriteInt32(mpMonoUsbIsoPacket, OfsLength, value); }
47 | }
48 | ///
49 | /// Status code for this packet.
50 | ///
51 | public MonoUsbTansferStatus Status
52 | {
53 | get { return (MonoUsbTansferStatus)Marshal.ReadInt32(mpMonoUsbIsoPacket, OfsStatus); }
54 | set { Marshal.WriteInt32(mpMonoUsbIsoPacket, OfsStatus, (int)value); }
55 | }
56 |
57 | }
58 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTansferStatus.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTansferStatus.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransfer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransfer.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransferContext.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransferContext.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransferFlags.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/MonoLibUsb/Transfer/MonoUsbTransferFlags.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/MonoLibUsb/UnixNativeTimeval.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using LibUsbDotNet.Main;
4 |
5 | namespace MonoLibUsb
6 | {
7 | ///
8 | /// Unix mono.net timeval structure.
9 | ///
10 | [StructLayout(LayoutKind.Sequential)]
11 | public struct UnixNativeTimeval
12 | {
13 | private IntPtr mTvSecInternal;
14 | private IntPtr mTvUSecInternal;
15 |
16 | ///
17 | /// Default used by the on windows platforms.
18 | ///
19 | public static UnixNativeTimeval WindowsDefault
20 | {
21 | get { return new UnixNativeTimeval(2, 0); }
22 | }
23 |
24 | ///
25 | /// Default used by the on unix-like platforms.
26 | ///
27 | public static UnixNativeTimeval LinuxDefault
28 | {
29 | get { return new UnixNativeTimeval(2, 0); }
30 | }
31 |
32 | ///
33 | /// Default .
34 | ///
35 | public static UnixNativeTimeval Default
36 | {
37 | get { return Helper.IsLinux ? LinuxDefault : WindowsDefault; }
38 | }
39 |
40 | ///
41 | /// Timeval seconds property.
42 | ///
43 | public long tv_sec
44 | {
45 | get { return mTvSecInternal.ToInt64(); }
46 | set { mTvSecInternal = new IntPtr(value); }
47 | }
48 |
49 | ///
50 | /// Timeval milliseconds property.
51 | ///
52 | public long tv_usec
53 | {
54 | get { return mTvUSecInternal.ToInt64(); }
55 | set { mTvUSecInternal = new IntPtr(value); }
56 | }
57 |
58 | ///
59 | /// Timeval constructor.
60 | ///
61 | /// seconds
62 | /// milliseconds
63 | public UnixNativeTimeval(long tvSec, long tvUsec)
64 | {
65 | mTvSecInternal = new IntPtr(tvSec);
66 | mTvUSecInternal = new IntPtr(tvUsec);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2006-2010 Travis Robinson. All rights reserved.
2 | //
3 | // website: sourceforge.net/projects/libusbdotnet/
4 | // e-mail: libusbdotnet@gmail.com
5 | //
6 | // This program is free software; you can redistribute it and/or modify it
7 | // under the terms of the GNU General Public License as published by the
8 | // Free Software Foundation; either version 2 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful, but
12 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 | // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | // for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License along
17 | // with this program; if not, write to the Free Software Foundation, Inc.,
18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
19 | // visit www.gnu.org.
20 | //
21 | //
22 | using System;
23 | using System.Reflection;
24 | using System.Resources;
25 | using System.Runtime.InteropServices;
26 |
27 | // General Information about an assembly is controlled through the following
28 | // set of attributes. Change these attribute values to modify the information
29 | // associated with an assembly.
30 |
31 | [assembly: AssemblyTitle("LibUsbDotNet")]
32 | [assembly: AssemblyDescription("C# .NET API for USB device low-level USB device communications.")]
33 | [assembly: AssemblyConfiguration("")]
34 | [assembly: AssemblyCompany("Travis Robinson")]
35 | [assembly: AssemblyProduct("LibUsbDotNet")]
36 | [assembly: AssemblyCopyright("Copyright 2006-2010 Travis Robinson. All rights reserved.")]
37 | [assembly: AssemblyTrademark("")]
38 | [assembly: AssemblyCulture("")]
39 |
40 | // Setting ComVisible to false makes the types in this assembly not visible
41 | // to COM components. If you need to access a type in this assembly from
42 | // COM, set the ComVisible attribute to true on that type.
43 |
44 | [assembly: ComVisible(false)]
45 |
46 | // The following GUID is for the ID of the typelib if this project is exposed to COM
47 |
48 | [assembly: Guid("0729ae76-a75d-438c-9d72-4bd3bff7c700")]
49 |
50 | // Version information for an assembly consists of the following four values:
51 | //
52 | // Major Version
53 | // Minor Version
54 | // Build Number
55 | // Revision
56 | //
57 | // You can specify all the values or you can default the Revision and Build Numbers
58 | // by using the '*' as shown below:
59 |
60 | [assembly: AssemblyVersion("2.2.8.104")]
61 | [assembly: AssemblyFileVersion("2.2.8.104")]
62 | [assembly: CLSCompliant(true)]
63 | [assembly: NeutralResourcesLanguage("en-US")]
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/UsbDevice.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/UsbDevice.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/UsbEndpointReader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/UsbEndpointReader.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/UsbEndpointWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/UsbEndpointWriter.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/UsbGlobals.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/UsbGlobals.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/DeviceInformationTypes.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/DeviceInformationTypes.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/DeviceSpeedTypes.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/DeviceSpeedTypes.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/Internal/SafeWinUsbInterfaceHandle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/Internal/SafeWinUsbInterfaceHandle.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/Internal/WinUsbAPI.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/Internal/WinUsbAPI.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/PipeInformation.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/PipeInformation.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/PipePolicies.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/PipePolicies.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/PipePolicyType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/PipePolicyType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/PowerPolicies.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/PowerPolicies.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/PowerPolicyType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/PowerPolicyType.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/WinUsbDevice.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/WinUsbDevice.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/WinUsb/WinUsbRegistry.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/WinUsb/WinUsbRegistry.cs
--------------------------------------------------------------------------------
/libs/LibUsbDotNet/libusb-1.0.0.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/labnation/DeviceInterface/HEAD/libs/LibUsbDotNet/libusb-1.0.0.dylib
--------------------------------------------------------------------------------
/libs/common/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /obj/
3 | *.suo
4 | *.speccache
5 | *.sln
6 | *.csproj
7 |
--------------------------------------------------------------------------------
/libs/common/FileLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Threading;
7 | using System.Collections.Concurrent;
8 |
9 | namespace LabNation.Common
10 | {
11 |
12 | #if !ANDROID
13 | public class ConsoleLogger : FileLogger
14 | {
15 | //NOTE: the streamwrite is in fact not used by the parent class,
16 | // It writes immediately to the console (to use color)
17 | public ConsoleLogger(LogLevel level)
18 | : base(new StreamWriter(Console.OpenStandardOutput()), level)
19 | {
20 | this.useConsoleColor = true;
21 | }
22 | }
23 | #endif
24 | public class FileLogger
25 | {
26 | static List loggers = new List();
27 | StreamWriter writer;
28 | Thread dumpThread;
29 | ConcurrentQueue logQueue;
30 | bool running;
31 | LogLevel logLevel;
32 | #if !ANDROID
33 | protected bool useConsoleColor = false;
34 | ConsoleColor oldColor = Console.ForegroundColor;
35 | #endif
36 | public FileLogger(StreamWriter writer, LogLevel level)
37 | {
38 | this.logLevel = level;
39 | this.writer = writer;
40 | logQueue = new ConcurrentQueue();
41 | Logger.AddQueue(logQueue);
42 |
43 | dumpThread = new Thread(dumpThreadStart) { Name = "log dump thread" };
44 | running = true;
45 | dumpThread.Start();
46 | loggers.Add(this);
47 | }
48 |
49 |
50 |
51 | public FileLogger(string filename, LogLevel level) : this(
52 | new StreamWriter(new FileStream(Path.Combine(LabNation.Common.Utils.StoragePath, filename), FileMode.Append)),
53 | level
54 | )
55 | {
56 | Logger.Info("Started file logger in " + ((FileStream)this.writer.BaseStream).Name);
57 | }
58 |
59 | public static void StopAll()
60 | {
61 | foreach (FileLogger l in loggers)
62 | l.Stop();
63 | }
64 |
65 | public void Stop()
66 | {
67 | this.running = false;
68 | dumpThread.Join();
69 | }
70 |
71 | private void dumpThreadStart()
72 | {
73 | LogMessage previousEntry = new LogMessage(LogLevel.DEBUG, null, "\n");
74 | while (running || logQueue.Count > 0)
75 | {
76 | while (logQueue.Count > 0)
77 | {
78 | LogMessage entry;
79 | if (logQueue.TryDequeue(out entry))
80 | {
81 | if (entry.level > logLevel) continue;
82 | string message = "";
83 | //Don't print timestamp/origin if last message wasn't ended with newline
84 | if (previousEntry.end == "\n")
85 | message += entry.timestamp.ToString().PadRight(22) + entry.level.ToString().PadRight(6);
86 | message += entry.message + entry.end;
87 |
88 | previousEntry = entry;
89 | #if !IOS && !ANDROID
90 | if (useConsoleColor && entry.color.HasValue)
91 | {
92 | oldColor = Console.ForegroundColor;
93 | Console.ForegroundColor = entry.color.Value;
94 | Console.Write(message);
95 | Console.ForegroundColor = oldColor;
96 | }
97 | else
98 | #endif
99 | writer.Write(message);
100 | }
101 | }
102 | writer.Flush();
103 | Thread.Sleep(50);
104 | }
105 | writer.Flush();
106 | writer.Close();
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/libs/common/LinqExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LabNation.Common
7 | {
8 | public static class Extensions
9 | {
10 | public static double StdDev(this IEnumerable values)
11 | {
12 | // ref: http://warrenseen.com/blog/2006/03/13/how-to-calculate-standard-deviation/
13 | double mean = 0.0;
14 | double sum = 0.0;
15 | double stdDev = 0.0;
16 | int n = 0;
17 | foreach (double val in values)
18 | {
19 | n++;
20 | double delta = val - mean;
21 | mean += delta / n;
22 | sum += delta * (val - mean);
23 | }
24 | if (1 < n)
25 | stdDev = Math.Sqrt(sum / (n - 1));
26 |
27 | return stdDev;
28 | }
29 |
30 | public static float Median(this IEnumerable source)
31 | {
32 | int decimals = source.Count();
33 |
34 | int midpoint = (decimals - 1) / 2;
35 | IEnumerable sorted = source.OrderBy(n => n);
36 |
37 | float median = sorted.ElementAt(midpoint);
38 | if (decimals % 2 == 0)
39 | median = (median + sorted.ElementAt(midpoint + 1)) / 2;
40 |
41 | return median;
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/libs/common/Logger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Collections.Concurrent;
6 | using System.Threading;
7 | using System.Diagnostics;
8 | using System.Reflection;
9 |
10 | namespace LabNation.Common
11 | {
12 | public enum LogLevel{
13 | ERROR = 0,
14 | WARN = 10,
15 | INFO = 20,
16 | DEBUG = 30,
17 | }
18 | public class LogMessage
19 | {
20 | public DateTime timestamp = DateTime.Now;
21 | public LogLevel level { get; private set; }
22 | public string message { get; private set; }
23 | public string end;
24 | public ConsoleColor? color = null;
25 |
26 | public LogMessage(LogLevel l, string msg, ConsoleColor? color = null) : this(l, msg, "", color) { }
27 | public LogMessage(LogLevel l, string msg, string end = "\n", ConsoleColor? color = null)
28 | {
29 | this.message = msg;
30 | this.level = l;
31 | this.end = end;
32 | this.color = color;
33 | }
34 | }
35 | public class Logger
36 | {
37 | public delegate void logUpdateCallback();
38 | static List> logQueues = new List>();
39 |
40 | ///
41 | /// Log the origin of the messages using reflection
42 | ///
43 | public static bool LogOrigin = false;
44 |
45 | public static void AddQueue(ConcurrentQueue q)
46 | {
47 | logQueues.Add(q);
48 | }
49 | public static void LogC(LogLevel l, string msg, ConsoleColor? color = null)
50 | {
51 | Log(l, msg, "", color);
52 | }
53 | public static void Log(LogLevel l, string msg, string end = "\n", ConsoleColor? color = null )
54 | {
55 | foreach(string msg_part in msg.Split('\n'))
56 | foreach(var q in logQueues)
57 | q.Enqueue(new LogMessage(l, msg_part, end, color));
58 | }
59 | public static void Info(string text) { Log(LogLevel.INFO, text); }
60 | public static void Info(string format, params object[] args) { Info (String.Format (format, args)); }
61 | public static void Debug(string text) { Log(LogLevel.DEBUG, text); }
62 | public static void Debug(string format, params object[] args) { Debug (String.Format (format, args)); }
63 | public static void Warn(string text) { Log(LogLevel.WARN, text); }
64 | public static void Warn(string format, params object[] args) { Warn (String.Format (format, args)); }
65 | public static void Error(string text) { Log(LogLevel.ERROR, text); }
66 | public static void Error(string format, params object[] args) { Error (String.Format (format, args)); }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/libs/common/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("LabNation.Common")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("LabNation")]
12 | [assembly: AssemblyProduct("Common")]
13 | [assembly: AssemblyCopyright("Copyright © 2015 LabNation")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0cba0541-687e-498d-8557-8d4b9031da40")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/libs/common/Trendline.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LabNation.Common
7 | {
8 | public class Trendline
9 | {
10 | private readonly IList xAxisValues;
11 | private readonly IList yAxisValues;
12 | private int count;
13 | private double xAxisValuesSum;
14 | private double xxSum;
15 | private double xySum;
16 | private double yAxisValuesSum;
17 |
18 | public Trendline(IList yAxisValues, IList xAxisValues)
19 | {
20 | this.yAxisValues = yAxisValues;
21 | this.xAxisValues = xAxisValues;
22 |
23 | this.Initialize();
24 | }
25 |
26 | public double Slope { get; private set; }
27 | public double Intercept { get; private set; }
28 | public double Start { get; private set; }
29 | public double End { get; private set; }
30 |
31 | private void Initialize()
32 | {
33 | this.count = this.yAxisValues.Count;
34 | this.yAxisValuesSum = this.yAxisValues.Sum();
35 | this.xAxisValuesSum = this.xAxisValues.Sum();
36 | this.xxSum = 0;
37 | this.xySum = 0;
38 |
39 | for (int i = 0; i < this.count; i++)
40 | {
41 | this.xySum += (this.xAxisValues[i] * this.yAxisValues[i]);
42 | this.xxSum += (this.xAxisValues[i] * this.xAxisValues[i]);
43 | }
44 |
45 | this.Slope = this.CalculateSlope();
46 | this.Intercept = this.CalculateIntercept();
47 | this.Start = this.CalculateStart();
48 | this.End = this.CalculateEnd();
49 | }
50 |
51 | private double CalculateSlope()
52 | {
53 | try
54 | {
55 | return ((this.count * this.xySum) - (this.xAxisValuesSum * this.yAxisValuesSum)) / ((this.count * this.xxSum) - (this.xAxisValuesSum * this.xAxisValuesSum));
56 | }
57 | catch (DivideByZeroException)
58 | {
59 | return 0;
60 | }
61 | }
62 |
63 | private double CalculateIntercept()
64 | {
65 | return (this.yAxisValuesSum - (this.Slope * this.xAxisValuesSum)) / this.count;
66 | }
67 |
68 | private double CalculateStart()
69 | {
70 | return (this.Slope * this.xAxisValues.First()) + this.Intercept;
71 | }
72 |
73 | private double CalculateEnd()
74 | {
75 | return (this.Slope * this.xAxisValues.Last()) + this.Intercept;
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/libs/matlab/.gitignore:
--------------------------------------------------------------------------------
1 | /obj/
2 | /bin/
3 | /*.suo
4 | /.DS_Store
5 | *.speccache
6 | *.sln
7 | *.csproj
8 | /packages/
--------------------------------------------------------------------------------
/libs/matlab/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("MatlabFileIO")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("LabNation")]
12 | [assembly: AssemblyProduct("MatlabFileIO")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("ed416506-787a-4ea8-9dfe-bfaed5e93a3e")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/libs/matlab/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/libs/winusb/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 | !WinUSBNet/WinUSBNet.csproj
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.log
79 | *.scc
80 |
81 | # Visual C++ cache files
82 | ipch/
83 | *.aps
84 | *.ncb
85 | *.opensdf
86 | *.sdf
87 | *.cachefile
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | *.ncrunch*
109 | .*crunch*.local.xml
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.Publish.xml
129 | *.pubxml
130 |
131 | # NuGet Packages Directory
132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133 | #packages/
134 |
135 | # Windows Azure Build Output
136 | csx
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.[Pp]ublish.xml
151 | *.pfx
152 | *.publishsettings
153 |
154 | # RIA/Silverlight projects
155 | Generated_Code/
156 |
157 | # Backup & report files from converting an old project file to a newer
158 | # Visual Studio version. Backup files are not needed, because we have git ;-)
159 | _UpgradeReport_Files/
160 | Backup*/
161 | UpgradeLog*.XML
162 | UpgradeLog*.htm
163 |
164 | # SQL Server files
165 | App_Data/*.mdf
166 | App_Data/*.ldf
167 |
168 | #############
169 | ## Windows detritus
170 | #############
171 |
172 | # Windows image file caches
173 | Thumbs.db
174 | ehthumbs.db
175 |
176 | # Folder config file
177 | Desktop.ini
178 |
179 | # Recycle Bin used on file shares
180 | $RECYCLE.BIN/
181 |
182 | # Mac crap
183 | .DS_Store
184 |
185 |
186 | #############
187 | ## Python
188 | #############
189 |
190 | *.py[co]
191 |
192 | # Packages
193 | *.egg
194 | *.egg-info
195 | dist/
196 | build/
197 | eggs/
198 | parts/
199 | var/
200 | sdist/
201 | develop-eggs/
202 | .installed.cfg
203 |
204 | # Installer logs
205 | pip-log.txt
206 |
207 | # Unit test / coverage reports
208 | .coverage
209 | .tox
210 |
211 | #Translations
212 | *.mo
213 |
214 | #Mr Developer
215 | .mr.developer.cfg
216 |
217 | #MonoDevelop
218 | *.pidb
219 | *.userprefs
220 |
221 | #VS Code
222 | .vscode/
223 |
--------------------------------------------------------------------------------
/libs/winusb/Changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## 1.0.2
4 |
5 | * Proper use of language ID in string descriptors (issue #8, pr #14)
6 | * Device notification handle bugfix (issue #9)
7 | * Bugfix in GetDescriptor marshall (issue #4)
8 |
9 | ## 1.0.1 (2012-03-28)
10 |
11 | * Bugfix in USBPipe write (issue #3)
12 |
13 | ## 1.0.0 (2010-09-05)
14 |
15 | * Stable release
16 |
17 | ## 0.9.1 beta (2010-01-17)
18 |
19 | * Bugfixes
20 |
21 | ## 0.9.0 beta (2010-01-13)
22 |
23 | * First public beta release
24 |
25 |
26 |
--------------------------------------------------------------------------------
/libs/winusb/HelpProject/WinUSBNet.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 | Debug
7 | AnyCPU
8 | 2.0
9 | {48421796-a4bf-4d98-9236-6fb0f5a98115}
10 | 2015.6.5.0
11 |
12 | Documentation
13 | Documentation
14 | Documentation
15 |
16 | .NET Framework 3.5
17 | Output\
18 | WinUSBNet
19 | en-US
20 | OnlyWarningsAndErrors
21 | HtmlHelp1, Website
22 | False
23 | True
24 | False
25 | True
26 |
27 |
28 |
29 | 1.0.1
30 | 2
31 | False
32 | C#, Visual Basic, Managed C++
33 | Blank
34 | False
35 | VS2013
36 | False
37 | Guid
38 | WinUSBNet Reference
39 | %28C%29 2010 - 2016 Thomas Bleeker %28MadWizard.org%29
40 | http://www.madwizard.org/
41 | AboveNamespaces
42 | Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose
43 |
44 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
66 |
67 |
68 |
69 |
70 |
71 | OnBuildSuccess
72 |
73 |
--------------------------------------------------------------------------------
/libs/winusb/HelpProject/cleanweb.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | del Output\*.aspx
3 | del Output\*.php
4 | del Output\*.Config
5 | rmdir /S /Q Output\fti
6 | del Output\*.log
7 | pause
--------------------------------------------------------------------------------
/libs/winusb/README.md:
--------------------------------------------------------------------------------
1 | # WinUSBNet
2 |
3 | WinUSBNet is a .NET class library that provides easy access to the WinUSB API from C#, VB.NET and other .NET languages. WinUSB is a user mode API available for Windows XP, Vista and 7 (XP will require an update), allowing low level access to USB devices such as control transfers and reading from and writing to endpoints.
4 |
5 | Please note that there is at least one different project with the same name (at codeplex), this libary is not related.
6 |
7 | ## Download
8 |
9 | [Download latest release](https://github.com/madwizard-thomas/winusbnet/releases/latest)
10 |
11 | ## Status
12 |
13 | The library is *stable*. If you find any bugs or problems please report them using the issue tracker or add a pull request if you have fixed something yourself.
14 |
15 | ## Features
16 |
17 | * MIT licensed with C# source code available (free for both personal and commercial use)
18 | * CLS compliant library (usable from all .NET languages such as C#, VB.NET and C++.NET)
19 | * Synchronous and asynchronous data transfers
20 | * Support for 32-bit and 64-bit Windows versions
21 | * Notification events for device attachment and removal
22 | * Support for multiple interfaces and endpoints
23 | * Intellisense documentation
24 |
25 | ## Related documentation
26 | * [Library reference online](http://madwizard-thomas.github.io/winusbnet/docs/)
27 | * [Online wiki with short howto](https://github.com/madwizard-thomas/winusbnet/wiki)
28 | * [Changelog](Changelog.md)
29 | * [WinUSB overview](https://msdn.microsoft.com/en-us/library/ff540196.aspx)
30 | * [How to Use WinUSB to Communicate with a USB Device](http://www.microsoft.com/whdc/connect/usb/winusb_howto.mspx)
31 | * [Jan Axelson's page on WinUSB](http://janaxelson.com/winusb.htm)
32 |
33 | ## Migration from google code
34 |
35 | This project was previously available at google code (code.google.com/p/winusbnet/). This github repository is now the official repository for WinUSBNet.
36 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/API/APIException.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Text;
11 | using System.Runtime;
12 | using System.Runtime.InteropServices;
13 | using System.ComponentModel;
14 |
15 |
16 | namespace MadWizard.WinUSBNet.API
17 | {
18 | ///
19 | /// Exception used internally to catch Win32 API errors. This exception should
20 | /// not be thrown to the library's caller.
21 | ///
22 | internal class APIException : Exception
23 | {
24 | public APIException(string message) :
25 | base(message)
26 | {
27 |
28 | }
29 | public APIException(string message, Exception innerException) : base(message, innerException)
30 | {
31 | }
32 |
33 | public static APIException Win32(string message)
34 | {
35 | return APIException.Win32(message, Marshal.GetLastWin32Error());
36 | }
37 |
38 | public static APIException Win32(string message, int errorCode)
39 | {
40 | return new APIException(message, new Win32Exception(errorCode));
41 |
42 | }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/API/DeviceDetails.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 |
13 | namespace MadWizard.WinUSBNet.API
14 | {
15 | internal struct DeviceDetails
16 | {
17 | public string DevicePath;
18 | public string Manufacturer;
19 | public string DeviceDescription;
20 | public ushort VID;
21 | public ushort PID;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/API/FileAPI.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | /* NOTE: Parts of the code in this file are based on the work of Jan Axelson
9 | * See http://www.lvr.com/winusb.htm for more information
10 | */
11 |
12 | using System;
13 | using Microsoft.Win32.SafeHandles;
14 | using System.Runtime.InteropServices;
15 |
16 | namespace MadWizard.WinUSBNet.API
17 | {
18 | ///
19 | /// API declarations relating to file I/O (and used by WinUsb).
20 | ///
21 |
22 | sealed internal class FileIO
23 | {
24 | public const Int32 FILE_ATTRIBUTE_NORMAL = 0X80;
25 | public const Int32 FILE_FLAG_OVERLAPPED = 0X40000000;
26 | public const Int32 FILE_SHARE_READ = 1;
27 | public const Int32 FILE_SHARE_WRITE = 2;
28 | public const UInt32 GENERIC_READ = 0X80000000;
29 | public const UInt32 GENERIC_WRITE = 0X40000000;
30 | public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
31 | public const Int32 OPEN_EXISTING = 3;
32 |
33 | public const Int32 ERROR_IO_PENDING = 997;
34 |
35 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
36 | public static extern SafeFileHandle CreateFile(String lpFileName, UInt32 dwDesiredAccess, Int32 dwShareMode, IntPtr lpSecurityAttributes, Int32 dwCreationDisposition, Int32 dwFlagsAndAttributes, Int32 hTemplateFile);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/DeviceNotifyHook.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 | using System.Windows.Forms;
13 |
14 | namespace MadWizard.WinUSBNet
15 | {
16 | internal class DeviceNotifyHook : NativeWindow, IDisposable
17 | {
18 | // http://msdn.microsoft.com/en-us/library/system.windows.forms.nativewindow.aspx
19 |
20 | // TODO: disposed exception when disposed
21 |
22 | private Control _parent;
23 | private USBNotifier _notifier;
24 | private Guid _guid;
25 | private IntPtr _notifyHandle;
26 |
27 | public DeviceNotifyHook(USBNotifier notifier, Control parent, Guid guid)
28 | {
29 | _parent = parent;
30 | _guid = guid;
31 | _parent.HandleCreated += new EventHandler(this.OnHandleCreated);
32 | _parent.HandleDestroyed += new EventHandler(this.OnHandleDestroyed);
33 | _notifier = notifier;
34 | }
35 |
36 | ~DeviceNotifyHook()
37 | {
38 | Dispose(false);
39 | }
40 |
41 | // Listen for the control's window creation and then hook into it.
42 | internal void OnHandleCreated(object sender, EventArgs e)
43 | {
44 | try
45 | {
46 | // Window is now created, assign handle to NativeWindow.
47 | IntPtr handle = ((Control)sender).Handle;
48 | AssignHandle(handle);
49 |
50 | if (_notifyHandle != IntPtr.Zero)
51 | {
52 | API.DeviceManagement.StopDeviceDeviceNotifications(_notifyHandle);
53 | _notifyHandle = IntPtr.Zero;
54 | }
55 | API.DeviceManagement.RegisterForDeviceNotifications(handle, _guid, ref _notifyHandle);
56 | }
57 | catch (API.APIException ex)
58 | {
59 | throw new USBException("Failed to register new window handle for device notification.", ex);
60 | }
61 | }
62 |
63 | internal void OnHandleDestroyed(object sender, EventArgs e)
64 | {
65 | try
66 | {
67 | // Window was destroyed, release hook.
68 | ReleaseHandle();
69 | if (_notifyHandle != IntPtr.Zero)
70 | {
71 | API.DeviceManagement.StopDeviceDeviceNotifications(_notifyHandle);
72 | _notifyHandle = IntPtr.Zero;
73 | }
74 | }
75 | catch (API.APIException ex)
76 | {
77 | throw new USBException("Failed to unregister destroyed window handle for device notification.", ex);
78 | }
79 | }
80 |
81 |
82 | protected override void WndProc(ref Message m)
83 | {
84 | // Listen for operating system messages
85 |
86 | switch (m.Msg)
87 | {
88 | case API.DeviceManagement.WM_DEVICECHANGE:
89 | _notifier.HandleDeviceChange(m);
90 | break;
91 | }
92 | base.WndProc(ref m);
93 | }
94 |
95 | public void Dispose()
96 | {
97 | Dispose(true);
98 | GC.SuppressFinalize(this);
99 | }
100 |
101 | protected virtual void Dispose(bool disposing)
102 | {
103 | if (disposing)
104 | {
105 | // clean managed resources
106 |
107 | // do not clean the notifier here. the notifier owns and will dispose this object.
108 | }
109 | if (_notifyHandle != IntPtr.Zero)
110 | {
111 | API.DeviceManagement.StopDeviceDeviceNotifications(_notifyHandle);
112 | _notifyHandle = IntPtr.Zero;
113 | }
114 | }
115 |
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("WinUSBNet")]
10 | [assembly: AssemblyDescription("WinUSBNet")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Madwizard.org")]
13 | [assembly: AssemblyProduct("WinUSBNet")]
14 | [assembly: AssemblyCopyright("Copyright © 2010 - 2016 by Thomas Bleeker")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | [assembly: CLSCompliant(true)]
24 |
25 | // The following GUID is for the ID of the typelib if this project is exposed to COM
26 | [assembly: Guid("db6dbfa4-6b58-4f6e-9618-c9b2d57c9222")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | // You can specify all the values or you can default the Build and Revision Numbers
36 | // by using the '*' as shown below:
37 | // [assembly: AssemblyVersion("1.0.*")]
38 | [assembly: AssemblyVersion("1.0.2.0")]
39 | [assembly: AssemblyFileVersion("1.0.2.0")]
40 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/USB.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 |
10 |
11 | namespace MadWizard.WinUSBNet
12 | {
13 | ///
14 | /// USB base class code enumeration, as defined in the USB specification
15 | ///
16 | public enum USBBaseClass
17 | {
18 | /// Unknown non-zero class code. Used when the actual class code
19 | /// does not match any of the ones defined in this enumeration.
20 | Unknown = -1,
21 |
22 | /// Base class defined elsewhere (0x00)
23 | None = 0x00,
24 |
25 | /// Audio base class (0x01)
26 | Audio = 0x01,
27 |
28 | /// Communications and CDC control base class (0x02)
29 | CommCDC = 0x02,
30 |
31 | /// HID base class (0x03)
32 | HID = 0x03,
33 |
34 | /// Physical base class (0x05)
35 | Physical = 0x05,
36 |
37 | /// Image base class (0x06)
38 | Image = 0x06,
39 |
40 | /// Printer base class (0x07)
41 | Printer = 0x07,
42 |
43 | /// Mass storage base class (0x08)
44 | MassStorage = 0x08,
45 |
46 | /// Hub base class (0x09)
47 | Hub = 0x09,
48 |
49 | /// CDC data base class (0x0A)
50 | CDCData = 0x0A,
51 |
52 | /// Smart card base class (0x0B)
53 | SmartCard = 0x0B,
54 |
55 | /// Content security base class (0x0D)
56 | ContentSecurity = 0x0D,
57 |
58 | /// Video base class (0x0E)
59 | Video = 0x0E,
60 |
61 | /// Personal healthcare base class (0x0F)
62 | PersonalHealthcare = 0x0F,
63 |
64 | /// Diagnosticdevice base class (0xDC)
65 | DiagnosticDevice = 0xDC,
66 |
67 | /// Wireless controller base class (0xE0)
68 | WirelessController = 0xE0,
69 |
70 | /// Miscellaneous base class (0xEF)
71 | Miscellaneous = 0xEF,
72 |
73 | /// Application specific base class (0xFE)
74 | ApplicationSpecific = 0xFE,
75 |
76 | /// Vendor specific base class (0xFF)
77 | VendorSpecific = 0xFF,
78 | };
79 |
80 | }
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/USBAsyncResult.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 | using System.Threading;
13 | namespace MadWizard.WinUSBNet
14 | {
15 | public class USBAsyncResult : IAsyncResult, IDisposable
16 | {
17 | private object _stateObject;
18 | private AsyncCallback _userCallback;
19 | private bool _completed;
20 | private bool _completedSynchronously;
21 | private ManualResetEvent _waitEvent;
22 | private int _bytesTransfered;
23 | private Exception _error;
24 |
25 | public USBAsyncResult(AsyncCallback userCallback, object stateObject)
26 | {
27 | _stateObject = stateObject;
28 | _userCallback = userCallback;
29 | _completedSynchronously = false;
30 | _completed = false;
31 | _waitEvent = null;
32 | }
33 |
34 | public object AsyncState
35 | {
36 | get
37 | {
38 | return _stateObject;
39 | }
40 | }
41 |
42 | public Exception Error
43 | {
44 | get
45 | {
46 | lock (this)
47 | {
48 | return _error;
49 | }
50 | }
51 | }
52 | public int BytesTransfered
53 | {
54 | get { return _bytesTransfered; }
55 | }
56 | public WaitHandle AsyncWaitHandle
57 | {
58 | get
59 | {
60 | lock (this)
61 | {
62 | if (_waitEvent == null)
63 | _waitEvent = new ManualResetEvent(_completed);
64 | }
65 | return _waitEvent;
66 | }
67 | }
68 |
69 | public bool CompletedSynchronously
70 | {
71 | get
72 | {
73 | lock (this)
74 | {
75 | return _completedSynchronously;
76 | }
77 | }
78 | }
79 |
80 | public bool IsCompleted
81 | {
82 | get
83 | {
84 | lock (this)
85 | {
86 | return _completed;
87 | }
88 | }
89 | }
90 |
91 | public void Dispose()
92 | {
93 | Dispose(true);
94 | GC.SuppressFinalize(this);
95 | }
96 |
97 | public void OnCompletion(bool completedSynchronously, Exception error, int bytesTransfered, bool synchronousCallback)
98 | {
99 | lock (this)
100 | {
101 | _completedSynchronously = completedSynchronously;
102 | _completed = true;
103 | _error = error;
104 | _bytesTransfered = bytesTransfered;
105 | if (_waitEvent != null)
106 | try
107 | {
108 | _waitEvent.Set();
109 | } catch
110 | {
111 |
112 | }
113 |
114 | }
115 | if (_userCallback != null)
116 | {
117 | if (synchronousCallback)
118 | RunCallback(null);
119 | else
120 | ThreadPool.QueueUserWorkItem(RunCallback);
121 | }
122 |
123 | }
124 | private void RunCallback(object state)
125 | {
126 | _userCallback(this);
127 | }
128 | protected virtual void Dispose(bool disposing)
129 | {
130 | if (disposing)
131 | {
132 | // Cleanup managed resources
133 | lock (this)
134 | {
135 | if (_waitEvent != null)
136 | _waitEvent.Close();
137 | }
138 | }
139 | }
140 |
141 |
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/USBDeviceInfo.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Linq;
11 | using System.Text;
12 |
13 | namespace MadWizard.WinUSBNet
14 | {
15 | ///
16 | /// Gives information about a device. This information is retrieved using the setup API, not the
17 | /// actual device descriptor. Device description and manufacturer will be the strings specified
18 | /// in the .inf file. After a device is opened the actual device descriptor can be read as well.
19 | ///
20 | public class USBDeviceInfo
21 | {
22 | private API.DeviceDetails _details;
23 |
24 | ///
25 | /// Vendor ID (VID) of the USB device
26 | ///
27 | public int VID
28 | {
29 | get
30 | {
31 | return _details.VID;
32 | }
33 | }
34 |
35 | ///
36 | /// Product ID (VID) of the USB device
37 | ///
38 | public int PID
39 | {
40 | get
41 | {
42 | return _details.PID;
43 | }
44 | }
45 |
46 | ///
47 | /// Manufacturer of the device, as specified in the INF file (not the device descriptor)
48 | ///
49 | public string Manufacturer
50 | {
51 | get
52 | {
53 | return _details.Manufacturer;
54 | }
55 | }
56 |
57 | ///
58 | /// Description of the device, as specified in the INF file (not the device descriptor)
59 | ///
60 | public string DeviceDescription
61 | {
62 | get
63 | {
64 | return _details.DeviceDescription;
65 | }
66 | }
67 |
68 | ///
69 | /// Device pathname
70 | ///
71 | public string DevicePath
72 | {
73 | get
74 | {
75 | return _details.DevicePath;
76 | }
77 | }
78 |
79 | internal USBDeviceInfo(API.DeviceDetails details)
80 | {
81 | _details = details;
82 | }
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/libs/winusb/WinUSBNet/USBException.cs:
--------------------------------------------------------------------------------
1 | /* WinUSBNet library
2 | * (C) 2010 Thomas Bleeker (www.madwizard.org)
3 | *
4 | * Licensed under the MIT license, see license.txt or:
5 | * http://www.opensource.org/licenses/mit-license.php
6 | */
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Text;
11 |
12 | namespace MadWizard.WinUSBNet
13 | {
14 | ///
15 | /// Exception used by WinUSBNet to indicate errors. This is the
16 | /// main exception to catch when using the library.
17 | ///
18 | public class USBException : Exception
19 | {
20 | ///
21 | /// Constructs a new USBException with the given message
22 | ///
23 | /// The message describing the exception
24 | public USBException(string message)
25 | : base(message)
26 | {
27 | }
28 |
29 | ///
30 | /// Constructs a new USBException with the given message and underlying exception
31 | /// that caused the USBException.
32 | ///
33 | /// The message describing the exception
34 | /// The underlying exception causing the USBException
35 | public USBException(string message, Exception innerException)
36 | : base(message, innerException)
37 | {
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/libs/winusb/license.txt:
--------------------------------------------------------------------------------
1 | WinUSBNet is licensed under the MIT license
2 | http://www.opensource.org/licenses/mit-license.php
3 |
4 | -----
5 |
6 | Copyright (c) 2010 Thomas Bleeker (www.madwizard.org)
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
--------------------------------------------------------------------------------
/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/script/fetch_last_fpga_bitstreams.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | BASE_URI="http://10.8.0.1/fpga_bitstreams/"
3 | VERSIONS_TO_FETCH=( A10 A12 A14 A15 A16 A17 )
4 | SCRIPT_PATH=`pwd`/`dirname $0`
5 | BITSTREAM_PATH=${SCRIPT_PATH}/../src
6 | BITSTREAM_FILE_PREFIX="SmartScope_"
7 | BITSTREAM_FILE_SUFFIX=".bin"
8 |
9 | for i in "${VERSIONS_TO_FETCH[@]}"; do
10 | BITSTREAM_FILENAME="${BITSTREAM_FILE_PREFIX}${i}${BITSTREAM_FILE_SUFFIX}"
11 | BITSTREAM_URI="${BASE_URI}${i}/${BITSTREAM_FILENAME}"
12 | echo Fetching ${BITSTREAM_URI} TO ${BITSTREAM_FILENAME}
13 | curl ${BITSTREAM_URI} -# -o ${BITSTREAM_PATH}/${BITSTREAM_FILENAME}
14 | done
15 |
--------------------------------------------------------------------------------
/src/Devices/.gitignore:
--------------------------------------------------------------------------------
1 | *.cs
2 |
--------------------------------------------------------------------------------
/src/Devices/DummyScopeFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using MatlabFileIO;
6 | using System.IO;
7 | using LabNation.Common;
8 |
9 | namespace LabNation.DeviceInterface.Devices
10 | {
11 | partial class DummyScope
12 | {/*
13 | private static Dictionary readChannel = null;
14 | private static double[] readTime = null;
15 | private static double samplePeriodOriginal = 0;
16 |
17 | public static float[] GetWaveFromFile(AnalogChannel channel, uint waveLength, double samplePeriod, double timeOffset)
18 | {
19 | if(readChannel == null || readTime == null)
20 | {
21 | String filename = Path.GetTempFileName();
22 | FileStream f = new FileStream(filename, FileMode.Create, FileAccess.Write);
23 | byte[] i2cSequence = Resources.Load ("blobs.i2c_sequence.mat");
24 | f.Write(i2cSequence, 0, i2cSequence.Length);
25 | f.Close();
26 |
27 | MatfileReader matfileReader = new MatlabFileIO.MatfileReader(filename);
28 | readChannel = new Dictionary() {
29 | { AnalogChannel.ChA, Utils.CastArray(matfileReader.Variables["chA"].data as double[]) },
30 | { AnalogChannel.ChB, Utils.CastArray(matfileReader.Variables["chB"].data as double[]) },
31 | };
32 | readTime = matfileReader.Variables["time"].data as double[];
33 | samplePeriodOriginal = readTime[1] - readTime[0];
34 | matfileReader.Close();
35 | }
36 |
37 | if (samplePeriod / samplePeriodOriginal % 1.0 != 0.0)
38 | throw new Exception("Data from file doesn't suit the dummy scope sampling frequency");
39 |
40 | uint decimation = (uint)Math.Ceiling(samplePeriod / samplePeriodOriginal);
41 | float[] wave = Utils.DecimateArray(readChannel[channel], decimation);
42 |
43 | int requiredRepetitions = (int)Math.Ceiling(waveLength / (double)wave.Length);
44 | if (requiredRepetitions > 1)
45 | {
46 | List concat = new List();
47 | for(int i = 0; i < requiredRepetitions; i++)
48 | concat.AddRange(wave);
49 | wave = concat.Take((int)waveLength).ToArray();
50 | }
51 | return wave;
52 | }*/
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Devices/IDevice.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | #if DEBUG
6 | using LabNation.DeviceInterface.Memories;
7 | #endif
8 | using LabNation.DeviceInterface.Hardware;
9 |
10 |
11 | namespace LabNation.DeviceInterface.Devices
12 | {
13 | public delegate void DeviceConnectHandler(IDevice device, bool connected);
14 |
15 | public interface IDevice
16 | {
17 | bool Ready { get; }
18 | string Serial { get; }
19 | #if DEBUG
20 | List GetMemories();
21 | #endif
22 | IHardwareInterface HardwareInterface { get; }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Devices/IWaveGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LabNation.DeviceInterface.Devices
7 | {
8 | public interface IWaveGenerator : IDevice
9 | {
10 | bool DataOutOfRange { get; }
11 | double[] GeneratorDataDouble { set; }
12 | int[] GeneratorDataInt { set; }
13 | byte[] GeneratorDataByte { set; }
14 | bool GeneratorToAnalogEnabled { set; get; }
15 | bool GeneratorToDigitalEnabled { set; get; }
16 | Int32 GeneratorStretcherForFrequency(double frequency);
17 | int GeneratorNumberOfSamplesForFrequency(double frequency);
18 | int GeneratorNumberOfSamples { set; get; }
19 | Int32 GeneratorStretching { set; get; }
20 | double GeneratorFrequencyMax { get; }
21 | double GeneratorFrequencyMin { get; }
22 | double GeneratorFrequency { get; set; }
23 | double GeneratorSamplePeriodMin { get; }
24 | double GeneratorSamplePeriodMax { get; }
25 | double GeneratorSamplePeriod { set; get; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Devices/IWifiBridge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using LabNation.DeviceInterface.Hardware;
6 |
7 | namespace LabNation.DeviceInterface.Devices
8 | {
9 | [Flags]
10 | public enum ApCapabilities
11 | {
12 | //From iw source:scan.c https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git
13 | ESS = 1 << 0,
14 | IBSS = 1 << 1,
15 | CF_POLLABLE = 1 << 2,
16 | CF_POLL_REQUEST = 1 << 3,
17 | PRIVACY = 1 << 4,
18 | SHORT_PREAMBLE = 1 << 5,
19 | PBCC = 1 << 6,
20 | CHANNEL_AGILITY = 1 << 7,
21 | SPECTRUM_MGMT = 1 << 8,
22 | QOS = 1 << 9,
23 | SHORT_SLOT_TIME = 1 << 10,
24 | APSD = 1 << 11,
25 | RADIO_MEASURE = 1 << 12,
26 | DSSS_OFDM = 1 << 13,
27 | DEL_BACK = 1 << 14,
28 | IMM_BACK = 1 << 15,
29 | }
30 | public struct AccessPointInfo
31 | {
32 | public string SSID;
33 | public string BSSID;
34 | public int Strength;
35 | public ApCapabilities capabilities;
36 | public bool TKIP;
37 | public bool CCMP;
38 | public string Authentication;
39 | }
40 |
41 | public interface IWifiBridge : IHardwareInterface
42 | {
43 | Version Version { get; }
44 | String Info { get; }
45 | List GetAccessPoints();
46 | void SetAccessPoint(string ssid, string bssid, string enc, string key);
47 | void Reset();
48 | void Reboot();
49 | void SetDefaultAccessPoint();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Hardware/IHardwareInterface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace LabNation.DeviceInterface.Hardware
8 | {
9 | public interface IHardwareInterface
10 | {
11 | string Serial { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Hardware/ISmartScopeHardwareUsb.cs:
--------------------------------------------------------------------------------
1 | using LabNation.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 |
8 | namespace LabNation.DeviceInterface.Hardware
9 | {
10 | public interface ISmartScopeHardwareUsb : IHardwareInterface
11 | {
12 | void WriteControlBytes(byte[] message, bool async);
13 | void WriteControlBytesBulk(byte[] message, bool async);
14 | void WriteControlBytesBulk(byte[] message, int offset, int length, bool async);
15 | void ReadControlBytes(byte[] buffer, int offset, int length);
16 |
17 | void GetData(byte[] buffer, int offset, int length);
18 |
19 | bool Destroyed { get; }
20 | void Destroy();
21 | void FlushDataPipe();
22 | }
23 |
24 | [FlagsAttribute]
25 | public enum HeaderFlags : byte
26 | {
27 | None = 0,
28 | Acquiring = 1,
29 | IsOverview = 2,
30 | IsLastAcquisition = 4,
31 | Rolling = 8,
32 | TimedOut = 16,
33 | AwaitingTrigger = 32,
34 | Armded = 64,
35 | IsFullAcqusition = 128,
36 | }
37 |
38 | [StructLayout(LayoutKind.Explicit, Size = Constants.SZ_HDR, Pack = 1)]
39 | unsafe public struct SmartScopeHeader
40 | {
41 | [FieldOffset(0)]
42 | public fixed byte magic[2];
43 | [FieldOffset(2)]
44 | public byte header_offset;
45 | [FieldOffset(3)]
46 | public byte bytes_per_burst;
47 | [FieldOffset(4)]
48 | public ushort n_bursts;
49 | [FieldOffset(6)]
50 | public ushort offset;
51 | [FieldOffset(10)]
52 | public HeaderFlags flags;
53 | [FieldOffset(11)]
54 | public byte acquisition_id;
55 | [FieldOffset(Constants.HDR_OFFSET)]
56 | public fixed byte regs[Constants.N_HDR_REGS];
57 | [FieldOffset(Constants.HDR_OFFSET + Constants.N_HDR_REGS)]
58 | public fixed byte strobes[(Constants.N_HDR_STROBES + 7) / 8];
59 | }
60 |
61 | public static class ISmartScopeHardwareUsbHelpers
62 | {
63 | public static unsafe bool IsValid(this SmartScopeHeader hdr)
64 | {
65 | return hdr.magic[0] == 'L' && hdr.magic[1] == 'N';
66 | }
67 |
68 | public static unsafe byte GetRegister(this SmartScopeHeader hdr, REG r)
69 | {
70 | return hdr.regs[Constants.HDR_REGS[r]];
71 | }
72 |
73 | public static unsafe bool GetStrobe(this SmartScopeHeader hdr, STR s)
74 | {
75 | int offset = Constants.HDR_STROBES[s];
76 | byte reg = hdr.strobes[offset / 8];
77 | return Utils.IsBitSet(reg, offset % 8);
78 | }
79 | public static int GetAcquisition(this ISmartScopeHardwareUsb usb, byte[] buffer)
80 | {
81 | usb.GetData(buffer, 0, Constants.SZ_HDR);
82 | GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
83 | SmartScopeHeader hdr = (SmartScopeHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SmartScopeHeader));
84 | handle.Free();
85 | if (!hdr.IsValid())
86 | {
87 | Logger.Error("Invalid header magic");
88 | return 0;
89 | }
90 |
91 |
92 | if (hdr.flags.HasFlag(HeaderFlags.TimedOut))
93 | return Constants.SZ_HDR;
94 |
95 | if (hdr.flags.HasFlag(HeaderFlags.IsOverview))
96 | {
97 | usb.GetData(buffer, Constants.SZ_HDR, Constants.SZ_OVERVIEW);
98 | return Constants.SZ_HDR + Constants.SZ_OVERVIEW;
99 | }
100 |
101 | if (hdr.n_bursts == 0)
102 | throw new ScopeIOException("number of bursts in this USB pacakge is 0, cannot fetch");
103 |
104 | int len = hdr.n_bursts * hdr.bytes_per_burst;
105 | if (len + Constants.SZ_HDR > buffer.Length)
106 | {
107 | usb.GetData(new byte[len], 0, len);
108 | Logger.Error("Length of packet too large (N_burst: {0}, bytes per burst: {1}) expect failure", hdr.n_bursts, hdr.bytes_per_burst);
109 | return 0;
110 | }
111 | usb.GetData(buffer, Constants.SZ_HDR, len);
112 | return Constants.SZ_HDR + len;
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/src/Hardware/ISmartScopeInterface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LabNation.DeviceInterface.Hardware
7 | {
8 | public class ScopeIOException : Exception
9 | {
10 | internal ScopeIOException(string msg) : base(msg) { }
11 | }
12 |
13 | public enum ScopeController
14 | {
15 | PIC = 0,
16 | ROM = 1,
17 | FLASH = 2,
18 | FPGA = 3,
19 | AWG = 4
20 | }
21 |
22 | public interface ISmartScopeInterface : IHardwareInterface
23 | {
24 | void GetControllerRegister(ScopeController ctrl, uint address, uint length, out byte[] data);
25 | void SetControllerRegister(ScopeController ctrl, uint address, byte[] data);
26 | int GetAcquisition(byte[] buffer);
27 | byte[] GetData(int length);
28 | void FlushDataPipe();
29 | void Reset();
30 | bool FlashFpga(byte[] firmware);
31 | byte[] PicFirmwareVersion { get; }
32 | bool Destroyed { get; }
33 | void Destroy();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Hardware/InterfaceManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LabNation.DeviceInterface.Hardware
7 | {
8 | internal abstract class InterfaceManager
9 | where T : InterfaceManager, new()
10 | {
11 | protected static int VID = 0x04D8;
12 | protected static int[] PIDs = new int[] { 0x0052, 0xF4B5 };
13 | protected static Guid guid = new Guid("{7d2c7901-f90b-434d-aae1-38e3e39a3ca1}");
14 | protected static Dictionary