Coder Social home page Coder Social logo

Comments (6)

flozz avatar flozz commented on August 25, 2024 1

The issue is now fixed in rivalcfg 2.3.0, thank you for your help!

from rivalcfg.

flozz avatar flozz commented on August 25, 2024

hi,

That's strange that the interface was not listed by udev... :(

  • What is your Linux distribution/version ? (I will try to reproduce in a VM)

from rivalcfg.

nickrw avatar nickrw commented on August 25, 2024

Thanks! I'm running debian 8.2 / kernel 3.16

I'll also see if I can capture what commands the SteelSeries engine sends this mouse for other "effects" it can do, but are missing here. There are a few cool built-in gradient-scrolling things it can do.

from rivalcfg.

flozz avatar flozz commented on August 25, 2024

Thanks! I'm running debian 8.2 / kernel 3.16

Ok, I will try to reproduce with my Rival 100 :)

There are a few cool built-in gradient-scrolling things it can do.

For the Rival 100, the gradient scrolling feature is a software feature (the SteelSeries Engine 3 sent multiple set_color commands to make the gradient). I think it work the same for the Rival and the Rival 300.

It is simple to implement this feature, but it will require a daemon to update the colors...

Thank you again for your help!

from rivalcfg.

flozz avatar flozz commented on August 25, 2024

I found something:

On Debian 8, udev seems to not link hidraw interface with a vendor id nor a product id... But with my Rival 100 I found this:

In [1]: import pyudev

In [2]: ctx = pyudev.Context()

In [3]: dev = list(ctx.list_devices(SUBSYSTEM="hidraw"))

In [4]: dev
Out[4]: 
[Device(u'/sys/devices/pci0000:00/0000:00:06.0/usb1/1-1/1-1:1.0/0003:80EE:0021.0001/hidraw/hidraw0'),
 Device(u'/sys/devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.0/0003:1038:1702.0004/hidraw/hidraw1'),
 Device(u'/sys/devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.1/0003:1038:1702.0005/hidraw/hidraw2')]

In [5]: dev[1].items()
Out[5]: 
[(u'DEVNAME', u'/dev/hidraw1'),
 (u'DEVPATH',
  u'/devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.0/0003:1038:1702.0004/hidraw/hidraw1'),
 (u'MAJOR', u'251'),
 (u'MINOR', u'1'),
 (u'SUBSYSTEM', u'hidraw')]

So I wrote a script that seems to work. can you try it and tel me if it work for you?

import re
import pyudev

def find_hidraw_device_path(vendor_id, product_id, interface_num=0):
    """
    Find the first HID interface for the given USB vendor id and product id.

    Arguments:
    vendor_id -- the vendor id of the device
    product_id -- the product id of the device
    interface_num -- the interface number (default: 0)
    """
    ctx = pyudev.Context()
    devices = ctx.list_devices(ID_VENDOR_ID=vendor_id)

    for device in devices:
        if (device["ID_MODEL_ID"] != product_id):
            continue
        if (device["SUBSYSTEM"] != "hidraw"):
            continue
        if int(device["ID_USB_INTERFACE_NUM"]) != interface_num:
            continue

        return device["DEVNAME"]

    # Old Kernels...
    devices = ctx.list_devices(SUBSYSTEM="hidraw")
    for device in devices:
        if not re.match(r"^.*/usb./[0-9-]+/[0-9-]+:[0-9-]+\.%i/[0-9]+:%s:%s.*$" % (interface_num, vendor_id, product_id), device["DEVPATH"]):
            continue

        return device["DEVNAME"]


print(find_hidraw_device_path("1038", "1710", 0))

from rivalcfg.

nickrw avatar nickrw commented on August 25, 2024

Awesome. I had to modify the regex slightly (my device path is slightly different to yours: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/0003:1038:1710.0001/hidraw/hidraw0), but this worked

I rewrote the regex to the following, which matches both my device path and yours:

re.match(r"^.*/usb./[0-9/.-]+:[0-9]+\.%i/[0-9]+:%s:%s.*$" % (interface_num, vendor_id, product_id), device["DEVPATH"])

from rivalcfg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.