-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed wdk build warnings fixed kList build errors added device list example
- Loading branch information
libusb.win32.support@gmail.com
committed
May 21, 2011
1 parent
91c0289
commit 107a773
Showing
15 changed files
with
332 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual Studio 2008 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-show-device-list", "src\libusbK_examples\example.device-list.vcproj", "{C92C079A-D7DD-4780-B462-88B7E9105649}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Win32 = Debug|Win32 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C92C079A-D7DD-4780-B462-88B7E9105649}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{C92C079A-D7DD-4780-B462-88B7E9105649}.Debug|Win32.Build.0 = Debug|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "example.h" | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
PKUSB_DEV_LIST headEL = NULL; | ||
PKUSB_DEV_LIST itemEL = NULL; | ||
LONG ret; | ||
|
||
// Get the device list | ||
ret = LstK_GetDeviceList(&headEL, NULL); | ||
|
||
// If ret == 0 then no supported devices were found. | ||
if (!ret) return -ERROR_DEVICE_NOT_CONNECTED; | ||
|
||
// If LstK_GetDeviceList returns a negative value, | ||
// it represents a negative win32 error code. | ||
if (ret < 0) return ret; | ||
|
||
// Print some basic information for each device element | ||
DL_FOREACH(headEL, itemEL) | ||
{ | ||
printf("%s: %s (%s)\n", | ||
itemEL->DeviceInstance, | ||
itemEL->DeviceDesc, | ||
itemEL->Mfg); | ||
} | ||
|
||
// Search for the example device hardware id using | ||
// the custom search macro, Match_DeviceID(), defined in example.h. | ||
DL_SEARCH(headEL, itemEL, EXAMPLE_HWID, Match_DeviceID); | ||
|
||
// Report the connection state of the example device | ||
if (itemEL) | ||
{ | ||
printf("Example device connected!\n"); | ||
} | ||
else | ||
{ | ||
printf("Example device not found.\n"); | ||
ret = -ERROR_NO_MATCH; | ||
} | ||
|
||
// Free the device list | ||
LstK_FreeDeviceList(&headEL); | ||
|
||
// return 0 if the example device is connected. | ||
return itemEL ? 0 : ret; | ||
} |
125 changes: 125 additions & 0 deletions
125
libusbK/src/libusbK_examples/example.device-list.vcproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?xml version="1.0" encoding="Windows-1252"?> | ||
<VisualStudioProject | ||
ProjectType="Visual C++" | ||
Version="9.00" | ||
Name="example-device-list" | ||
ProjectGUID="{C92C079A-D7DD-4780-B462-88B7E9105649}" | ||
RootNamespace="exampledevicelist" | ||
Keyword="Win32Proj" | ||
TargetFrameworkVersion="196613" | ||
> | ||
<Platforms> | ||
<Platform | ||
Name="Win32" | ||
/> | ||
</Platforms> | ||
<ToolFiles> | ||
</ToolFiles> | ||
<Configurations> | ||
<Configuration | ||
Name="Debug|Win32" | ||
OutputDirectory="$(SolutionDir)output\$(SolutionName)" | ||
IntermediateDirectory="$(ConfigurationName)" | ||
ConfigurationType="1" | ||
CharacterSet="1" | ||
> | ||
<Tool | ||
Name="VCPreBuildEventTool" | ||
/> | ||
<Tool | ||
Name="VCCustomBuildTool" | ||
/> | ||
<Tool | ||
Name="VCXMLDataGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCWebServiceProxyGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCMIDLTool" | ||
/> | ||
<Tool | ||
Name="VCCLCompilerTool" | ||
Optimization="0" | ||
AdditionalIncludeDirectories=".\;..\;" | ||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x501" | ||
MinimalRebuild="true" | ||
BasicRuntimeChecks="3" | ||
RuntimeLibrary="3" | ||
UsePrecompiledHeader="0" | ||
WarningLevel="3" | ||
DebugInformationFormat="4" | ||
/> | ||
<Tool | ||
Name="VCManagedResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCPreLinkEventTool" | ||
/> | ||
<Tool | ||
Name="VCLinkerTool" | ||
AdditionalDependencies="libusbK.lib" | ||
LinkIncremental="2" | ||
GenerateDebugInformation="true" | ||
SubSystem="1" | ||
TargetMachine="1" | ||
/> | ||
<Tool | ||
Name="VCALinkTool" | ||
/> | ||
<Tool | ||
Name="VCManifestTool" | ||
/> | ||
<Tool | ||
Name="VCXDCMakeTool" | ||
/> | ||
<Tool | ||
Name="VCBscMakeTool" | ||
/> | ||
<Tool | ||
Name="VCFxCopTool" | ||
/> | ||
<Tool | ||
Name="VCAppVerifierTool" | ||
/> | ||
<Tool | ||
Name="VCPostBuildEventTool" | ||
/> | ||
</Configuration> | ||
</Configurations> | ||
<References> | ||
</References> | ||
<Files> | ||
<Filter | ||
Name="Source Files" | ||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
> | ||
<File | ||
RelativePath=".\example-device-list.c" | ||
> | ||
</File> | ||
</Filter> | ||
<Filter | ||
Name="Header Files" | ||
Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
> | ||
<File | ||
RelativePath=".\example.h" | ||
> | ||
</File> | ||
</Filter> | ||
<Filter | ||
Name="Resource Files" | ||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
> | ||
</Filter> | ||
</Files> | ||
<Globals> | ||
</Globals> | ||
</VisualStudioProject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*! \file example.h | ||
* \brief Common include file used only in examples. | ||
*/ | ||
|
||
#include <windows.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <conio.h> | ||
|
||
#include "lusbk_usb.h" | ||
|
||
#ifndef __EXAMPLE_H_ | ||
#define __EXAMPLE_H_ | ||
|
||
//! Device hardware id match string used for all examples. | ||
//! The \b default is the official Microchip PIC Benchmark Device hardware id. | ||
#define EXAMPLE_HWID "USB\\VID_04D8&PID_FA2E" | ||
|
||
//! Compares the \ref KUSB_DEV_LIST::DeviceInstance member of \c deviceElement with \c hwid. | ||
/*! | ||
* \param deviceElement | ||
* The device list element to test | ||
* | ||
* \param hwid | ||
* The string compared to the \c DeviceInstance member. | ||
* By default, all examples pass \ref EXAMPLE_HWID for this parameter. | ||
* | ||
* \returns | ||
* 0 if hwid is a match, otherwise a non-zero value. | ||
*/ | ||
#define Match_DeviceID(deviceElement, hwid) \ | ||
_strnicmp(deviceElement->DeviceInstance, hwid, strlen(hwid)) | ||
|
||
#endif |
Binary file not shown.
Oops, something went wrong.