Reverse Engineering the DualShock 4
blog.the.al
blog.the.al
the controller seems refusing to boot
that's when I realized that my idea of what is a controller is completely obsoleteThat 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.
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.
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) directly exposed the buttons and potentiometers from the joystick, instead of talking to a microcontroller on it.
- 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-wh... - "MacBook air crashing when plugging a USB device"
- 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.
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.
And it's totally ok that those (any) "high-quality" driver can crash the system?
>Linux uses modules, some other BSD not.
Has nothing todo with modules, if it's loaded it's in kernel-space. Not others...OpenBSD is the ONE.
BTW: For those butt-hurt ones (that i blatantly attacked poor linux), it not just about linux but should we no create operating-systems where this is not possible? Just asking...
Example of microkernel: QNX.
Example of userspace driver: fuse.
I'm not familiar with the architecture of OpenBSD, does it run it's drivers in userspace?
No it's the BSD without modules.
>Example of microkernel: QNX.
Yes and minix, hurd and TrueUnix64 just some other examples.
And I remind you I helped with some OpenBSD ports such as Mednafen, so I am not saying this as a bluff. The mail list is clear.
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
Ah, I suspect this was a firmware update that got borked somehow. Maybe the cable was disconnected before the update could complete.
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.
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
I would generally critique the use of a checksum on this config data without a backup or ping-pong writing system specifically because in the case of a 1 bit failure on something critical like cal or configuration data, really you want the data anyway and just hope that the 1 bit wasn't that important and also be ok if the bit flips back again on the next go around.
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.
So plugging in a brand-name joystick caused a kernel panic. Gross.
You're right, it's not a good analogy. It's barely one at all.
On the plus side, you might attract a Quick Brown Fox!
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.
I think the only truly secure OS for this would be Hurd or SeL4+Genode.