Skip to content

Instantly share code, notes, and snippets.

@johndrinkwater
johndrinkwater / dualshock-research
Last active March 16, 2024 15:12
I’m interested in writing (or helping to spec out the protocol so someone else can write) the linux kernel driver for Sony’s DualShock 4 (PS4’s lovely controller) Currently using the output of HID RAW from a USB connected dualshock 4… For the gyro/touchpad discovery, I’ve just been using some terrible c code to throw numbers on the screen and it…
TADA, it’s `hexdump -v -e '64/1 "%02x" "\n"' < /dev/hidraw3`
No idea what the first byte is… but I’m going to assume its for device ID for the many users that are connected, but it probably has to be set by the connected machine?
01ff777f7f0800aa0000435dfdf1ff14000200c5ff0721150300000000001b000001fc9133a32990880428008000000080000000008000000080000000008000
↑↑↑↑
left stick, value, first field is horz (00 left), second field is vertical (00 top)
017f80ff61080064000059f2fdfffffbff0e00d107081e9bf600000000001b0000018e94b1b00690880428008000000080000000008000000080000000008000
↑↑↑↑
@johndrinkwater
johndrinkwater / gist:17a403b605480f4d7d6a
Created July 30, 2015 09:52
GNU units is awesome, but you have to fight the frontend to get the answers.
john@joran ~ ❯ units "50 sq metres" feet
Unknown unit 'sq'
john@joran ~ ❯ units "50 square metres" feet
Error in '50 square metres': Parse error
john@joran ~ ❯ units "50 square metres" in feet
Too many arguments (maybe you need quotes).
Try 'units --help' for more information.
john@joran ~ ❯ units "50 metres2" feet
conformability error
@johndrinkwater
johndrinkwater / gist:85e78dd353afda487a81c6a0e3903121
Created November 23, 2020 16:10
PlayStation(R)Camera adaptor, with PS4 camera plugged in.
dmesg
```
[9955406.126553] usb 1-2: new high-speed USB device number 46 using ehci-pci
[9955406.276182] usb 1-2: New USB device found, idVendor=054c, idProduct=0d0a
[9955406.276194] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[9955406.276202] usb 1-2: Product: PlayStation(R)Camera adaptor
[9955406.276209] usb 1-2: Manufacturer: Sony Interactive Entertainment
[9955406.277971] hub 1-2:1.0: USB hub found
[9955406.279259] hub 1-2:1.0: 2 ports detected
```
[9014643] usb 1-1: new high-speed USB device number 32 using ehci-pci
[9014643] usb 1-1: New USB device found, idVendor=054c, idProduct=0ce6
[9014643] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[9014643] usb 1-1: Product: Wireless Controller
[9014643] usb 1-1: Manufacturer: Sony Interactive Entertainment
[9014643] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1:1.3/0003:054C:0CE6.0006/input/input18
[9014643] hid-generic 0003:054C:0CE6.0006: input,hidraw5: USB HID v1.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:12.2-1/input3
@johndrinkwater
johndrinkwater / vzencode.py
Last active February 19, 2019 23:59
./vzextract.py -q tenfoot_sounds_all.zip.vz.513680104410158b10b2b94d4ef23c83e17b7c63_1224523
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pylzma, sys, os.path, zipfile, getopt, hashlib, datetime, time, struct, zlib
__version__ = "0.02"
stfu = False
# VZ files follow similar yet more compact formatting to xz
@johndrinkwater
johndrinkwater / gist:af0c81bb68a517d9e52db4d98af4d169
Created February 19, 2019 22:26
Does this make working vz files? probably not.
Using the scripts here https://gist.github.com/johndrinkwater/8944787
john@joran ~/code/vzencode/8944787 ±:master *% u= ❯ ./vzextract.py tenfoot_sounds_all.zip.vz.ffef2b2fc386819a842ea79484b966a937c2ca7e_1209792
Extracting tenfoot_sounds_all.zip.vz.ffef2b2fc386819a842ea79484b966a937c2ca7e_1209792 into tenfoot_sounds_all.zip
Extracting tenfoot_sounds_all.zip into .
john@joran ~/code/vzencode/8944787 ±:master *% u= ❯ la
total 1.3M
drwxrwxr-x 8 john 4.1k 2019-02-19 21:19 .git/
@johndrinkwater
johndrinkwater / gist:dae469baa3d63928a2d88dd8ee5da9fd
Created February 1, 2019 17:15
Something I didn’t get around to looking at before Home closed, but AlphaZone4 had store update dumps ( git@github.com:AlphaZone4/PSHomeData.git ) that I just parsed to put out all the Web-accessible data. Need to compare to our PS Home dump to see what files are missing – a good chunk.
http://asia.playstation.com/home/hk/cht/event/d/39841
http://eu.playstation.com
http://promo.software.eu.playstation.com/en_GB/campaign/lynx-marvin
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/056A1FB0-F72F42CE-AF5417A7-9DEEFB09.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/1280x720_dw1_stars.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/1280x720_dw2_stars_waveTwo.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/128x128_Rogo.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/1940sgal_scea.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/3C7EB7E1-E40842E9-A3DAA1D4-84E8E60E.png
http://scea-home.playstation.net/a.home/hosted/CommercePoints/Thumbnails/3D09B184-16D645E6-98867D49-E888ACC7.png
@johndrinkwater
johndrinkwater / gist:ab8359ddfb0e4e34498055531b80c592
Created February 1, 2019 17:46
Like https://gist.github.com/johndrinkwater/dae469baa3d63928a2d88dd8ee5da9fd, pulled out ‘Screens’ listed in the store files, these appear to be entirely Poster/Board related updates for scenes… which may help find scenes we missed?
Action1_ScreenID
Action2_ScreenID
Action_Billboard_01
Activity_Board_Casual
Activity_Board_Casual_Old
Activity_board_Screen
Activity_board_screen_sports
Adventure1_ScreenID
Adventure2_ScreenID
Avd_activity_board_screen
@johndrinkwater
johndrinkwater / bashrc.sh
Created December 20, 2018 10:33
Testing wget version to avoid: wget: unrecognised option '--hsts-file=…
wgetver="$(\wget -V | head -1 | cut -d' ' -f 3)"
wgetwant="1.17.0"
if [ "$(printf '%s\n' "$wgetwant" "$wgetver" | sort -V | head -n1)" = "$wgetwant" ]; then
alias wget="wget --hsts-file=~/settings/config/wget/wget-hsts"
fi
Before I realised recent-notifications had a denylist (dconf net.launchpad.indicator.notifications.blacklist ['indicator-sound']),
had created this patch to work around a bug in 15.10 indicator-sound:
bzr+ssh://bazaar.launchpad.net/+branch/recent-notifications/indicator/
```
--- src/notification.c 2015-10-23 21:51:59 +0000
+++ src/notification.c 2018-11-08 15:55:07 +0000
@@ -150,6 +150,10 @@
g_variant_unref(value);
value = NULL;