0

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 high-speed.

Thanks in advance for any help.

  • I can read two things: I want to be able to automatically send it to another host in my network. and How can I tell when the PS4 is starting to interact with the Pi and how can I tell when it is done. Please add more details on your final goal or clarify this – Ephemeral May 20 at 8:31
  • Wonder if you can pick up any events via UDEV? I've seen triggers for USB insert / removal but no idea if anything can be triggered for this. – Andyroo May 20 at 11:03
  • 1
    @Ephemeral Sorry, I edited the question for clarification. 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 added the other details for context only. – hatsuo May 20 at 11:08
  • @Andyroo How would you do this? I tried udevadm monitor, but it doesn't log anything. – hatsuo May 20 at 11:10
  • Correction: I do get events, but only when issuing modprobe g_mass_storage and modprobe -r g_mass_storage on the RaspberryPi. What I need are events when I unmount the drive on the target system (PS4). – hatsuo May 20 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.