| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2013 Richard Hughes <[email protected]> |
| 4 |
* |
| 5 |
* Licensed under the GNU General Public License Version 2 |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef __MUNKI_ENUM_H |
| 23 |
#define __MUNKI_ENUM_H |
| 24 |
|
| 25 |
#include <glib-object.h> |
| 26 |
|
| 27 |
G_BEGIN_DECLS |
| 28 |
|
| 29 |
#define MUNKI_COMMAND_DIAL_ROTATE 0x00 |
| 30 |
#define MUNKI_COMMAND_BUTTON_PRESSED 0x01 |
| 31 |
#define MUNKI_COMMAND_BUTTON_RELEASED 0x02 |
| 32 |
|
| 33 |
#define MUNKI_BUTTON_STATE_RELEASED 0x00 |
| 34 |
#define MUNKI_BUTTON_STATE_PRESSED 0x01 |
| 35 |
|
| 36 |
#define MUNKI_DIAL_POSITION_PROJECTOR 0x00 |
| 37 |
#define MUNKI_DIAL_POSITION_SURFACE 0x01 |
| 38 |
#define MUNKI_DIAL_POSITION_CALIBRATION 0x02 |
| 39 |
#define MUNKI_DIAL_POSITION_AMBIENT 0x03 |
| 40 |
#define MUNKI_DIAL_POSITION_UNKNOWN 0xff |
| 41 |
|
| 42 |
|
| 43 |
/* |
| 44 |
* Triggers a request for a bulk transfer of EEPROM |
| 45 |
* Length: 8 bytes |
| 46 |
* |
| 47 |
* address length (LE) |
| 48 |
* ____|____ ____|____ |
| 49 |
* / \ / \ |
| 50 |
* 04 00 00 00 04 00 00 00 |
| 51 |
*/ |
| 52 |
#define MUNKI_REQUEST_EEPROM_DATA 0x81 |
| 53 |
|
| 54 |
/* |
| 55 |
* Gets the next hardware event |
| 56 |
* Length: 8 bytes |
| 57 |
* |
| 58 |
* This blocks until the hardware sends an event, and must either be |
| 59 |
* run in a mainloop or thread to avoid blocking. |
| 60 |
* |
| 61 |
* subcmd ----\ /------------ 32 bit event time |
| 62 |
* cmd ----|\ || || || || || |
| 63 |
* Returns: 02 00 00 00 ac 62 07 00 |
| 64 |
* always zero ---||-|| |
| 65 |
* |
| 66 |
* cmd is: |
| 67 |
* 00 dial rotate |
| 68 |
* 01 button pressed |
| 69 |
* 02 button released |
| 70 |
* |
| 71 |
* subcmd is: |
| 72 |
* 00 button event |
| 73 |
* 01 dial rotate |
| 74 |
*/ |
| 75 |
#define MUNKI_REQUEST_INTERRUPT 0x83 |
| 76 |
|
| 77 |
/* |
| 78 |
* Returns the major and minor version numbers |
| 79 |
* Length: 24 bytes |
| 80 |
*/ |
| 81 |
#define MUNKI_REQUEST_VERSION_STRING 0x85 |
| 82 |
|
| 83 |
/* |
| 84 |
* Returns the chip id |
| 85 |
* Length: 8 bytes |
| 86 |
*/ |
| 87 |
#define MUNKI_REQUEST_FIRMWARE_PARAMS 0x86 |
| 88 |
|
| 89 |
/* |
| 90 |
* Gets the device status |
| 91 |
* Length: 2 bytes |
| 92 |
* |
| 93 |
* Returns: 00 00 |
| 94 |
* |/ || |
| 95 |
* dial pos -/ \--- button value |
| 96 |
* - 00 = projector |
| 97 |
* - 01 = surface |
| 98 |
* - 02 = calibration |
| 99 |
* - 03 = ambient |
| 100 |
*/ |
| 101 |
#define MUNKI_REQUEST_GET_STATUS 0x87 |
| 102 |
|
| 103 |
/* |
| 104 |
* Returns the version string |
| 105 |
* Length: 36 bytes |
| 106 |
*/ |
| 107 |
#define MUNKI_REQUEST_CHIP_ID 0x8A |
| 108 |
|
| 109 |
/* USB endpoints in use */ |
| 110 |
#define MUNKI_EP_CONTROL 0x00 |
| 111 |
#define MUNKI_EP_DATA 0x01 |
| 112 |
#define MUNKI_EP_EVENT 0x03 |
| 113 |
|
| 114 |
/* EEPROM is massive */ |
| 115 |
#define COLORMUNKI_EEPROM_OFFSET_SERIAL_NUMBER 0x0018 /* 10 bytes */ |
| 116 |
|
| 117 |
const gchar *munki_button_state_to_string (guint8 value); |
| 118 |
const gchar *munki_dial_position_to_string (guint8 value); |
| 119 |
const gchar *munki_command_value_to_string (guint8 value); |
| 120 |
const gchar *munki_endpoint_to_string (guint value); |
| 121 |
|
| 122 |
G_END_DECLS |
| 123 |
|
| 124 |
#endif /* __MUNKI_ENUM_H */ |
| 125 |
|