Skip to content

Commit

Permalink
documentation updates
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 15 changed files with 332 additions and 40 deletions.
7 changes: 4 additions & 3 deletions libusbK/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ INPUT = usbk_conceptual_documentation.h \
../src/lusbk_dynamic.h \
../src/lusbk_usb.h \
../src/lusbk_linked_list.h \
../src/lusbk_usbio.h
../src/lusbk_usbio.h \
../src/libusbK_examples/example.h

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand Down Expand Up @@ -693,14 +694,14 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).

EXAMPLE_PATH =
EXAMPLE_PATH = ../src/libusbK_examples

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.

EXAMPLE_PATTERNS = *
EXAMPLE_PATTERNS = *.c

# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
Expand Down
17 changes: 17 additions & 0 deletions libusbK/libusbK_examples.sln
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
4 changes: 2 additions & 2 deletions libusbK/src/kBench.exe/lusbk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_MICRO 2
#define VERSION_NANO 1
#define VERSION_DATE 05/06/2011
#define VERSION_NANO 3
#define VERSION_DATE 05/21/2011
#define RC_FILENAME_STR "kBench.exe"

#define RC_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_MICRO,VERSION_NANO
Expand Down
4 changes: 2 additions & 2 deletions libusbK/src/kList.exe/lusbk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_MICRO 2
#define VERSION_NANO 1
#define VERSION_DATE 05/06/2011
#define VERSION_NANO 3
#define VERSION_DATE 05/21/2011
#define RC_FILENAME_STR "kList.exe"

#define RC_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_MICRO,VERSION_NANO
Expand Down
4 changes: 2 additions & 2 deletions libusbK/src/libusbK.dll/lusbk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_MICRO 2
#define VERSION_NANO 1
#define VERSION_DATE 05/06/2011
#define VERSION_NANO 3
#define VERSION_DATE 05/21/2011
#define RC_FILENAME_STR "libusbK.dll"

#define RC_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_MICRO,VERSION_NANO
Expand Down
4 changes: 2 additions & 2 deletions libusbK/src/libusbK.lib/lusbk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_MICRO 2
#define VERSION_NANO 1
#define VERSION_DATE 05/06/2011
#define VERSION_NANO 3
#define VERSION_DATE 05/21/2011
#define RC_FILENAME_STR "libusbK.lib"

#define RC_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_MICRO,VERSION_NANO
Expand Down
4 changes: 2 additions & 2 deletions libusbK/src/libusbK.sys/lusbk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_MICRO 2
#define VERSION_NANO 1
#define VERSION_DATE 05/06/2011
#define VERSION_NANO 3
#define VERSION_DATE 05/21/2011
#define RC_FILENAME_STR "libusbK.sys"

#define RC_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_MICRO,VERSION_NANO
Expand Down
48 changes: 48 additions & 0 deletions libusbK/src/libusbK_examples/example-device-list.c
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 libusbK/src/libusbK_examples/example.device-list.vcproj
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>
34 changes: 34 additions & 0 deletions libusbK/src/libusbK_examples/example.h
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 added libusbK/src/libusbK_examples/libusbK.lib
Binary file not shown.
Loading

0 comments on commit 107a773

Please sign in to comment.