Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Thu Aug 29, 2019 1:51 pm

I have a SpaceMouse Enterprise and I'm using the SDL in some C/C++ code to listen to joystick events. For whatever reasons, there are keys on the Spacemouse that don't do anything...the tab key, space, the V1, V2, and V3 keys, etc.

Is there any way of getting these keys to do something in SDL?

Is there a way of programatically controlling the LCD display?

Thanks.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Fri Aug 30, 2019 12:33 am

I don't know anything about SDL, but if it reads the device, it is probably using one of the standard APIs. I have no idea which one they are using.

Most of the native APIs allow access to all the buttons and axes, but the library writer needs to be very thorough when processing events from the device. The SME, being new, may not have existed when the library was written, or the developer didn't have one. Some of the controls may be missing from their implementation. E.g., the V* buttons are new for the SME. To use SDL with the complete device, the library may need to be updated. There are a lot of maybe's in there.

It is also likely that the configuration in use while your application is running, is capturing some of those buttons. E.g., the KB related buttons (Tab, Space, etc) would normally be redirected to send Tab, Space, etc.

Our API exposes all the capabilities of the device, naturally. If you have a regular Windows app with a normal windows message loop, it should be easy to add support for the device through our API. Also the API supports all our devices, without you having to do any device-specific changes. Of course, things we dream up in the future may require some extensions if they don't fit into the current API model. We try not to break anything that already works.

What did you want to do with the LCD?
Our API allows you to set the strings and icons shown on the LCD from your code.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Fri Aug 30, 2019 2:54 pm

I'll look into how I might use the API with Qt and the SDL and bypass those frameworks for just the SME so that I can grab the input and do something useful. It's not a device we'd like to use as a 2nd keyboard, so the labels / default key functions aren't helpful. I appears the driver will change the functions of the SME when application focus changes, and I worry that behavior will have users throwing the SME out into the hallway. I'd much prefer to have the SME as a device the [one, and only one] application uses for input, regardless of where focus goes.

I'm looking at the SiAppCmdWriteActionSet() method...the .h explanation for siActionNodeEx_s is really challenging; there are sibling nodes, child nodes, a root node (singular, so only one), leaf nodes and intermediate nodes which represent categories and sub-categories. I don't think this explanation could be written more confusingly. It sounds like a 3 or 4 dimensional array using singly-linked lists. Is the structure of nodes like so?

Well shucks...I thought I'd draw an ASCII art example...but I have no idea what "...the intermediate nodes represent categories and sub-categories for the actions" could mean. Is a "category" a "context"? If so, then what is a "sub-category" ? A sub-context? What is a sub-context? And how do actions have categories and sub-categories beneath them?

And...I may be looking in the wrong place just trying to set text labels to the 12 boxes on the LCD display.

Thanks for any help. Apologies for just being confused here.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Fri Aug 30, 2019 4:15 pm

OK, I've figured out how SiGrabDevice() can be used to keep the SME dedicated to the application, instead of allowing it to promiscuously roam around. And that's very encouraging.

Next is how to change the LCD display boxes to label the 12 buttons. Icons would probably be useful for most of the button assignments, but if it's optional, that would be helpful initially.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Mon Sep 02, 2019 12:28 am

The action interface allows your app to export commands and, optionally, icons to our GUI. The user can then assign them to the SME buttons.

There can be many levels of commands (like directories on a hard drive). But you don't need to supply more than one level if it is not necessary.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Tue Sep 03, 2019 9:29 am

" The action interface allows your app to export commands and, optionally, icons to our GUI. The user can then assign them to the SME buttons. "

You're stating that the SME has a Graphical User Interface...which I means the user can move a mouse pointer around on the LCD display and select commands. I haven't seen this. Is the LCD a touch screen? It doesn't do anything when I touch it. Maybe the SME I have is defective because the LCD panel doesn't show a mouse pointer and it doesn't respond to my touch. If the SME has a touch screen or requires a mouse to select commands displayed on the LCD panel...what would the user (the person using my application) do to assign those GUI buttons (that my application has exported) to the mechanical buttons on the SME? Do they need to perform this task each time the labels and icons on the LCD change?

Do the structs siActionNode_s and siActionNodeEx_s have anything to do with changing the text labels and icons on the LCD?

When you say "export commands" are you referring to a DOS command? Shell script? Macro? Keyboard code? There's only id, label, and description char pointers in the structures...are you saying that one of these must contain a "command"? If none of those struct members have the command, then how would they be contained in next, children, or type?

Thank you for any assistance.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Wed Sep 04, 2019 12:29 am

.which I means the user can move a mouse pointer around on the LCD display and select commands. I haven't seen this. Is the LCD a touch screen?
No. But wouldn't that be nice? Maybe a future version.

The GUI I am referring to is our "3DxSmartUI.exe" program that gets launched from our systray icon, or the "Settings" icon in our 3DxHome program.

