Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2012-01-26 07:27:10 +0400
committerMike Erwin <significant.bit@gmail.com>2012-01-26 07:27:10 +0400
commit7e4558d163af72566213529c0a60a97bcbb6897d (patch)
tree8e26ad494fb9098044cf2271847c5b08a8eaa3d2 /intern/ghost
parent201890d4bbef61080e14a414fc74bb462595141f (diff)
added support for USB Spaceball5000, also a partial attempt to accept button presses from unidentified 3D mice (for ancient serial devices)
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp50
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.h10
2 files changed, 54 insertions, 6 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index db4ed306dbe..0f5149de037 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -77,6 +77,12 @@ static const char* ndof_button_names[] = {
"NDOF_BUTTON_8",
"NDOF_BUTTON_9",
"NDOF_BUTTON_10",
+ // more general-purpose buttons
+ "NDOF_BUTTON_A",
+ "NDOF_BUTTON_B",
+ "NDOF_BUTTON_C",
+ // the end
+ "NDOF_BUTTON_LAST"
};
#endif
@@ -169,7 +175,7 @@ static const NDOF_ButtonT SpaceMousePro_HID_map[] = {
};
/* this is the older SpacePilot (sans Pro)
- * thanks to polosson for the info in this table */
+ * thanks to polosson for info about this device */
static const NDOF_ButtonT SpacePilot_HID_map[] = {
NDOF_BUTTON_1,
NDOF_BUTTON_2,
@@ -194,6 +200,23 @@ static const NDOF_ButtonT SpacePilot_HID_map[] = {
NDOF_BUTTON_NONE // the CONFIG button -- what does it do?
};
+/* this is the older Spaceball 5000 USB
+ * thanks to Tehrasha Darkon for info about this device */
+static const NDOF_ButtonT Spaceball5000_HID_map[] = {
+ NDOF_BUTTON_1,
+ NDOF_BUTTON_2,
+ NDOF_BUTTON_3,
+ NDOF_BUTTON_4,
+ NDOF_BUTTON_5,
+ NDOF_BUTTON_6,
+ NDOF_BUTTON_7,
+ NDOF_BUTTON_8,
+ NDOF_BUTTON_9,
+ NDOF_BUTTON_A,
+ NDOF_BUTTON_B,
+ NDOF_BUTTON_C
+};
+
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System& sys)
: m_system(sys)
, m_deviceType(NDOF_UnknownDevice) // each platform has its own device detection code
@@ -237,12 +260,12 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
m_buttonCount = 15;
break;
case 0xC629:
- puts("ndof: using SpacePilotPro");
+ puts("ndof: using SpacePilot Pro");
m_deviceType = NDOF_SpacePilotPro;
m_buttonCount = 31;
break;
case 0xC62B:
- puts("ndof: using SpaceMousePro");
+ puts("ndof: using SpaceMouse Pro");
m_deviceType = NDOF_SpaceMousePro;
m_buttonCount = 27;
// ^^ actually has 15 buttons, but their HID codes range from 0 to 26
@@ -255,6 +278,12 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
m_buttonCount = 21;
break;
+ case 0xC621:
+ puts("ndof: using Spaceball 5000");
+ m_deviceType = NDOF_Spaceball5000;
+ m_buttonCount = 12;
+ break;
+
case 0xC623:
puts("ndof: SpaceTraveler not supported, please file a bug report");
m_buttonCount = 8;
@@ -385,8 +414,21 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64
default: sendButtonEvent(SpacePilot_HID_map[button_number], press, time, window);
}
break;
+ case NDOF_Spaceball5000:
+ // has no special 'keyboard' buttons
+ sendButtonEvent(Spaceball5000_HID_map[button_number], press, time, window);
+ break;
case NDOF_UnknownDevice:
- printf("ndof: button %d on unknown device (ignoring)\n", button_number);
+ printf("ndof: button %d on unknown device (", button_number);
+ // map to the 'general purpose' buttons
+ // this is mainly for old serial devices
+ if (button_number < NDOF_BUTTON_LAST - NDOF_BUTTON_1) {
+ printf("sending)\n");
+ sendButtonEvent((NDOF_ButtonT)(NDOF_BUTTON_1 + button_number), press, time, window);
+ }
+ else {
+ printf("discarding)\n");
+ }
}
int mask = 1 << button_number;
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index 701f458ccf1..c4e980bb895 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -40,7 +40,8 @@ typedef enum {
NDOF_SpaceMousePro,
// older devices
- NDOF_SpacePilot
+ NDOF_SpacePilot,
+ NDOF_Spaceball5000
} NDOF_DeviceT;
@@ -87,7 +88,12 @@ typedef enum {
NDOF_BUTTON_8,
NDOF_BUTTON_9,
NDOF_BUTTON_10,
-
+ // more general-purpose buttons
+ NDOF_BUTTON_A,
+ NDOF_BUTTON_B,
+ NDOF_BUTTON_C,
+ // the end
+ NDOF_BUTTON_LAST
} NDOF_ButtonT;
class GHOST_NDOFManager