From 8ba56bdcdddae1039670304bf67c59ea2b0d76eb Mon Sep 17 00:00:00 2001 From: Allen Date: Mon, 8 Feb 2016 03:02:27 -0500 Subject: [PATCH] Adding HIDAPI library and Minimaid Support Adding the HIDAPI library to the project as a dependency so that I can use it to access the Minimaid IO board. This first implemention of lights support is untested, pending the arrival of my test hardware. --- deploy/hidapi.dll | Bin 0 -> 39936 bytes src/DMX_Remake/DMX_Remake/DMX_Remake.vcxproj | 14 +- .../DMX_Remake/DMX_Remake.vcxproj.filters | 6 + src/DMX_Remake/Debug/DMX_Debug.exp | Bin 0 -> 2842 bytes src/DMX_Remake/Debug/DMX_Debug.lib | Bin 0 -> 5354 bytes src/headers/minimaidManager.h | 43 ++ src/hidapi-bsd.txt | 26 ++ src/lib/hidapi/include/hidapi.h | 391 ++++++++++++++++++ src/lib/hidapi/lib/hidapi.lib | Bin 0 -> 5270 bytes src/source/lightsManager.cpp | 3 + src/source/main.cpp | 24 +- src/source/minimaidManager.cpp | 124 ++++++ 12 files changed, 621 insertions(+), 10 deletions(-) create mode 100644 deploy/hidapi.dll create mode 100644 src/DMX_Remake/Debug/DMX_Debug.exp create mode 100644 src/DMX_Remake/Debug/DMX_Debug.lib create mode 100644 src/headers/minimaidManager.h create mode 100644 src/hidapi-bsd.txt create mode 100644 src/lib/hidapi/include/hidapi.h create mode 100644 src/lib/hidapi/lib/hidapi.lib create mode 100644 src/source/minimaidManager.cpp diff --git a/deploy/hidapi.dll b/deploy/hidapi.dll new file mode 100644 index 0000000000000000000000000000000000000000..7b98d8db265ea352b88974b174d379889597a291 GIT binary patch literal 39936 zcmeHw4PaEowf}6gfe;h2NTN}xtjH>@f*~Kf$$pR^Sq#d`<`c9?T(TQBF<g|y|(K&v3SOq8cvcJ+l43n3c3I3UJtS-PJMJDdw9Zg7wu9l zeD0!hcdb|3>}guzaWrVF9gU4mf_Aw}>+v;eYa6vii^{YOO-|RWl$50D3hH|Y&-wWE zEiG*kw>Po3tsC*Zi7&OiiRVjy>Tml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XH&dOSxC1iDFy_WSZWMe4n?^){XitLLa zAvOzdqn@9{!jV|hKYvRh63=T(Xh?%l;P66nR(_sYu>ea zi}M_LzPx1c DMX_Debug - ..\..\lib\allegro-4.4.2-msvc-10.0\include;..\..\lib\fmodapi375win\api\inc;..\..\lib\libpng\include\libpng12;..\..\lib\libpng\include;..\..\lib\loadpng;..\..\headers;..\..\lib\apeg\include;..\..\lib\pacdrive\include;$(IncludePath) - ..\..\lib\allegro-4.4.2-msvc-10.0\lib;..\..\lib\fmodapi375win\api\lib;..\..\lib\libpng\lib;..\..\lib\apeg\lib\release;..\..\lib\pacdrive\lib;$(LibraryPath) + ..\..\lib\allegro-4.4.2-msvc-10.0\include;..\..\lib\fmodapi375win\api\inc;..\..\lib\libpng\include\libpng12;..\..\lib\libpng\include;..\..\lib\loadpng;..\..\headers;..\..\lib\apeg\include;..\..\lib\pacdrive\include;..\..\lib\hidapi\include;$(IncludePath) + ..\..\lib\allegro-4.4.2-msvc-10.0\lib;..\..\lib\fmodapi375win\api\lib;..\..\lib\libpng\lib;..\..\lib\apeg\lib\release;..\..\lib\pacdrive\lib;..\..\lib\hidapi\lib;$(LibraryPath) DMX - ..\..\lib\allegro-4.4.2-msvc-10.0\include;..\..\lib\fmodapi375win\api\inc;..\..\lib\libpng\include\libpng12;..\..\lib\libpng\include;..\..\lib\loadpng;..\..\headers;..\..\lib\apeg\include;..\..\lib\pacdrive\include;$(IncludePath) - ..\..\lib\allegro-4.4.2-msvc-10.0\lib;..\..\lib\fmodapi375win\api\lib;..\..\lib\libpng\lib;..\..\lib\apeg\lib\release;..\..\lib\pacdrive\lib;$(LibraryPath) + ..\..\lib\allegro-4.4.2-msvc-10.0\include;..\..\lib\fmodapi375win\api\inc;..\..\lib\libpng\include\libpng12;..\..\lib\libpng\include;..\..\lib\loadpng;..\..\headers;..\..\lib\apeg\include;..\..\lib\pacdrive\include;..\..\lib\hidapi\include;$(IncludePath) + ..\..\lib\allegro-4.4.2-msvc-10.0\lib;..\..\lib\fmodapi375win\api\lib;..\..\lib\libpng\lib;..\..\lib\apeg\lib\release;..\..\lib\pacdrive\lib;..\..\lib\hidapi\lib;$(LibraryPath) @@ -55,7 +55,7 @@ true - allegro-4.4.2-mt.lib;loadpng-1.5-mt.lib;logg-1.0-mt.lib;zlib-1.2.5-static-mt.lib;fmodvc.lib;apeg_r.lib;ogg_static.lib;vorbis_static.lib;libtheora.lib;winmm.lib;urlmon.lib;%(AdditionalDependencies) + allegro-4.4.2-mt.lib;loadpng-1.5-mt.lib;logg-1.0-mt.lib;zlib-1.2.5-static-mt.lib;fmodvc.lib;apeg_r.lib;ogg_static.lib;vorbis_static.lib;libtheora.lib;winmm.lib;urlmon.lib;hidapi.lib;%(AdditionalDependencies) Windows @@ -78,7 +78,7 @@ true true true - allegro-4.4.2-mt.lib;loadpng-1.5-mt.lib;logg-1.0-mt.lib;zlib-1.2.5-static-mt.lib;fmodvc.lib;apeg_r.lib;ogg_static.lib;vorbis_static.lib;libtheora.lib;winmm.lib;urlmon.lib;%(AdditionalDependencies) + allegro-4.4.2-mt.lib;loadpng-1.5-mt.lib;logg-1.0-mt.lib;zlib-1.2.5-static-mt.lib;fmodvc.lib;apeg_r.lib;ogg_static.lib;vorbis_static.lib;libtheora.lib;winmm.lib;urlmon.lib;hidapi.lib;%(AdditionalDependencies) Windows false @@ -97,6 +97,7 @@ + @@ -121,6 +122,7 @@ + diff --git a/src/DMX_Remake/DMX_Remake/DMX_Remake.vcxproj.filters b/src/DMX_Remake/DMX_Remake/DMX_Remake.vcxproj.filters index c0bc2bc..47c09a0 100644 --- a/src/DMX_Remake/DMX_Remake/DMX_Remake.vcxproj.filters +++ b/src/DMX_Remake/DMX_Remake/DMX_Remake.vcxproj.filters @@ -66,6 +66,9 @@ Header Files + + Header Files + @@ -152,5 +155,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/src/DMX_Remake/Debug/DMX_Debug.exp b/src/DMX_Remake/Debug/DMX_Debug.exp new file mode 100644 index 0000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j@TX1 zoHjG8mP%e~*iT-j)NnTeoKTKWn_^<9v>lrc`RZ9OGqI(kX~wc zk_blPMjl>@s}c7q3^z;o{iqWj9m6agzprNuRDWVTz-b{TlA&)Ck%)YyV5S(CTTVIn z5xGRkZOTDc_J?zk8u-J^J-QpL8nzFTAKU@SkIW#!G$4(_{moMU+R@X#lIDe9Sy}fe zb3%P71R-f!_%Gr<9Nv^Glx-+soK`(lN~>NSv7g+I%>Y;bc$|(=4MFFckM>H7ujb-I z(FN{MgRXb&sUh>jiq&fL8^tv#pwxlCi2n5$G%{)^z4i2}9-A@)fe@b5V}1>Vw^Tk* z9+~GZQre=fA)lEeE|16$7d=;A<#w#5WB2UCe&MU#>xJ#D`aM?~_@N5MHRJ(62?~_3 zD5Fv0;+BSkTGMWKX}(up{e}-8Bp}=H!xM}{F1rS}Q$CU$cY!>`8ObTL4lyv)srVe` zf6hPN!=nS=dOd!{@tA(km>eSlCaEoYf{0nGtSJ#g6Qzjx)14qsGdyBiuE_sUBIc&# za>V>DJKmckhFx(1kub^bUM1+UMd{RjyQTV#LWBJF4*`g+4)bNhj zha+*2#3*07Wwd{jofj=)UGX8BTOpnoY4}~Kd+=jg*US)!?_nKC>rIe1D%EiR6$ytc zMc02Lx4ed;&tMYFTj7{r66Pg|8B#-B9O|r!8mLgthg!WEzSbMG);Se5tp3rVr#>5% z2tOxO>_B;?!)m<=cDFhva=)e(&#S1R#hZpUb!3&tVDqU-N^G|@yf~Z%iQ^WY=fsJ~ zZi_08C~I}FspBQednt+LR?Rw))|((ghNVj2b|}y;EvY!e|5P-DsiUGY#*6%woR)ZD j6~7KUwLdFkZi_DnH{;{#9~9@rjJkQV5>tGy1d#p%x0g{I literal 0 HcmV?d00001 diff --git a/src/headers/minimaidManager.h b/src/headers/minimaidManager.h new file mode 100644 index 0000000..642bf7b --- /dev/null +++ b/src/headers/minimaidManager.h @@ -0,0 +1,43 @@ +// minimaidManager.h implements HID support for a certain custom IO board +// source file created by Allen Seitz 02/07/2016 + +#ifndef _MINIMAIDMANAGER_H_ +#define _MINIMAIDMANAGER_H_ + +#include "hidapi.h" + +#include "common.h" + +class minimaidManager +{ +public: + minimaidManager::minimaidManager(); + + void initialize(); + // precondition: called only once before the visible boot sequence begins + // postcondition: ready for updateInitialize() to begin + + bool updateInitialize(UTIME dt); + // precondition: called continuously during the boot loop, until the IO is ready + // postcondition: hopefully, eventualy, isReady() will return true + // returns: false when the software should give up on finding an IO board, true when it should continue to wait + + bool isReady(); + // returns: true when the initialization is complete and the hardware is fully usable + + void update(UTIME dt); + // precondition: isReady() (checked) or else this call will do nothing + // postcondition: updates the IO board, if necessary + + void updateLamps(); + // precondition: called only by the LightsManager whenever a lamp change happens, and not more than 20 times per second + // postcondition: a packet has been sent to the IO board + +private: + hid_device* handle; + + time_t powerOnTime; + time_t timeSinceLastLampUpdate; +}; + +#endif \ No newline at end of file diff --git a/src/hidapi-bsd.txt b/src/hidapi-bsd.txt new file mode 100644 index 0000000..809012a --- /dev/null +++ b/src/hidapi-bsd.txt @@ -0,0 +1,26 @@ +Copyright (c) 2010, Alan Ott, Signal 11 Software +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/src/lib/hidapi/include/hidapi.h b/src/lib/hidapi/include/hidapi.h new file mode 100644 index 0000000..e5bc2dc --- /dev/null +++ b/src/lib/hidapi/include/hidapi.h @@ -0,0 +1,391 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 8/22/2009 + + Copyright 2009, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU General Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . +********************************************************/ + +/** @file + * @defgroup API hidapi API + */ + +#ifndef HIDAPI_H__ +#define HIDAPI_H__ + +#include + +#ifdef _WIN32 + #define HID_API_EXPORT __declspec(dllexport) + #define HID_API_CALL +#else + #define HID_API_EXPORT /**< API export macro */ + #define HID_API_CALL /**< API call macro */ +#endif + +#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/ + +#ifdef __cplusplus +extern "C" { +#endif + struct hid_device_; + typedef struct hid_device_ hid_device; /**< opaque hidapi structure */ + + /** hidapi info structure */ + struct hid_device_info { + /** Platform-specific device path */ + char *path; + /** Device Vendor ID */ + unsigned short vendor_id; + /** Device Product ID */ + unsigned short product_id; + /** Serial Number */ + wchar_t *serial_number; + /** Device Release Number in binary-coded decimal, + also known as Device Version Number */ + unsigned short release_number; + /** Manufacturer String */ + wchar_t *manufacturer_string; + /** Product string */ + wchar_t *product_string; + /** Usage Page for this Device/Interface + (Windows/Mac only). */ + unsigned short usage_page; + /** Usage for this Device/Interface + (Windows/Mac only).*/ + unsigned short usage; + /** The USB interface which this logical device + represents. Valid on both Linux implementations + in all cases, and valid on the Windows implementation + only if the device contains more than one interface. */ + int interface_number; + + /** Pointer to the next device */ + struct hid_device_info *next; + }; + + + /** @brief Initialize the HIDAPI library. + + This function initializes the HIDAPI library. Calling it is not + strictly necessary, as it will be called automatically by + hid_enumerate() and any of the hid_open_*() functions if it is + needed. This function should be called at the beginning of + execution however, if there is a chance of HIDAPI handles + being opened by different threads simultaneously. + + @ingroup API + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_init(void); + + /** @brief Finalize the HIDAPI library. + + This function frees all of the static data associated with + HIDAPI. It should be called at the end of execution to avoid + memory leaks. + + @ingroup API + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_exit(void); + + /** @brief Enumerate the HID Devices. + + This function returns a linked list of all the HID devices + attached to the system which match vendor_id and product_id. + If @p vendor_id is set to 0 then any vendor matches. + If @p product_id is set to 0 then any product matches. + If @p vendor_id and @p product_id are both set to 0, then + all HID devices will be returned. + + @ingroup API + @param vendor_id The Vendor ID (VID) of the types of device + to open. + @param product_id The Product ID (PID) of the types of + device to open. + + @returns + This function returns a pointer to a linked list of type + struct #hid_device, containing information about the HID devices + attached to the system, or NULL in the case of failure. Free + this linked list by calling hid_free_enumeration(). + */ + struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id); + + /** @brief Free an enumeration Linked List + + This function frees a linked list created by hid_enumerate(). + + @ingroup API + @param devs Pointer to a list of struct_device returned from + hid_enumerate(). + */ + void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs); + + /** @brief Open a HID device using a Vendor ID (VID), Product ID + (PID) and optionally a serial number. + + If @p serial_number is NULL, the first device with the + specified VID and PID is opened. + + @ingroup API + @param vendor_id The Vendor ID (VID) of the device to open. + @param product_id The Product ID (PID) of the device to open. + @param serial_number The Serial Number of the device to open + (Optionally NULL). + + @returns + This function returns a pointer to a #hid_device object on + success or NULL on failure. + */ + HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); + + /** @brief Open a HID device by its path name. + + The path name be determined by calling hid_enumerate(), or a + platform-specific path name can be used (eg: /dev/hidraw0 on + Linux). + + @ingroup API + @param path The path name of the device to open + + @returns + This function returns a pointer to a #hid_device object on + success or NULL on failure. + */ + HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path); + + /** @brief Write an Output report to a HID device. + + The first byte of @p data[] must contain the Report ID. For + devices which only support a single report, this must be set + to 0x0. The remaining bytes contain the report data. Since + the Report ID is mandatory, calls to hid_write() will always + contain one more byte than the report contains. For example, + if a hid report is 16 bytes long, 17 bytes must be passed to + hid_write(), the Report ID (or 0x0, for devices with a + single report), followed by the report data (16 bytes). In + this example, the length passed in would be 17. + + hid_write() will send the data on the first OUT endpoint, if + one exists. If it does not, it will send the data through + the Control Endpoint (Endpoint 0). + + @ingroup API + @param device A device handle returned from hid_open(). + @param data The data to send, including the report number as + the first byte. + @param length The length in bytes of the data to send. + + @returns + This function returns the actual number of bytes written and + -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length); + + /** @brief Read an Input report from a HID device with timeout. + + Input reports are returned + to the host through the INTERRUPT IN endpoint. The first byte will + contain the Report number if the device uses numbered reports. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into. + @param length The number of bytes to read. For devices with + multiple reports, make sure to read an extra byte for + the report number. + @param milliseconds timeout in milliseconds or -1 for blocking wait. + + @returns + This function returns the actual number of bytes read and + -1 on error. If no packet was available to be read within + the timeout period, this function returns 0. + */ + int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds); + + /** @brief Read an Input report from a HID device. + + Input reports are returned + to the host through the INTERRUPT IN endpoint. The first byte will + contain the Report number if the device uses numbered reports. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into. + @param length The number of bytes to read. For devices with + multiple reports, make sure to read an extra byte for + the report number. + + @returns + This function returns the actual number of bytes read and + -1 on error. If no packet was available to be read and + the handle is in non-blocking mode, this function returns 0. + */ + int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length); + + /** @brief Set the device handle to be non-blocking. + + In non-blocking mode calls to hid_read() will return + immediately with a value of 0 if there is no data to be + read. In blocking mode, hid_read() will wait (block) until + there is data to read before returning. + + Nonblocking can be turned on and off at any time. + + @ingroup API + @param device A device handle returned from hid_open(). + @param nonblock enable or not the nonblocking reads + - 1 to enable nonblocking + - 0 to disable nonblocking. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock); + + /** @brief Send a Feature report to the device. + + Feature reports are sent over the Control endpoint as a + Set_Report transfer. The first byte of @p data[] must + contain the Report ID. For devices which only support a + single report, this must be set to 0x0. The remaining bytes + contain the report data. Since the Report ID is mandatory, + calls to hid_send_feature_report() will always contain one + more byte than the report contains. For example, if a hid + report is 16 bytes long, 17 bytes must be passed to + hid_send_feature_report(): the Report ID (or 0x0, for + devices which do not use numbered reports), followed by the + report data (16 bytes). In this example, the length passed + in would be 17. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data The data to send, including the report number as + the first byte. + @param length The length in bytes of the data to send, including + the report number. + + @returns + This function returns the actual number of bytes written and + -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length); + + /** @brief Get a feature report from a HID device. + + Set the first byte of @p data[] to the Report ID of the + report to be read. Make sure to allow space for this + extra byte in @p data[]. Upon return, the first byte will + still contain the Report ID, and the report data will + start in data[1]. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into, including + the Report ID. Set the first byte of @p data[] to the + Report ID of the report to be read, or set it to zero + if your device does not use numbered reports. + @param length The number of bytes to read, including an + extra byte for the report ID. The buffer can be longer + than the actual report. + + @returns + This function returns the number of bytes read plus + one for the report ID (which is still in the first + byte), or -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length); + + /** @brief Close a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + */ + void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device); + + /** @brief Get The Manufacturer String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get The Product String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get The Serial Number String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get a string from a HID device, based on its string index. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string_index The index of the string to get. + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen); + + /** @brief Get a string describing the last error which occurred. + + @ingroup API + @param device A device handle returned from hid_open(). + + @returns + This function returns a string containing the last error + which occurred or NULL if none has occurred. + */ + HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/lib/hidapi/lib/hidapi.lib b/src/lib/hidapi/lib/hidapi.lib new file mode 100644 index 0000000000000000000000000000000000000000..fb3a480b3e270ee519959beeffe6961a4f93673b GIT binary patch literal 5270 zcmcIoJ8v6D5FV1TMN{HiPT>baBLZwUiX`(C(=ZZRc7O<`WkIIXo=)USJcQ&C$0MRH zfa}z*;x2`Mf#6c5ixeqR8ip$W0@rb7Zg07J$K&Z_S_cewcV=h5+u51fIo`N$*sabF zneQt8XSJ$TYpa^3t@-&Y-mrGJ>h*Rr0B{o^eGeeB3o!o@pt!*)cMX6j+u)RYfn%iN zYfhyc0MX(Kr_y^I6CH9Y9|O3A`emftM@|bL0EqJMI2D=zF1^JTDc|9gJwn_gUEh4N z{dA|PKlB=Q)z9(IS%4SVzQ%E`1hBFQ@E+Skq~kKmkv^jQ!ves&JV3Jm@D{0q z{Ug-HL<0#(LIEzqWw-!ykcUMmLJ7+76{O)3EWkYEAPbpTb5iK3XU`5w7MO4v5xMA8 z6Sh?tZi7|2&Hg)lT_Y0{+zGmcy3pk?6)X!LT$+fAvv1c zZ`w_WYIuV#x4T`QCr+yvsx?tN>}DE?6rB9{=9f$Y>jsQy3hL!H+Z!D$J>x@wI(GgL z1Fx+^VPhF_9b;)th%kY`-$*AOBZX}pR*t=S>mD2P0>FPrCxU@(9V*93Y>SvT=*h@U z-Gp*s4q3DuJyhjfeN}p5wrp!??K_oQJGU#1&8^3-H1I=Mq(}<@<|XQ362p8&Jqdzu z(6V|1eATP3{)A7T1RQD5L+_RZvEw?XNaAz^$K4y@qy(o*bC4nDXp%$xZ|KK+Xf1%d z-iVqcY~%0eWW+D!C2Q5%xUOs@lCGD$ao>#IFWgJou1NkUUUElp$xHqc1Ft17Igiti zbEenv9i|qaiW|m@t+nsh6|3>s`WF%S35Q!PBDOSPDDp#!E%i}it19?3?;kPn+AnF{ zI2OgvjHy+-jJSCAtd75WsD7ciY$PaOeeLco&5I;{r^uz1xQ>Y;4z1!xxq>JO%!}@~ zg}kn2L5kQ3dos#UAq&GasyGQ0(7l5ae>c-sD&eb zi-;ElVn}gtUYHkE%s}BW3+B4GpabW33->vvVulqp3b5?PivumfzG)RVP%lXw_2Q0) zxjw~LZ{uDsshFX)*euA^DaaHh8G-E9dFO>PFHqbXawe3B47Q-6@cLANlHGXc6=k)o zKypi8x$@b)VqAO#B7kn|oQg93Ph=J}ZHo1l5G^mz!b)}pRCeRpQU0IjzjG>xS&*3i WuK@|7WbSx)Q8#H(;PDR)1?7L{Turb5 literal 0 HcmV?d00001 diff --git a/src/source/lightsManager.cpp b/src/source/lightsManager.cpp index 2ee7038..035d287 100644 --- a/src/source/lightsManager.cpp +++ b/src/source/lightsManager.cpp @@ -8,9 +8,11 @@ #include "lightsManager.h" #include "extioManager.h" #include "pacdriveManager.h" +#include "minimaidManager.h" extern extioManager extio; extern pacdriveManager pacio; +extern minimaidManager minimaidio; bool LightsManager::initialize() { @@ -55,6 +57,7 @@ void LightsManager::update(UTIME dt) // update the IO board, whichever one is plugged in extio.updateLamps(); pacio.updateLamps(); + minimaidio.updateLamps(); } void LightsManager::setLamp(PinACIO which, int milliseconds) diff --git a/src/source/main.cpp b/src/source/main.cpp index 81943f9..ff190d9 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -8,6 +8,8 @@ #include #include +#include "hidapi.h" + #include "common.h" #include "bookManager.h" #include "downloadManager.h" @@ -16,6 +18,7 @@ #include "gameStateManager.h" #include "lightsManager.h" #include "pacdriveManager.h" +#include "minimaidManager.h" #include "scoreManager.h" #include "videoManager.h" @@ -84,6 +87,7 @@ EffectsManager em; LightsManager lm; extioManager extio; pacdriveManager pacio; +minimaidManager minimaidio; DownloadManager dm; void firstSplashLoop(); @@ -245,6 +249,12 @@ int main() set_alpha_blender(); // the game assumes the graphics are left in this mode register_bitmap_file_type("png", load_png, NULL); + // initialize the HID (Human Interface Device) library, used by the minimaid IO board + if ( hid_init() == 0 ) + { + printf("Unable to initialize the HID library.\n"); + } + if ( fileExists("allsongs") ) { allsongsDebug = true; @@ -371,6 +381,7 @@ int main() vm.update(dt); lm.update(dt); extio.update(dt); + minimaidio.update(dt); if ( gs.g_gameModeTransition == 2 ) { @@ -588,6 +599,7 @@ int main() // clean up gs.killSong(); + hid_exit(); return EXIT_SUCCESS; } @@ -759,7 +771,7 @@ void renderCreditsDisplay() bool checkForUpdates() { bool startedDownload = true; - if ( !fileExists(MANIFEST_FILENAME) ) + if ( !fileExists(MANIFEST_FILENAME) ) // TODO: no don't use the cached one! redownload it every time! { dm.downloadFile(MANIFEST_FILENAME, MANIFEST_FILENAME); } @@ -1332,7 +1344,7 @@ void firstBootLoop() void mainBootLoop(UTIME dt) { - static char results[8][5] = { ".", "..", "...", "....", "OK", "BAD", "SKIP", "PAC" }; + static char results[9][5] = { ".", "..", "...", "....", "OK", "BAD", "SKIP", "PAC", "MINI" }; int dotdotdot = (bootStepTime / 333) % 3; // which board type to render? @@ -1345,6 +1357,10 @@ void mainBootLoop(UTIME dt) { boardType = 7; // "PAC" } + if ( minimaidio.isReady() ) + { + boardType = 8; // "MINI" + } bootStepTime += dt; if ( currentBootStep <= 2 ) @@ -1360,7 +1376,7 @@ void mainBootLoop(UTIME dt) if ( currentBootStep == 0 ) { - if ( extio.updateInitialize(dt) == false && pacio.updateInitialize(dt) == false ) + if ( extio.updateInitialize(dt) == false && pacio.updateInitialize(dt) == false && minimaidio.updateInitialize(dt) == false ) { textprintf(rm.m_backbuf, font, 154, 140, RED, results[5]); // hard fail bootStepTime = 0; @@ -1370,7 +1386,7 @@ void mainBootLoop(UTIME dt) { textprintf(rm.m_backbuf, font, 154, 140, WHITE, results[dotdotdot]); - if ( extio.isReady() || pacio.isReady() ) + if ( extio.isReady() || pacio.isReady() || minimaidio.isReady() ) { bootStepTime = 0; currentBootStep = 1; diff --git a/src/source/minimaidManager.cpp b/src/source/minimaidManager.cpp new file mode 100644 index 0000000..5df4ab7 --- /dev/null +++ b/src/source/minimaidManager.cpp @@ -0,0 +1,124 @@ +// minimaidManager.h implements HID support for a certain custom IO board +// source file created by Allen Seitz 02/07/2016 + +#include "minimaidManager.h" +#include "inputManager.h" +#include "lightsManager.h" + +extern InputManager im; +extern LightsManager lm; + +struct mm_input { + uint8_t report_id; + uint8_t dip_switches; + uint32_t jamma; + uint8_t ext_in; +}; + +struct mm_output { + uint8_t report_id; + uint8_t ext_output; + uint32_t lights; + uint8_t blue_led; + uint8_t kbd_enable; + uint8_t aux_flags; +}; + +// four molexes fit on the minimaid, each with up to 8 pins +// I guess the menu buttons just don't fit? +int minimaidLampOrder[32] = { + lampBlue0, lampRed0, lampBlue1, lampRed1, lampBlue0+1, lampRed0+1, lampBlue1+1, lampRed1+1, + lampBlue2a, lampBlue2b, lampRed2a, lampRed2b, lampBlue3a, lampRed3b, lampRed3a, lampRed3b, + lampBlue2a+1, lampBlue2b+1, lampRed2a+1, lampRed2b+1, lampBlue3a+1, lampRed3b+1, lampRed3a+1, lampRed3b+1, + spotlightA, spotlightB, spotlightC, NULL, NULL, NULL, NULL, NULL +}; + +minimaidManager::minimaidManager() +{ + handle = NULL; + powerOnTime = 0; + timeSinceLastLampUpdate = 0; +} + +void minimaidManager::initialize() +{ + wchar_t wstr[256]; + + // Open the device using the VID, PID, and optionally the Serial number. + handle = hid_open(0x5730, 0x0000, NULL); + + // Read the Manufacturer String - sample code, not used for anything + int res = hid_get_manufacturer_string(handle, wstr, 256); + wprintf(L"Manufacturer String: %s\n", wstr); + + // Read the Product String - sample code, not used for anything + res = hid_get_product_string(handle, wstr, 256); + wprintf(L"Product String: %s\n", wstr); + + // Read the Serial Number String - sample code, not used for anything + res = hid_get_serial_number_string(handle, wstr, 256); + wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr); +} + +bool minimaidManager::updateInitialize(UTIME dt) +{ + // easy. if initialize didn't find it right away, then it's not plugged in + if ( handle == NULL ) + { + return false; + } + return true; +} + +bool minimaidManager::isReady() +{ + return handle != NULL; +} + +void minimaidManager::update(UTIME dt) +{ + if ( !isReady() ) + { + return; + } + powerOnTime += dt; + timeSinceLastLampUpdate += dt; + + // read input from the hid +} + +void minimaidManager::updateLamps() +{ + char b0 = 0, b1 = 0, b2 = 0; + + if ( timeSinceLastLampUpdate < 20 ) + { + //al_trace("--STIFLED LAMP UPDATE-- too soon of an update.\r\n"); + return; // don't do that + } + timeSinceLastLampUpdate = 0; + + // prepare the output structure - I'm not sure what most of thse do to be honest + struct mm_output out; + out.report_id = 0; + out.ext_output = 0; + out.blue_led = 0; + out.aux_flags = 0; + out.kbd_enable = 0; // might be a good idea to see what the bindings are, and if that would be easier? + out.lights = 0; // set in the next code block + + for ( int i = 0; i < 32; i++ ) + { + if ( minimaidLampOrder[i] != 0 ) + { + out.lights |= lm.getLamp(minimaidLampOrder[i]) ? 1 << i : 0; + } + } + + al_trace("LAMP %d\n", out.lights); + + // move the mm_output struct into an array of chars for hid_write + unsigned char outstream[128]; + memcpy_s(&outstream, 128, &out, sizeof(mm_output)); + hid_write(handle, outstream, sizeof(mm_output)); +} \ No newline at end of file