In that GUI there is a page for assigning the SMEs buttons. Each button has a ComboBox with a categorized list of items that can be assigned to the button. If you use the Action Interface, a category with your application name will appear. Under that category is the tree of commands (and icons) you created with the Action Interface. The user can then choose one of your commands for a button. The SME LCD will show that command and icon in one of the 12 sections of its LCD.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Wed Sep 04, 2019 9:01 am

If this isn't the developer's forum or the API doesn't work to change he LCD labels and icons...what do you suggest?

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Wed Sep 04, 2019 4:44 pm

So now that I've tried a simple example with SiAppCmdAWriteActions() and SiAppCmdAcivateActionSet() I don't think either of these functions, or the Action Interface from the SDK has anything to do with changing the LCD text labels and icons that kinda sorta describe the functions of the 12 buttons underneath them on the SME.

So, to repeat my question: How can I programmatically change the text labels and icons on the LCD display? For my application, when I'm in one mode like "Capture" I want the labels to say one thing, and then when the user selects a different mode in the application like "Playback", I'd like the labels to say something else. This would be so that when the user presses button 1 in "Capture" they are aware that it does one thing, and when they press the same button in "Playback" they know it does something else.

Since button 1 returns a code I can handle the button press and perform it's function according to what mode is currently selected. (And I have simply no idea what the actions in the cfg files are, what they do, and simply do not care.)

Thanks.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Wed Sep 04, 2019 11:41 pm

Are you seeing your commands & icons in our GUI?

The Action Interface just exports your commands to our GUI. It doesn't also assign these actions to the buttons.
The user (you?) uses our GUI to assign commands, from the Action lists you exported, to the SME buttons (1-12).

Those assignments are saved in a cfg file created for your application (in %appdata%).
The assignments for your two modes, Capture and Playback, are saved separately in that cfg file. When the application switches modes, the SME button assignments also switch (Capture mode->Playback mode->Capture mode...). You tell the driver to switch, it doesn't know [independently] when your application is doing anything.

You make those mode-specific assignments in our GUI while your application is in the mode you want to edit. IOW, run your app, go into a mode, the app tells the driver it has entered mode Playback, the driver switches to the Playback mode, make changes in the GUI, those changes are saved under the Playback mode. Switch to Capture, repeat that process for Capture.

There is an old API for doing some of this, but
A) I recently discovered that parts of it are currently broken,
B) it does not have the flexibility of the Action Interface.

It might be helpful to have you sign up as a developer. Then we can trade email and code samples.
Please let us know what is confusing about our Action Interface sample in the SDK, so we can make it better.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Thu Sep 05, 2019 1:15 pm

Just repeating my question for the 3rd or 4th or 5th time here...

I'd like set the labels shown on the LCD display to my own text, such as "Playback" or "Mark In" or "Download".

I'd like to be able to change the labels depending upon which of the 12 buttons the user presses, because it would ideally change the "mode" of the application from something like "Capture" to "Playback".

That's all.

The Action Interface might change a configuration file, and from the tool tray utility the user can probably assign an action to a button. But that has nothing to do with changing the labels on the LCD display. Or does it?

And...to quote Inigo Montoya...when you say "GUI" you're referring to the tool-tray utility? The program you open when you right-click on the icon and then click on "Open 3Dconnexion Properties" ? I'm reading your responses and I have absolutely no idea what you're referring to. That word you keep using....GUI....it doesn't mean what you think it means.

Thank you!

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Thu Sep 05, 2019 6:48 pm

Sending out a stop-payment on any requests for help at this point since some poking in the dark seems to have uncovered how what I wanted to do is done. I'll see if I can get icons to display too, and then post a C/C++ example with some discussion later on under a different topic.

Thanks.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Fri Sep 06, 2019 12:17 am

OK. Let us know if you need more help.

Everything does go through the cfg files. That's how all the various pieces of software communicate with each other.

notkevinhise
Posts: 24
Joined: Thu Jun 20, 2019 8:33 am

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by notkevinhise » Tue Sep 10, 2019 10:42 am

Is there some way to disable the pop-up window that shows up when you press a button for too long?

I don't get a button press event when the button is pressed. I get 2 events when the button is released, one showing the button was pressed and another following it showing the button was released.

If I hold a button down for "too long" I get a window that displays what the buttons do, and no button events.

It would be great to just get the button press event when the button is pressed, and to get a button released event when the button is released.

This is how devices normally work. There's a LCD display to tell me what the buttons do. Nobody needs the popup window that does the exact same thing...except that it makes the buttons do nothing.

Which is very unhelpful.

Thanks.

jwick
Moderator
Moderator
Posts: 2539
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SDL with the SpaceMouse...some keys don't do anything....and the display

Post by jwick » Wed Sep 11, 2019 1:15 am

There is a CheckBox toward the bottom of the Buttons page "Disable On-Screen Display". I believe this disables this behavior.

Post Reply