add driver and svg for steelseries rival 310

The driver does not yet support button mappings or any
non-solid LED modes.

The device does not support reading out the current
configuration. On probe some default values are used
to get a usable profile.
This commit is contained in:
Thomas Hindoe Paaboel Andersen
2017-10-06 21:12:07 +02:00
committed by Thomas H. P. Andersen
parent 3e04abde30
commit 575b7bce98
7 changed files with 729 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
[Device]
Name=SteelSeriesRival 310
DeviceMatch=usb:1038:1720
Driver=steelseries
Svg=steelseries-rival310.svg

View File

@@ -0,0 +1,443 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="490"
height="490"
viewBox="0 0 129.64583 129.64583"
version="1.1"
id="svg8"
sodipodi:docname="steelseries-rival310.svg"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4142136"
inkscape:cx="158.34512"
inkscape:cy="283.9471"
inkscape:document-units="px"
inkscape:current-layer="Device"
inkscape:document-rotation="0"
showgrid="false"
showguides="false"
inkscape:window-width="1920"
inkscape:window-height="1163"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
showborder="true"
inkscape:guide-bbox="true"
units="px"
inkscape:snap-global="false"
inkscape:measure-start="241.5,424.5"
inkscape:measure-end="193,423">
<inkscape:grid
type="xygrid"
id="grid78" />
<sodipodi:guide
position="58.722772,112.40709"
orientation="0,1"
id="guide79"
inkscape:locked="false" />
<sodipodi:guide
position="39.611923,100.54373"
orientation="0,1"
id="guide81"
inkscape:locked="false" />
<sodipodi:guide
position="51.756014,88.614617"
orientation="0,1"
id="guide83"
inkscape:locked="false" />
<sodipodi:guide
position="57.778386,76.729167"
orientation="0,1"
id="guide85"
inkscape:locked="false" />
<sodipodi:guide
position="45.047078,64.795712"
orientation="0,1"
inkscape:locked="false"
id="guide87" />
<sodipodi:guide
position="57.646696,52.899321"
orientation="0,1"
id="guide89"
inkscape:locked="false" />
<sodipodi:guide
position="64.031094,118.70775"
orientation="1,0"
id="guide996"
inkscape:locked="false" />
<sodipodi:guide
position="76.729165,115.65599"
orientation="1,0"
id="guide4799"
inkscape:locked="false" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="Device"
inkscape:label="Device"
style="display:inline;opacity:1"
transform="translate(0,-167.35416)">
<path
style="fill:#d3d3ce;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.98636663;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 39.422916,178.73125 c 8.753298,-5.1263 8.742273,-5.15937 19.909893,-6.35 0.86322,1.81872 1.399035,2.16412 3.571875,2.57968 0.815799,-0.022 1.631597,-0.0441 2.447396,-0.0661 1.808025,-0.44162 2.142728,-0.67277 3.108854,-2.4474 11.230355,1.36029 11.188618,1.38757 18.25625,6.74688 2.745052,3.1309 3.671094,5.00504 4.365625,8.59896 0.264583,5.1263 1.254823,10.18645 1.320969,15.27968 4.850693,20.06424 6.726771,34.70452 8.270172,54.63646 -0.57326,10.05417 -1.411108,14.15521 -6.879162,21.43125 -5.55625,5.60034 -10.31875,7.8934 -17.859375,10.84791 -7.805208,1.74184 -11.509375,1.76389 -18.653125,0.46302 -6.32795,-1.67569 -10.384244,-5.1794 -14.221351,-10.58333 -4.882794,-8.38114 -5.236545,-14.94896 -7.408333,-22.62187 -0.782726,-9.55807 -1.367014,-19.31459 -2.050521,-28.97188 l 2.38125,-0.39687 c -0.0441,-0.50712 -0.08819,-1.01423 -0.132292,-1.52135 l -2.38125,-0.99219 v -17.19792 c 0.617361,-1.6316 1.234723,-3.26319 1.852084,-4.89479 l 0.926041,-18.1901 c 0.496094,-3.10887 1.256771,-4.69638 3.175,-6.35004 z"
id="path882"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccccccccc" />
<path
sodipodi:type="arc"
style="display:inline;opacity:1;fill:none;fill-opacity:0.39215686;stroke:#babdb6;stroke-width:3.62082291;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="led0"
sodipodi:cx="64.507607"
sodipodi:cy="278.93338"
sodipodi:rx="6.5174346"
sodipodi:ry="6.5174408"
d="m 69.116129,274.32485 a 6.5174346,6.5174408 0 0 1 0,9.21706 6.5174346,6.5174408 0 0 1 -9.217044,0 6.5174346,6.5174408 0 0 1 -10e-7,-9.21706"
sodipodi:start="5.4977871"
sodipodi:end="3.9269907"
sodipodi:open="true"
sodipodi:arc-type="arc"
inkscape:label="#led1" />
<path
style="display:inline;opacity:1;fill:none;stroke:#babdb6;stroke-width:0.51011664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 63.998032,175.33704 c -0.0617,17.18181 0,37.8177 0,37.8177 v 0"
id="path4530-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<rect
style="display:inline;opacity:1;fill:#eeeeec;fill-opacity:1;stroke:#bfc2bb;stroke-width:0.65934163;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="button2"
width="8.6572962"
height="16.992365"
x="59.667027"
y="183.8551"
ry="1.5045637"
inkscape:label="#rect4615"
rx="2.8998742" />
<rect
style="display:inline;opacity:1;fill:#d3d3ce;fill-opacity:1;stroke:#bfc2bb;stroke-width:0.51011665;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="button5"
width="4.0773749"
height="11.664907"
x="61.934288"
y="213.306"
ry="0.74915975"
inkscape:label="#rect4615"
rx="0.63142258" />
<path
style="fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.65934163;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 92.234711,203.24519 c 0.280629,9.51034 -0.467724,16.09741 -0.467724,24.43845 -0.763945,13.64188 -1.153714,9.79098 -1.590254,28.48425 -0.04677,3.7028 1.344699,5.74518 2.50231,6.78196 1.157611,1.03679 4.41997,3.85091 6.618261,5.14494 0.941986,-4.54444 1.338226,-4.86758 1.335156,-10.49869 -0.4989,-10.35224 -1.350744,-19.81747 -3.369743,-31.52609 -1.652616,-7.76419 -1.878682,-12.53495 -5.028008,-22.82482 z"
id="path959"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccsccccc" />
<path
style="fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.65934163;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 37.603906,265.61379 c 1.378038,-1.69774 1.896181,-2.56866 2.447396,-4.49791 0.275607,-1.59853 0.319704,-2.27101 0.132291,-3.70417 -0.176389,-0.97014 -0.352777,-1.94028 -0.529166,-2.91042 -0.352778,0.022 -0.705556,0.0441 -1.058334,0.0661 -1.113455,-0.31971 -1.631597,-0.93707 -2.248958,-1.65365 -0.429948,-0.89297 -0.859896,-1.78593 -1.289844,-2.6789 0.176389,2.30408 0.352778,4.60816 0.529167,6.91224 0.672483,2.82224 1.344965,5.64447 2.017448,8.46671 z"
id="path961"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#d3d3ce;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.51011665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 39.662795,224.50314 c -1.418755,-15.53616 -1.294028,-30.04332 -0.748352,-45.27546 7.464057,-5.23848 10.578303,-5.75298 20.392662,-7.01583 0.604141,2.15932 2.552981,2.88039 4.583673,2.89988 0.06236,2.93106 -0.0039,5.75688 0.05847,8.68793 -0.966626,0.0156 -1.617539,-0.0389 -2.677709,0.15206 -0.576857,0.12082 -1.668207,0.59244 -1.683798,1.44993 0.03118,4.73958 0.06237,9.47916 0.09355,14.21874 0.428974,0.80223 0.791803,1.0753 1.683798,1.21608 h 2.666014 c 0.09354,3.89768 -0.04677,7.79536 0.04677,11.69304 -1.777343,0.0624 -3.554686,0.12473 -5.332029,0.18709 -4.677216,3.30523 -9.354432,6.61047 -14.031648,9.9157 -1.948383,1.15278 -3.036871,1.77639 -5.051401,1.87084 z"
id="button0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccc"
inkscape:label="#path971" />
<path
style="display:inline;opacity:1;fill:#d3d3ce;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.51011664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 88.538966,224.46383 c 1.418756,-15.53616 -0.763946,-29.5756 -1.309622,-44.80774 -6.341526,-5.61266 -8.520329,-6.2207 -18.334688,-7.48355 -0.604141,2.15932 -2.833614,2.83362 -4.864306,2.85311 -0.06236,2.93106 0.284533,5.80365 0.222163,8.7347 0.966626,0.0156 1.617539,-0.0389 2.677709,0.15206 0.576857,0.12082 1.668207,0.59244 1.683798,1.44993 -0.03118,4.73958 -0.06237,9.47916 -0.09355,14.21874 -0.428974,0.80223 -0.791803,1.0753 -1.683798,1.21608 h -2.80633 c -0.09354,3.89768 0.187088,7.79536 0.09354,11.69304 1.777343,0.0624 3.554686,0.12473 5.332029,0.18709 4.677216,3.30523 9.354432,6.61047 14.031649,9.9157 1.948382,1.15278 3.036871,1.77639 5.0514,1.87084 z"
id="button1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccc"
inkscape:label="#path971-5" />
<path
style="fill:#d3d3ce;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.51011664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 39.721262,254.48409 c -2.127995,-12.76601 -2.492187,-15.11204 -3.531298,-26.68352 -0.880877,0.16371 -1.761753,0.32741 -2.64263,0.49111 0.510597,7.26528 1.021194,14.53055 1.531791,21.79583 0.415673,1.21059 0.673654,1.8504 1.39147,2.98173 0.557369,0.65481 1.067966,1.08745 1.882582,1.5084 0.738934,0.12313 0.851361,0.031 1.368085,-0.0935 z"
id="button3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
inkscape:label="#path998" />
<path
style="fill:#d3d3ce;fill-opacity:1;fill-rule:evenodd;stroke:#bfc2bb;stroke-width:0.51011664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1"
d="m 36.061341,226.30387 -2.595857,-0.95884 v -17.51617 l 2.128134,-4.89938 z"
id="button4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc"
inkscape:label="#path1000" />
<g
id="g27"
inkscape:label="#g84"
style="opacity:1">
<path
inkscape:label="#path42"
inkscape:connector-curvature="0"
id="led1"
d="m 60.202463,185.20746 c 0,14.31228 0,14.31228 0,14.31228"
style="fill:#c8c8c8;fill-opacity:1;stroke:#babdb6;stroke-width:0.23228861px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
inkscape:label="#path42"
inkscape:connector-curvature="0"
id="led0-3"
d="m 67.749483,185.21452 c 0,14.31228 0,14.31228 0,14.31228"
style="display:inline;opacity:1;fill:#c8c8c8;fill-opacity:1;stroke:#babdb6;stroke-width:0.23228861px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="Buttons"
inkscape:label="Buttons"
transform="translate(0,-2.6458338)"
style="display:inline">
<g
transform="matrix(-0.29294531,0,0,0.26458333,70.19679,-46.28282)"
style="display:inline"
id="button0-path"
inkscape:label="#g156">
<path
sodipodi:nodetypes="cc"
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 69.018882,250.50576 170.100828,0.008"
id="path966"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect976"
width="6.999999"
height="6.999999"
x="65.211685"
y="247.25577" />
<rect
y="250.01747"
x="238.66302"
height="1"
width="1"
id="button0-leader"
style="color:#000000;text-align:end;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect875" />
</g>
<g
transform="matrix(0.26458333,0,0,0.26458333,40.502648,-25.152234)"
style="display:inline"
id="button1-path"
inkscape:label="#g146">
<path
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 336.41912,170.11088 -197.26264,0.0828"
id="path51"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect53"
width="6.999999"
height="6.999999"
x="137"
y="166.75" />
<rect
y="169.61206"
x="335.92694"
height="1"
width="1"
id="button1-leader"
style="color:#000000;text-align:start;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect871" />
</g>
<g
transform="matrix(0.26458333,0,0,0.26458333,39.927878,-13.516602)"
style="display:inline"
id="button2-path"
inkscape:label="#g146">
<path
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="M 338.62224,171.07963 91.069203,171.06803"
id="path51-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect53-3"
width="6.999999"
height="6.999999"
x="87.596474"
y="167.57452" />
<rect
y="170.56519"
x="338.10663"
height="1"
width="1"
id="button2-leader"
style="color:#000000;text-align:start;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect871" />
</g>
<g
transform="matrix(0.26458333,0,0,0.26458333,39.855422,10.357346)"
style="display:inline"
id="button5-path"
inkscape:label="#g146">
<path
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="M 338.91912,170.14213 91.343981,170.50618"
id="path51-2-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect53-3-4"
width="6.999999"
height="6.999999"
x="88"
y="167.375" />
<rect
y="169.65894"
x="338.32538"
height="1"
width="1"
id="button5-leader"
style="color:#000000;text-align:start;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect871" />
</g>
<g
transform="matrix(-0.29294531,0,0,0.26458333,70.354375,-10.600792)"
style="display:inline"
id="button4-path"
inkscape:label="#g156">
<path
sodipodi:nodetypes="cc"
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 121.40352,250.50576 118.2207,0.0352"
id="path966-1"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect976-3"
width="6.999999"
height="6.999999"
x="118.01969"
y="247.06827" />
<rect
y="250.06044"
x="239.16049"
height="1"
width="1"
id="button4-leader"
style="color:#000000;text-align:end;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect875" />
</g>
<g
transform="matrix(-0.29294531,0,0,0.26458333,70.260832,1.1857932)"
style="display:inline"
id="button3-path"
inkscape:label="#g156">
<path
sodipodi:nodetypes="cc"
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 119.59715,250.50576 120.02707,0.0352"
id="path966-2"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect976-8"
width="6.999999"
height="6.999999"
x="116.24155"
y="247.19327" />
<rect
y="250.00575"
x="238.62422"
height="1"
width="1"
id="button3-leader"
style="color:#000000;text-align:end;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect875" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="LEDs"
inkscape:label="LEDs"
transform="translate(0,-2.6458338)"
style="display:inline">
<g
transform="matrix(-0.29294531,0,0,0.26458333,69.912779,-34.520744)"
style="display:inline"
id="led1-path"
inkscape:label="#g156">
<path
sodipodi:nodetypes="cc"
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 33.260958,250.40632 204.900782,0.0964"
id="path966-0"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect976-2"
width="6.999999"
height="6.999999"
x="29.527279"
y="246.99062" />
<rect
y="249.97328"
x="237.64519"
height="1"
width="1"
id="led1-leader"
style="color:#000000;text-align:end;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect875" />
</g>
<g
transform="matrix(-0.29294531,0,0,0.26458333,69.953208,49.201431)"
style="display:inline"
id="led0-path"
inkscape:label="#g156">
<path
sodipodi:nodetypes="cc"
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
d="m 19.28901,250.49471 219.01243,0.008"
id="path966-0-2"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;overflow:visible;opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
id="rect976-2-1"
width="6.999999"
height="6.999999"
x="16.834169"
y="246.63705" />
<rect
y="249.97328"
x="237.7849"
height="1"
width="1"
id="led0-leader"
style="color:#000000;text-align:end;overflow:visible;vector-effect:none;fill:#888a85;fill-opacity:1;stroke:none;stroke-linecap:round"
inkscape:label="#rect875" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -132,6 +132,7 @@ src_libratbag = [
'src/driver-logitech-g300.c',
'src/driver-roccat.c',
'src/driver-gskill.c',
'src/driver-steelseries.c',
'src/driver-test.c',
'src/libratbag.c',
'src/libratbag.h',
@@ -270,6 +271,7 @@ data_files = files(
'data/devices/logitech-T650.device',
'data/devices/logitech-Wireless-Touchpad.device',
'data/devices/roccat-kone-xtd.device',
'data/devices/steelseries-rival-310.device',
)
install_data(data_files,
@@ -308,6 +310,7 @@ gnome_svg_files = files(
'data/gnome/logitech-g9.svg',
'data/gnome/logitech-g900.svg',
'data/gnome/roccat-kone-xtd.svg',
'data/gnome/steelseries-rival310.svg',
)
install_data(gnome_svg_files,
install_dir : join_paths(get_option('datadir'), 'libratbag', 'gnome'))

273
src/driver-steelseries.c Normal file
View File

@@ -0,0 +1,273 @@
/*
* Copyright © 2017 Thomas Hindoe Paaboel Andersen.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <libevdev/libevdev.h>
#include <linux/input.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "libratbag-private.h"
#include "libratbag-hidraw.h"
#include "hidpp-generic.h"
#define STEELSERIES_NUM_PROFILES 1
#define STEELSERIES_NUM_BUTTONS 6
#define STEELSERIES_NUM_DPI 2
#define STEELSERIES_NUM_LED 2
#define STEELSERIES_DPI_MIN 100
#define STEELSERIES_DPI_MAX 12000
/* not sure these are used for */
#define STEELSERIES_REPORT_ID_1 0x01
#define STEELSERIES_REPORT_ID_2 0x02
#define STEELSERIES_REPORT_SIZE 64
#define STEELSERIES_ID_DPI 0x53
#define STEELSERIES_ID_REPORT_RATE 0x54
#define STEELSERIES_ID_LED 0x5b
#define STEELSERIES_ID_SAVE 0x59
static int
steelseries_test_hidraw(struct ratbag_device *device)
{
return ratbag_hidraw_has_report(device, 0x01);
}
static int
steelseries_probe(struct ratbag_device *device)
{
struct ratbag_profile *profile = NULL;
struct ratbag_resolution *resolution;
struct ratbag_button *button;
struct ratbag_led *led;
int rc;
rc = ratbag_find_hidraw(device, steelseries_test_hidraw);
if (rc)
return rc;
ratbag_device_init_profiles(device,
STEELSERIES_NUM_PROFILES,
STEELSERIES_NUM_DPI,
STEELSERIES_NUM_BUTTONS,
STEELSERIES_NUM_LED);
/* set these caps manually as they are not assumed with only 1 profile */
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_KEY);
ratbag_device_unset_capability(device, RATBAG_DEVICE_CAP_QUERY_CONFIGURATION);
/* The device does not support reading the current settings. Fall back
to some sensible defaults */
ratbag_device_for_each_profile(device, profile) {
profile->is_active = true;
ratbag_profile_for_each_resolution(profile, resolution) {
if (resolution->index == 0) {
resolution->is_active = true;
resolution->is_default = true;
}
resolution->dpi_x = 1000 * (1 + resolution->index);
resolution->dpi_y = 1000 * (1 + resolution->index);
resolution->hz = 1000;
ratbag_resolution_set_dpi_list_from_range(resolution,
STEELSERIES_DPI_MIN,
STEELSERIES_DPI_MAX);
}
ratbag_profile_for_each_button(profile, button) {
/* TODO */
}
ratbag_profile_for_each_led(profile, led) {
led->type = led->index == 0 ? RATBAG_LED_TYPE_LOGO : RATBAG_LED_TYPE_WHEEL;
led->mode = RATBAG_LED_ON;
led->colordepth = RATBAG_LED_COLORDEPTH_RGB_888;
led->color.red = 0;
led->color.green = 0;
led->color.blue = 255;
}
}
return 0;
}
static int
steelseries_write_dpi(struct ratbag_resolution *resolution)
{
struct ratbag_device *device = resolution->profile->device;
int ret;
uint8_t buf[STEELSERIES_REPORT_SIZE] = {0};
buf[0] = STEELSERIES_ID_DPI;
buf[2] = resolution->index + 1;
buf[3] = resolution->dpi_x / 100 - 1;
buf[6] = 0x42; /* not sure if needed */
ret = ratbag_hidraw_output_report(device, buf, sizeof(buf));
if (ret != sizeof(buf))
return ret;
return 0;
}
static int
steelseries_write_report_rate(struct ratbag_resolution *resolution)
{
struct ratbag_device *device = resolution->profile->device;
int ret;
uint8_t buf[STEELSERIES_REPORT_SIZE] = {0};
buf[0] = STEELSERIES_ID_REPORT_RATE;
buf[2] = 1000 / resolution->hz;
ret = ratbag_hidraw_output_report(device, buf, sizeof(buf));
if (ret != sizeof(buf))
return ret;
return 0;
}
static int
steelseries_write_led(struct ratbag_led *led)
{
struct ratbag_device *device = led->profile->device;
uint8_t buf[STEELSERIES_REPORT_SIZE] = {0};
uint16_t rate;
int ret;
rate = led->index == 0 ? 10000 : 5000; /* 0x1027 or 0x8813 */
buf[0] = STEELSERIES_ID_LED;
buf[2] = led->index;
/* not sure why the rate is set for the steady color or why it is
different for the two LEDs */
hidpp_set_unaligned_le_u16(&buf[3], rate);
/* not sure if these four are needed either */
buf[15] = 0x01;
buf[17] = 0x01;
buf[19] = 0x01;
buf[27] = 0x01;
buf[28] = buf[31] = led->color.red;
buf[29] = buf[32] = led->color.green;
buf[30] = buf[33] = led->color.blue;
ret = ratbag_hidraw_output_report(device, buf, sizeof(buf));
if (ret != sizeof(buf))
return ret;
return 0;
}
static int
steelseries_write_profile(struct ratbag_profile *profile)
{
struct ratbag_resolution *resolution;
struct ratbag_button *button;
struct ratbag_led *led;
int rc;
ratbag_profile_for_each_resolution(profile, resolution) {
rc = steelseries_write_dpi(resolution);
if (rc != 0)
return rc;
/* The same hz is used for all resolutions. Only write once. */
if (resolution->index > 0)
continue;
rc = steelseries_write_report_rate(resolution);
if (rc != 0)
return rc;
}
ratbag_profile_for_each_button(profile, button) {
/* TODO */
}
ratbag_profile_for_each_led(profile, led) {
if (!led->dirty)
continue;
rc = steelseries_write_led(led);
if (rc != 0)
return rc;
}
return 0;
}
static int
steelseries_commit(struct ratbag_device *device)
{
struct ratbag_profile *profile;
uint8_t buf[STEELSERIES_REPORT_SIZE] = {0};
int rc = 0;
list_for_each(profile, &device->profiles, link) {
if (!profile->dirty)
continue;
log_debug(device->ratbag,
"Profile %d changed, rewriting\n", profile->index);
rc = steelseries_write_profile(profile);
if (rc)
return rc;
/* persist the current settings on the device */
buf[0] = STEELSERIES_ID_SAVE;
rc = ratbag_hidraw_output_report(device, buf, sizeof(buf));
if (rc != sizeof(buf))
return rc;
}
return 0;
}
static void
steelseries_remove(struct ratbag_device *device)
{
ratbag_close_hidraw(device);
}
struct ratbag_driver steelseries_driver = {
.name = "SteelSeries",
.id = "steelseries",
.probe = steelseries_probe,
.remove = steelseries_remove,
.commit = steelseries_commit,
};

View File

@@ -46,7 +46,8 @@ enum driver {
ROCCAT,
ETEKCITY,
GSKILL,
LOGITECH_G300
LOGITECH_G300,
STEELSERIES,
};
struct data_hidpp20 {
@@ -161,6 +162,7 @@ static const struct driver_map {
{ ETEKCITY, "etekcity", NULL},
{ GSKILL, "gskill", NULL },
{ LOGITECH_G300, "logitech_g300", NULL},
{ STEELSERIES, "steelseries", NULL },
};
const char *

View File

@@ -578,6 +578,7 @@ struct ratbag_driver hidpp10_driver;
struct ratbag_driver logitech_g300_driver;
struct ratbag_driver roccat_driver;
struct ratbag_driver gskill_driver;
struct ratbag_driver steelseries_driver;
struct ratbag_device*
ratbag_device_new(struct ratbag *ratbag, struct udev_device *udev_device,

View File

@@ -585,6 +585,7 @@ ratbag_create_context(const struct ratbag_interface *interface,
ratbag_register_driver(ratbag, &logitech_g300_driver);
ratbag_register_driver(ratbag, &roccat_driver);
ratbag_register_driver(ratbag, &gskill_driver);
ratbag_register_driver(ratbag, &steelseries_driver);
return ratbag;
}