1
Fork 0

Also send/emulate device vendor/product codes

This commit is contained in:
RunasSudo 2019-12-03 02:45:59 +11:00
parent cbf6509b74
commit 630f9ae389
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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')