9 ms·
Reverse Engineering the DualShock 4
- 1970-01-01 4y ago>And then, suddenly.. Caps Lock is blinking and the system is totally frozen :anguished:. So plugging in a brand-name joystick caused a kernel panic. Gross.
- somat 4y agoso... gross because sony should have better firmware or gross because linux should have a better usb stack, that is, it should never panic the kernel.
- 1970-01-01 4y agoIf you stepped into a dog turd and it leaked into your socks do you blame your open source shoe designer or your lazy dog?
- samwestdev 4y agoI don't get the analogy. Why is the dog supposed to be lazy? A dog turding on the street is by design. Maybe blaming the lazy dogs owner would be more appropriate.
- 1970-01-01 4y agoIt's not a good analogy but at the end of the day it's a bad Linux issue. Sony has no obligation to make sure it's driver will never halt a system. Linux does.
- spike021 4y agoSo... are you saying the dog's owner has no obligation to pick up their dog's poo? You're right, it's not a good analogy. It's barely one at all.
- 1970-01-01 4y agoOn their own land, no the owner can let them shit all around the house.
- ljm 4y agoIn what world do you step in your own dog’s shit and blame the dog for being lazy?
- 1970-01-01 4y agoHaha get a lazy dog and you'll know what I'm talking about
- yjftsjthsd-h 4y agoBoth, surely? The hardware shouldn't give bad input, and the kernel should tolerate it if it does. Edit: Sorry, I take it back: That data is weird, but not malformed; the hardware isn't out of line and I think the driver is fully at fault.
- dmurray 4y agoYeah, it would be the hardware's fault if it delivered 1000 volts. Delivering any sequence of 1s and 0s should maybe cause the driver to give up, but not to panic the kernel.
- anthk 4y agoUSB sucks everywhere. OpenBSD can panic over USB too. It happened to me. Hubs, faulty USB drives, Chinese gamepads, noname ElCheapo USB Ralink WiFi dongles with dubious designs... I think the only truly secure OS for this would be Hurd or SeL4+Genode.
- deleted 4y ago[deleted]
- mightypirate 4y ago[dead]
- deleted 4y ago[deleted]
- oplaadpunt 4y ago[flagged]
- deleted 4y ago[deleted]
- konih 4y agoThe emoji are fine imho. Nothing childish or unprofessional about that.
- bloqs 4y agoYou seem to have misread his specific criticism with a criticism of emoji in general?
- TillE 4y ago> childish I hate the use of face/body emoji, but my anecdotal experience is that the biggest users are age 40+, and younger people at least tend to be more creative with emoji.
- bloqs 4y agoCompletely agree. Specifically (emoji fans take note) it attempts to force a certain mood, when your writing should do that for you. Emojis are fine for adding some visual associaton at the end of text blocks or descriptive paragraphs, or used for a pictographic demonstration of something (even humour). Just gormless facial expressions at the end of everything is just simperingly weak communication.
- maxbond 4y agoCan we not critique pet peeves and nitpick style? This is how I interpret the guideline, "avoid generic tangents"; if critiquing the style of a piece doesn't help us to understand it better (as is sometimes the case, but isn't here), I don't think it's worth discussing on this forum (as it promotes snide conversation rather than curious conversation). In my experience working remotely, using lots of emoji is a professional expectation. Kind of like how ASL speakers are more expressive with their faces and bodies than English speakers, because they aren't employing vocal tone. Using lots of emoji prevents misunderstandings of tone (a frequent and avoidable source of bad feelings) and promotes camaraderie. Nothing unprofessional about that, but it may be from a different professional culture than you're familiar with.
- glitchc 4y agoNeat find. What could cause the calibration offset to be zero? Certainly it did not come this way from the factory. Any abuse/misuse of the controller would not cause it either. Ah, I suspect this was a firmware update that got borked somehow. Maybe the cable was disconnected before the update could complete.
- cesarb 4y ago> What could cause the calibration offset to be zero? A possible explanation can be found on part 4 of this post: > [...] if the checksum is not valid, there is a loop that clears out the flash [...] I suspect (but haven’t tried yet) that if the battery of the controller dies while it’s writing on the flash, at the next startup the checksum does not match and the DS4 gets totally messed up like this one. That is, according to that theory, it was trying to write something to the flash (perhaps while pairing?), and part of the write failed because the battery died. On the next boot, it detected a wrong checksum, and erased everything.
- glitchc 4y agoThanks for that, I missed it in TFA. But ouch, that feels like an extreme design choice. What's the logic here to erasing the flash on a failed checksum, or requiring a checksum in the first place? Is there a non-obvious security threat?
- ce4 4y agoThe issue is probably a missing A/B firmware update for the config section. If a firmware update needs to alter the calibration data or other rather static config, and that update process is interrupted by an empty battery then it can't recover. It should of course be more conservative in killing all of the config section... Or could reset to some sane default. Or have a copy of the old known good data around and restart the procedure
- AstralStorm 4y agoA properly made device would at least keep a spare copy just in case, there's more than enough space in flash for that, but no, Sony wants to sell more controllers.
- justusw 4y agoI just read all 4 parts and I have thoroughly enjoyed them. I am curious to hear if the debug console (TEPPOU, or gun in Japanese) works. Please keep us posted!
- deleted 4y ago[deleted]
- binkHN 4y agoMaybe I should send him a Stadia controller? Maybe someone will get some utility out of it with Google completely killing Stadia off.
- darknavi 4y agoDoes it have USB drivers?
- binkHN 4y agoWhile I've never tried it in that way, I understand it should function as a standard USB game controller when wired, but its real gem would be fully leveraging its wireless support.
- AstixAndBelix 4y agoThe problem is that Stadia controllers use wireless in the sense of WIFI, not bluetooth. This means that in order to make them work not only is the RE work even harder, but you'd probably have to create a completely new driver since I'm unaware of any other device that can input commands from the internet; whereas with bluetooth we already have extensive tools to deal with it
- AstralStorm 4y agoTechnically writing such a driver using ViGem should not be all that hard once you reverse the WiFi protocol this controller uses.
- yencabulator 4y agoIt's likely trying to talk HTTPS to Stadia servers, can't work with that without new firmware.
- yencabulator 4y agoIt seems the Stadia controller contains a Broadcom BCM43458 Bluetooth 4.2 chip. https://www.reddit.com/r/Stadia/comments/xwcedv/i_spent_10_hours_reverseengineering_the_stadia/ https://www.reddit.com/r/Stadia/comments/xwcedv/i_spent_10_h... Bonus: Windows Gamepad using phone USB as proxy: https://github.com/helloparthshah/StadiaWireless https://github.com/helloparthshah/StadiaWireless
- heavyset_go 4y agoIf whoever submitted this is the author, this is good content :)
- al_al 4y agoYes, thank you!
- slim 4y agothe controller seems refusing to boot that's when I realized that my idea of what is a controller is completely obsolete
- sabjut 4y agoHow come? Ever since controllers used Bluetooth they would need to use some sort of programmable microcontroller or cpu. Both of these things need to 'boot' at some point. And yes even microcontrollers have bootloaders.
- cesarb 4y agoA traditional videogame controller is not much more than a few switches and perhaps a few potentiometers, see for instance the pinout for the Master System: https://www.smspower.org/Development/ControllerPort https://www.smspower.org/Development/ControllerPort That is, someone who started playing videogames in the SMS/NES days might have formed a mental model of the controller being mostly a passive device, with at most a few active chips to multiplex the pins in the interface, to allow for more buttons than there are pins.
- unwind 4y agoSure (I was there) but the same can kind of be said about mice and keyboards, too. Ever since USB took off ~30 years ago and basically killed off raw I/O pins on the front of computers, human interface devices have required microcontrollers on board. Edit: added timeline.
- cesarb 4y ago> but the same can kind of be said about mice and keyboards, too. AFAIK, even old keyboards (AT and PS/2 connectors) already had a microcontroller, and the same was true of mice. The communication between the keyboard or mouse and the computer was through a serial protocol, instead of the computer directly reading the keyboard matrix or the mouse buttons and wheels. The exception might have been computers with built-in keyboards. But the joystick port (https://en.wikipedia.org/wiki/Game_port https://en.wikipedia.org/wiki/Game_port) directly exposed the buttons and potentiometers from the joystick, instead of talking to a microcontroller on it.
- nix23 4y agoThat's what i don't get with linux...having all drivers inside the kernel is madness, no wait...it's pure stupidity. No other Universal OS makes that...crash my system with a USB-Controller...that's some Windows 98 reliability(-issues) right there.
- capableweb 4y agoI don't think Linux is exclusive here, there are plenty of examples of both macOS and Windows also crashing when plugging in various accessories. - https://developer.apple.com/forums/thread/678644?page=5 https://developer.apple.com/forums/thread/678644?page=5 - " Big Sur panic when connect/disconnect usb-c dock " - https://forums.macrumors.com/threads/macbook-air-crashing-when-plugging-a-usb-device.2243724/ https://forums.macrumors.com/threads/macbook-air-crashing-wh... - "MacBook air crashing when plugging a USB device" - https://answers.microsoft.com/en-us/windows/forum/all/windows-freezing-when-i-plug-in-a-usb-device/d60783d6-29e4-4a6a-bc82-ea37f362b82d https://answers.microsoft.com/en-us/windows/forum/all/window... - " Windows freezing when I plug in a USB device" Try searching for "$operating-system crash when connect usb" for various OSes and distributions and you'll see it's a problem everywhere, not just Linux.
- anthk 4y agoI remember OpenBSD panicking over some USB hubs a few releases ago. USB is hell.
- thrdbndndn 4y agoYeah, crashes from hardware driver are fairly common on Windows. And without any surprise, USB is the most common one (I'd say network devices (Ethernet, Wifi, or BT) are a close second).
- anthk 4y agoLinux uses modules, some other BSD not. A faulty USB driver (specially storage related ones) can panic your BSD kernel with ease. With Linux you could blacklist lots of modules since forever easily, forbidding to load them. Try that with Windows or MacOS. Go buy some cheap WiFi adapter. Noth Atheros. Ralink, better. Often your favourite OS will panic/BSOD too.
- deleted 4y ago[deleted]
- Waterluvian 4y agoI love “fell down so hard” as a polite way to avoid saying, “someone got pwned and threw this baby at a wall.”
- SergeAx 4y ago> I wrote a fix for this bug in the linux driver and sent to the linux-kernel mailing list (linux-input), so that a DS4 with a broken calibration does not cause a kernel panic. I really admire people, who contribute their random findings to improve an open source software on their own time and resources. This is so wholesome.