From 630f9ae3895d2433441f1ec6b9f424654d1b05da Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Tue, 3 Dec 2019 02:45:59 +1100 Subject: [PATCH] Also send/emulate device vendor/product codes --- input_over_ssh/client.py | 4 ++-- input_over_ssh/server.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/input_over_ssh/client.py b/input_over_ssh/client.py index 9299ac1..91c58ee 100644 --- a/input_over_ssh/client.py +++ b/input_over_ssh/client.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -PROTOCOL_VERSION = '1' +PROTOCOL_VERSION = '2' import argparse import asyncio @@ -38,7 +38,7 @@ def encode_device(device): cap_json = {} for k, v in cap.items(): cap_json[k] = [x if not isinstance(x, tuple) else [x[0], x[1]._asdict()] for x in v] - return {'name': device.name, 'capabilities': cap_json} + return {'name': device.name, 'capabilities': cap_json, 'vendor': device.info.vendor, 'product': device.info.product} async def run_forward(): # Find devices diff --git a/input_over_ssh/server.py b/input_over_ssh/server.py index 2018108..fdb4d73 100644 --- a/input_over_ssh/server.py +++ b/input_over_ssh/server.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -PROTOCOL_VERSION = '1' +PROTOCOL_VERSION = '2' import evdev import json @@ -30,7 +30,7 @@ for device_json in devices_json: capabilities = {} for k, v in device_json['capabilities'].items(): capabilities[int(k)] = [x if not isinstance(x, list) else (x[0], evdev.AbsInfo(**x[1])) for x in v] - devices.append(evdev.UInput(capabilities, name=device_json['name'] + ' (via input-over-ssh)')) + devices.append(evdev.UInput(capabilities, name=device_json['name'] + ' (via input-over-ssh)', vendor=device_json['vendor'], product=device_json['product'])) print('Device created')