MayeulC / Saitek

Tools to configure saitek (Mad Catz) R.A.T. mice and related devices
GNU General Public License v3.0
30 stars 10 forks source link

Add more mice IDs #4

Open MayeulC opened 9 years ago

MayeulC commented 9 years ago

There are a lot of various R.A.T mice out there. From what I could gather, it seems that the protocol they are using is more or less the same.

I think we should add as much IDs as possible (preferably, after checking they are working). Feel free to post yours here if it's not present (it can be found with lsusb, and will probably begin with 06a3:, thus lsusb |grep 06a3 might be easier to read).

alphaphee commented 9 years ago

Mine is:

Bus 001 Device 006: ID 0738:1709 Mad Catz, Inc.
MayeulC commented 9 years ago

Thanks ! Could you specify the mouse model as well?

alphaphee commented 9 years ago

@MayeulC It's a regural R.A.T 9 xinput list output

Mad Catz Mad Catz R.A.T.9 Wireless Mouse    
MayeulC commented 9 years ago

Please try the https://github.com/MayeulC/Saitek/tree/new_VID branch. I added in your vendor ID. I would like to make sure this doesn't cause any regressions (and that ti works, btw) before merging.

I quickly checked the .inf files of the windows driver. It seems that with your mouse, we covered every R.A.T.9 mouse. Now, there's only the 3/5/MMO missing.

alphaphee commented 9 years ago

I switched to new_VID branch and get the following notice: Could not acquire device handle. Please ensure that it is correctly plugged in and that you have the appropriate rights. Could it be an issue with the ID?

MayeulC commented 9 years ago

Strange, it should have worked. I added this warning today. As far as I know, it only shows up if the device is not plugged in (it cannot find the vendorID/productID combo), or if you didn't run it with the appropriate permissions (the easiest way is of course with sudo). You could try adding this debug line after line 57 (just before except, under the try. Be sure to respect the indentation) :

print("trying " + hex(vendor[0]) + ":" + hex(productID))

This would allow you to check that your device is tried, at least. If yours doesn't show up, this could also be because of an exception. Or, you could also try like you did before, by replacing the vendor and product ID from the master branch with yours. Let me know how it went.

alphaphee commented 9 years ago

Just to be sure we are in the same page. I am in the new_VID branch and this piece is above line 57.

for product in products:
                try:
                    self.handle = self.context.openByVendorIDAndProductID(
                        0x06a3, product)
                    print("trying " + hex(vendor[0]) + ":" + hex(productID))
                except:
                    pass

                if self.handle:
                    self.hasHandle = 1
                    break

and after compiling it successfully it still prints the same message. Same thing with sudo.

MayeulC commented 9 years ago

Without sudo, that's normal. With it, not so much. Yep, you inserted it at the correct place. What is the console output after you added this line? Do you see your mouse vendor and product id? If not, change the above code to :

for product in products:
                try:
                    self.handle = self.context.openByVendorIDAndProductID(
                        0x06a3, product)
                    print("trying " + hex(vendor[0]) + ":" + hex(productID))
                except:
                except Exception as e:
                    print(e)
                    pass

                if self.handle:
                    self.hasHandle = 1
                    break

This should print the error as returned from the operating system. This is probably an enhancement that will make it to mainline too. (I hope I will not answer until tomorrow, its 00:30 here [GMT+1], but I have some exams tomorrow that need some work).

alphaphee commented 9 years ago

@MayeulC I believe the first except: is copy-paste leftover. Without it, it compiles fine and the output is:

name 'vendor' is not defined
name 'vendor' is not defined
Could not acquire device handle. Please ensure that it is correctly plugged in and that you have the appropriate rights. 

(btw, i am on GMT+2 and a student as well so we're in sync, don't worry.)

MayeulC commented 9 years ago

Strange, could it be that the array is not well defined ? The whole code is at http://codepad.org/WQD1Og6P Also try http://codepad.org/qnyG9T6u (which is less complicated). I hope it will work, but I don't really see why it didn't already.

rkruk commented 8 years ago

If you are still interested with some other R.A.T.9 IDs - here is mine:
Bus 009 Device 002: ID 06a3:0cfa Saitek PLC and the mouse is: Saitek Cyborg R.A.T.9 Wireless Mouse. That mouse is a very first series of RAT9 (grandpa), but all internal hardware are still the same like with later RATs9 as far as I'm concern.

