Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SunliteFirmwareLoader.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * SunliteFirmwareLoader.h
17  * Load the firmware onto a USBDMX2 device
18  * Copyright (C) 2010 Simon Newton
19  *
20  * The Soundlite USBDMX2 interfaces require firmware to be loaded when they're
21  * connected, this performs that job.
22  */
23 
24 #ifndef PLUGINS_USBDMX_SUNLITEFIRMWARELOADER_H_
25 #define PLUGINS_USBDMX_SUNLITEFIRMWARELOADER_H_
26 
27 #include <libusb.h>
28 #include "plugins/usbdmx/FirmwareLoader.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace usbdmx {
33 
35  public:
36  explicit SunliteFirmwareLoader(libusb_device *usb_device)
37  : m_device(usb_device) {}
39 
40  bool LoadFirmware();
41 
42  private:
43  libusb_device *m_device;
44 
45  static const int INTERFACE_NUMBER = 0; // the device only has 1 interface
46  static const uint8_t UPLOAD_REQUEST_TYPE = 0x40;
47  static const uint8_t UPLOAD_REQUEST = 0xa0;
48  static const unsigned int UPLOAD_TIMEOUT = 300; // ms
49 };
50 } // namespace usbdmx
51 } // namespace plugin
52 } // namespace ola
53 #endif // PLUGINS_USBDMX_SUNLITEFIRMWARELOADER_H_