LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Trying to acess the onboard memory of a gaming mouse (https://www.linuxquestions.org/questions/linux-hardware-18/trying-to-acess-the-onboard-memory-of-a-gaming-mouse-4175490668/)

zhjim 01-16-2014 02:14 AM

good job.

Pearlseattle 01-16-2014 02:00 PM

Great Gibbo - compliments! And with just those few lines of code!
Such a program will for sure be very useful - not only to the persons that own that specific mouse. Will start looking myself now at that libusb.

Cheers!
:D

Pearlseattle 05-20-2014 05:14 PM

So, here is finally the utility I was working on to make my throttle work with X-Plane in Linux.
It basically monitors whichever USB-device you have connected to your PC (and which you want to monitor) and translates any button press or release events on that device into key events (which you have to define/map).

Example:
You can define that whenever you press your second button on your joystick it generates on the currently focused window the keyboard press event "X", that for the same still on the second button it generates the key press events "xyZ" on the focused window, and so on for any other buttons of any other devices. I'm having problems explaining this but in the end using it is extremely simple... .:confused:

Not sure if it's useful nor where to go from here (with this base it might be quite easy to do something more complex than to just target a mapping to key events) - will wait to see if I get any feedback and/or if more than a couple of users per year access the page.

Sorry for the delay - had some trouble at work and some parts of the code were a bit tricky for me.

BuffaloX 06-21-2014 06:04 PM

Quote:

Originally Posted by 83Gibbo (Post 5098954)
I can now change any of the keybinds to any of the standard ones in the Windows Steel Series Utility and can see how to do everything else I was looking for.
<snip>
I'll throw up a link to the basic Python 3 Script that saves keybinds if anyone wanted a look,

Thanks a gazillion for that, I actually went ahead and bought the mouse because of this thread and that it was on special offer, you have probably figured it out yourself, but just in case you didn't I have mapped some buttons using your brilliant script:

Code:

#Button            ?                  ?                  ?                  ?                  ?                  ?                  K7      k          K11      j          K10      i          K12    h          K14      e          K13      z          K4      q          K5      e          K6      g        ??
#            0                  1v                  2v                  3v                  4v                  5v                  6      8          7      7          8      6          9      5          10      3          11      0          12      1          13      2          14      4         
data_a = b'\x0e\x00\x4b\x00\x03\x01\x00\x00\x00\x00\x02\x00\x00\x00\x00\x03\x00\x00\x00\x00\x04\x00\x00\x00\x00\x05\x00\x00\x00\x00\x10\x00\x08\x00\x01\x10\x00\x07\x00\x01\x10\x00\x06\x00\x01\x10\x00\x05\x00\x01\x10\x00\x03\x00\x01\x10\x00\x00\x00\x01\x10\x00\x01\x00\x01\x10\x00\x02\x00\x01\x10\x00\x04\x00\x01'
#Special Key Table String
#            0  1    2  3  4  5  6  7  8
data_b = b'\x1d\x14\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11'
#            z  q    e  f  g  h  i  j    k

K# is the button number used in the original software, I can run it in Wine and export profiles,but I can't store them on the mouse, and if I select the tools menu it crashes.

But I have used the above settings for gaming, and it works like a charm.

If you have some other goodies, it would be much appreciated, I would love to be able to do more, I am stuck on defaults except for the changes made with your script, the dpi setting is very low, and although the orange glow is nice it would be cool to be able to do some customizations.
I was thinking of contacting Steelseries because they write: "we would happily assist any community-driven efforts to develop an open-source solution for Linux. If you are aware of such efforts or would like to contribute, then please file a supp", so we shouldn't need to reverse engineer it.

BuffaloX 06-22-2014 02:08 PM

More hacking
 
I hacked on the program some more and made it easier to locate index of each button.

Code:

#Button            ?                  ?                  ?                  ?                  ?                  ?                  K7                  K11                K10                K12                K14                K13                K4                  K5                  K6                ??
#            0                  1v                  2v                  3v                  4v                  5v                  6      7          7      11          8      10          9      12          10      14          11      13          12      4          13      5          14      6         
data_a = b'\x0e\x00\x4b\x00\x03\x01\x00\x00\x00\x00\x02\x00\x00\x00\x00\x03\x00\x00\x00\x00\x04\x00\x00\x00\x00\x05\x00\x00\x00\x00\x10\x00\x07\x00\x01\x10\x00\x0b\x00\x01\x10\x00\x0a\x00\x01\x10\x00\x0c\x00\x01\x10\x00\x0e\x00\x01\x10\x00\x0d\x00\x01\x10\x00\x04\x00\x01\x10\x00\x05\x00\x01\x10\x00\x06\x00\x01'
#Special Key Table String
#            0  1    2  3  4  5  6  7  8  9  10  11  12  13  14
data_b = b'\x00\x00\x00\x00\x50\x4f\x4a\x52\x00\x00\xe1\xe2\xe0\x29\x51'
#Button configuration: 4/5=left/right;#6=home;7/14=up/dwn;10,11,12=shift,alt,ctrl;13=escape

I also iterated all 256 values possible for a one byte index.

Code:

# 04-x1d='a-z'
# 1e-x27='1-0'
# 28=return
# 29=Escape
# 2a=backspace
# 2b=tab
# 2c=space
# 2d='+'
# 2e=dead_acute
# 2f='å'
# 30=dead_diaeresis
# 31=' apostrophe
# 32=' apostrophe
# 33='æ'
# 34='ø'
# 35='½'
# 36=','
# 37='.'
# 38='-'
# 39= keycode 66
# 3a-x45=F1-F12
# 46=print screen
# 47=scroll lock
# 48=pause
# 49=insert
# 4a=home
# 4b=prior
# 4c=delete
# 4d=end
# 4e=next
# 4f=right
# 50=left
# 51=down
# 52=up
# 53 numlock
# 54 KP divide
# 55 KP multiply
# 56 KP subtract
# 57 kp add
# 58 kp enter
# 59-64 kp 1-9+0
# 65=menu
# 66=power off
# 67=kp equal
# 68=tools
# 69=launch 5
# 6a=launch 6
# 6b=launch 7
# 6c=launch 8
# 6d=launch 9
# 75=help
# 7f=audio mute
# 80=audio vol up
# 81=audio vol down
# 85=kp decimal
# 88=Hiragana_Katakana
# 9c=delete
# b6-b7=()
# e0=left ctrl
# e1=left shift
# e2=left alt
# e3=left meta
# e4=right ctrl
# e5=right shift
# e6=lvl 3 shift
# e7=right super
# e8=play pause/resume
# e9=audio stop
# ea=audio previous
# eb=audio next
# ec=eject
# ed=vol up
# ee=vol dwn
# ef=audio mute/unmute
# f0=www
# f1=back
# f2=forward
# f3=cancel
# f4=find
# f5=scroll up
# f6=scxroll dwn
# f8=sleep
# fa=screensaver
# fb=reload
# fc=calculator


Owen Riddy 08-29-2014 06:52 AM

Hey All

I didn't see this thread before; I got a WoW: Cataclysm mouse recently and was saddened that it didn't work. I wrote my own piece of software that can load button -> keyboard macro combinations (although I havn't tested it very much)

See: https://github.com/owenRiddy/cataclysm-mouse (also linked to in the unix.stackechange.com link earlier in this thread)

The basic problem is that a usb mouse can't (according to the USB HID standard) have more than the standard buttons. The WoW: Cataclysm mouse gets around this by pretending to be a usb keyboard & mouse combo - so as has been discovered here the important thing is loading the key mapping to the onboard memory.

I reverse-engineered the macro code. The mouse gets sent two packets (my program sends them via libusb) - one to load up a list of keyboard macros and one to map keys to macros. I think my rogram works better than echoing data to the mouse blindly as my program can take a configuration file.

If you can compile C code you should be able to make it work. If anyone gets stuck and has questions I'll try and help. Having unresponsive buttons really irritated me.

BuffaloX 08-30-2014 07:16 PM

@Owen Riddy
I have downloaded your program but I haven't tried it yet, but if it can do macros that is awesome.
Do you by any chance have anything for changing DPI and light effect? I don't have easy access to a Windows system, so I'm kind of stuck with my current settings.
Thank you for sharing. :-)

Owen Riddy 08-31-2014 06:32 AM

I had a stab at the LED stuff; the official drivers had options for Pulse and Brightness that ... didn't seem to do anything. Who knows what the go is with that? LED colour wasn't there this morning but it is there now and updated into the github repository (and setting the RGB colours to 0-0-0 will disable the LED altogether). Getting CPI working didn't come together that smoothly but it'll probably be there this week. Just keep an eye on the repo.

BuffaloX 08-31-2014 12:02 PM

Thanks again, I really look forward to try it out, I'll grab the newer version and keep an eye out for updates. I like how you made it so root isn't needed to update. This mouse is really awesome for RPG games when it can be configured properly.

BuffaloX 08-31-2014 12:52 PM

I tried the program and it works fine with the buttons and I can change the color too, but when I restart the computer the colors revert to their previous setting but the buttons keep the new configuration.


PS how do I configure the buttons for special keys? I had for instance button 13 set to escape, although I was thinking of changing it.

Owen Riddy 09-01-2014 03:04 AM

Alright, I made another attempt at a few more features and they seem to work:
* Sensitivity can be changed
* You can now send arbitrary key-codes into the mouse

Bear in mind that I don't have any hints from SteelSeries at the moment even though I want this mouse to be an option for linux users (because it really is a nice mouse). With that, I'm not going to try and debug why your mouse is changing colour on startup unless I notice it happening on my end. There is a lot of channel noise over the usb line that I don't understand that might have toggled something important (wireshark can sniff usb traffic! who would have guessed). You could run the script every time the computer starts.

I'm also not going to research what the specific keycodes are (although I know that a starts at 4 and that control, alt, shift, etc live at near 0xe0 (hex, 224 in decimal). If you figure out a list I'll throw it in the readme or the example config file for anyone else who stumbles past.

BuffaloX 09-01-2014 06:07 AM

Quote:

Originally Posted by Owen Riddy (Post 5230535)
Alright, I made another attempt at a few more features and they seem to work:
* Sensitivity can be changed
* You can now send arbitrary key-codes into the mouse

Awesome, that makes it feature complete as far as I can tell.

Quote:

Originally Posted by Owen Riddy (Post 5230535)
You could run the script every time the computer starts.

Sure, I was also thinking of making hotkeys to change configurations.

Quote:

Originally Posted by Owen Riddy (Post 5230535)
If you figure out a list I'll throw it in the readme or the example config file for anyone else who stumbles past.

I went through all the codes earlier, and posted a list a couple of posts up.

Owen Riddy 09-02-2014 01:44 AM

Quote:

Originally Posted by BuffaloX (Post 5230580)
I went through all the codes earlier, and posted a list a couple of posts up.

Oh, I forgot that bit. I'll take that and add it as a reference.


All times are GMT -5. The time now is 02:18 AM.