2b3744a344
- Added Gyroscope and accelerometer support. Now the 3DS sends the data of the Gyroscope and accelerometer to the IP address - Now the python script uses `python-evdev` instead of `python-uinput`. It support more EVENTS and INPUT_PROPS, so the gyroscope and accelerometer is identified as an gyro and accel device. Just like the DualShock linux driver (hid-playstation.c) - Python script has now a debug variable, if it's enabled it will show some debug info, like the state of the keys and sensors X,Y,Z positions. - Added some explanations on the python script to make development more easier (Mostly for myself)
42 lines
1 KiB
Python
Executable file
42 lines
1 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# Compatible with both Python 2.7.6 and 3.4.3
|
|
|
|
from __future__ import print_function
|
|
import socket, struct, time
|
|
|
|
##########################################################
|
|
# CONFIGURABLE REGION START - Don't touch anything above #
|
|
##########################################################
|
|
port = 42020
|
|
|
|
########################################################
|
|
# CONFIGURABLE REGION END - Don't touch anything below #
|
|
########################################################
|
|
|
|
def pprint(obj):
|
|
import pprint
|
|
pprint.PrettyPrinter().pprint(obj)
|
|
|
|
class x: pass
|
|
|
|
command = x()
|
|
command.CONNECT = 0
|
|
command.KEYS = 1
|
|
command.SCREENSHOT = 2
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
sock.bind(("", port))
|
|
|
|
while True:
|
|
rawdata, addr = sock.recvfrom(4092)
|
|
rawdata = bytearray(rawdata)
|
|
print("received message", rawdata)
|
|
|
|
if rawdata[0]==command.CONNECT:
|
|
print("Connected with 3DS at address",addr)
|
|
pass # CONNECT packets are empty
|
|
|
|
#pprint(data)
|
|
|
|
if rawdata[0]==command.SCREENSHOT:
|
|
pass # unused by both 3DS and PC applications
|