MayeulC commented 8 years ago

Hello, Thanks a lot, but this ID is already part of the driver (in fact, I have the very same mouse) List of supported R.A.T 9 IDs : https://github.com/MayeulC/Saitek/wiki/R.A.T-9-USB-Documentation#usb-protocol

From what I could gather from the windows driver .inf files, there is only these three IDs for the 9 series. Then, of course, there's the other series, but it needs some adjustments to the driver I don't have time to make right now (maybe later this year).

rkruk commented 8 years ago

Cool. Thanks for the link - I'll read it for sure.

noobish commented 8 years ago

$ lsusb|grep Saitek 06a3:0cc3 Saitek PLC $ xinput list|grep Saitek ⎜ ↳ Saitek Cyborg R.A.T.5 Mouse id=16 [slave pointer (2)]

I get this when executing new_VID:configurator.py: trying 0x6a3:0xcfa trying 0x6a3:0xcd9 trying 0x6a3:0xcc3 Traceback (most recent call last): File "./configurator.py", line 357, in main() File "./configurator.py", line 347, in main w = MainWindow() File "./configurator.py", line 333, in init self.data = Data(self.pbar, self.tabs, self.dpi, self.com) File "./configurator.py", line 182, in init self.pool() File "./configurator.py", line 188, in pool self.displayResults() File "./configurator.py", line 194, in displayResults self.pbar.setValue(self.battery) TypeError: QProgressBar.setValue(int): argument 1 has unexpected type 'NoneType'

Seems like a pretty simple Qt5 issue.. I get the same thing when I add 0x0cc3 to the array in the master branch.

MayeulC commented 8 years ago

@noobish, thank you for your input, I will have a look as soon as possible.

MayeulC commented 8 years ago

@noobish, it looks like a pretty straightforward issue: the program is querying the battery level, which obviously can't be done on your R.A.T.5, and fails here. I just started a pretty big overhaul of the tool, at least concerning the connection. You could try one of the forks (the first one) where this functionality has been disabled, , change it yourself (From the back trace, commenting out self.pbar.setValue(self.battery) might just work), or wait for the code I'm working on. I hope to be done by the end of the week (end), but don't want to over promise.

bugaevc commented 7 years ago

I have R.A.T. 7: ID 0738:1708 Mad Catz, Inc.

Changing the DPI is pretty much useless to me; I would like to re-bind the buttons.

Also note that to access USB the script needs to be run as root, but it's insecure and forbidden to run GUI apps as root. Please consider using polkit.

MayeulC commented 7 years ago

Hi @bugaevc ,

Thank you for your comment. I plan to introduce this functionality in the future at some point. It is however just a side project for me, and my R.A.T mouse is getting old and less and less reliable (battery draining rather quickly, and pointer motion a bit jerky). That means I do not have an E.T.A for this.

I wrote some udev rules that allow the application to be ran by any local user, I think this would be the preferred method going forward. It is however true that it should be stated more clearly in the README that it is insecure to run GUI applications as root (or actually, any application, for that matter: the less, the better). The reason I did not publish these is that due to some recent change on my system (probably a libusb or python update), the tool is broken, as it can't set the DPI anymore.

There are rebinding tools such as xbindkeys, although I am not too familiar with the problem, as I didn't really dig into it yet. If you have any ideas how remapping could be performed, I would be interested.

May I ask you your mouse DPI? It should be written under it near the sensor, if anything like mine.

bugaevc commented 7 years ago

Sorry for the delay...

May I ask you your mouse DPI? It should be written under it near the sensor, if anything like mine.

DPI is 6400. What does this value indicate, and what kind of DPI (physical, logical) does this app let me change, and how are they all related?

There are rebinding tools such as xbindkeys, although I am not too familiar with the problem, as I didn't really dig into it yet. If you have any ideas how remapping could be performed, I would be interested.

I'm not talking about tweaking the computer settings... is there a way to re-program the mouse itself, or what does the Windows/macOS configuration software that ships with the mouse do?

MayeulC commented 7 years ago

DPI is 6400. What does this value indicate, and what kind of DPI (physical, logical) does this app let me change, and how are they all related?

