I have a RaspberryPi Zero connected to my PS4 and want to use it like a smart Network USB stick. The ultimate goal of my project is, that I want to automatically send data to a specific host in my network when it get's written from my PS4 to the Pi. To achieve this, I would like to execute a script whenever the PS4 is done interacting with the Pi, which then can handle the network part.
I configured my RaspberryPi using OTG with g_mass_storage mode, which is working fine. The PS4 recognises the Pi as a Mass Storage Gadget and is able to read from / write to it.
But I am stuck at telling when the PS4 is done interacting with the Pi, so that I can safely end the USB connection.
So my question is, how can I tell when the PS4 is starting to interact with the Pi and how can I tell when it is done?
I tried to monitor the contents of
/sys/class/udc/20980000.usb/state, but it always says
configured, even when I tell the PS4 that I want to end the connection.
The same goes for
/sys/class/udc/20980000.usb/current_speed, which always says
Thanks in advance for any help.