This is the maximum physical DPI. This application allows you to change the DPI setting of the different mouse modes. I do not know if the setting reduces the precision of the sensor, or if it just scales down the sensitivity (the reported movement). The second seems more likely. The DPI setting is stored on-board. That is, if you plug your mouse in another computer, you keep the different values assigned to the four sensitivity settings.

I'm not talking about tweaking the computer settings... is there a way to re-program the mouse itself, or what does the Windows/macOS configuration software that ships with the mouse do?

Not as far as I know. I am reasonably certain that these utilities either change the driver behavior, or generate virtual events that are directly interpreted by the windowing system.

eyalch commented 7 years ago

Seems like no one on the internet cares about my R.A.T.TE...

Anyway, I added my mouse to the products list:

{'vid': 0x0738, 'pid': 0x1704, 'name': 'R.A.T TE'}

But it seems to cause an error. Here's the output:

Found one device: {'pid': 5892, 'name': 'R.A.T TE', 'vid': 1848}
Traceback (most recent call last):
  File "./ratctl.py", line 402, in <module>
    main()
  File "./ratctl.py", line 392, in main
    w = MainWindow()
  File "./ratctl.py", line 378, in __init__
    self.data = Data(self.pbar, self.tabs, self.dpi, self.com)
  File "./ratctl.py", line 227, in __init__
    self.pool()
  File "./ratctl.py", line 230, in pool
    self.dpiMode = self.com.getDpiMode()
  File "./ratctl.py", line 152, in getDpiMode
    return mode[0] / 16
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
MayeulC commented 7 years ago

@eyal0803, it's not that I don't care, but I only have one mouse ;)

About the error, I am on it (I actually went back to it the day before yesterday). It is due to a change in libusb1 that was introduced in version 1.50: https://github.com/vpelletier/python-libusb1#150

The fix should be relatively easy, but it still need some testing, and I would like to refactor a part of the code with it. I am pretty busy this week-end, but I am in holidays, and this is something I would like to get sorted ASAP, so stay tuned ;)

Go ahead if you want to have a go at fixing it yourself, I am not too familiar with python, and the type system feels a bit weird at times... :)

eyalch commented 7 years ago

@MayeulC Thanks for the response! I didn't mean you don't care, I meant literally the whole internet. Every existing tweak for Mad Catz's mice never takes the TE model in count, but no big deal.

Anyway, I tried to look more into the error but had no luck. I found out that

measure = self.handle.controlRead(self.ctrl_request_type,
                                  self.ctrl_request,
                                  self.ctrl_value,
                                  self.ctrl_index,
                                  self.ctrl_length)

raises an exception and the code continues to the except which causes the error I mentioned in my previous message. I tried to track back the error and find what causes it but I think I got too deep and stopped once I got to C code in the main libusb library.

If you'll make any progress I'd love to know about it.

MayeulC commented 7 years ago

@eyal0803 My bad, I looked at it too quickly. It isn't exactly the same error as the one I was talking about. I have already seen a similar one, though. Let's move to #11 for discussion.

FiloSpaTeam commented 6 years ago

I added id for MOUS 9 :) see pull request #15

Licht88 commented 3 years ago

Hi. i have MMO 7, please add this mouse)

usb 4-5: new full-speed USB device number 3 using ohci-pci usb 4-5: New USB device found, idVendor=06a3, idProduct=0cd0, bcdDevice= 1.14 usb 4-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 4-5: Product: Cyborg M.M.O.7 Gaming Mouse usb 4-5: Manufacturer: Saitek usb 4-5: SerialNumber: RD007884 input: Saitek Cyborg M.M.O.7 Gaming Mouse as /devices/pci0000:00/0000:00:13.0/usb4/4-5/4-5:1.0/0003:06A3:0CD0.0002/input/input21 saitek 0003:06A3:0CD0.0002: input,hidraw0: USB HID v1.11 Mouse [Saitek Cyborg M.M.O.7 Gaming Mouse] on usb-0000:00:13.0-5/input0

lsusb |grep 06a3 Bus 004 Device 003: ID 06a3:0cd0 Saitek PLC Cyborg M.M.O.7 Gaming Mouse

MayeulC commented 3 years ago

@Licht88, could you please confirm that the utility works as-is with that mouse? Thanks :)