News for hackers. Stuff that matters.
Re:Configure a Raspberry Pi as a USB Device by jrm4 on Saturday June 03, 2023 @11:56AM (#36177696)
OKAY. This is a step closer to my dream idea which I feel like should be possible but haven't figured out, and am curious if anyone has done anything like this:

I want to be able to wirelessly change the music on the "USB drive" in my car; i.e. the "drive" is actually an always-on computer, e.g. a Pi.

Change the music from the computer at home and be on my way?

Re:Configure a Raspberry Pi as a USB Device by oandrew on Saturday June 03, 2023 @12:36PM (#36178093)
Check this out: https://github.com/oandrew/ipod-gadget

It's a USB gadget kernel module that pretends to be an iPod to stream music to car/etc.

Re:Configure a Raspberry Pi as a USB Device by lukifer on Saturday June 03, 2023 @12:20PM (#36177918)
Here’s the solution I built for that, with a combination of on-device voice control, and a Bluetooth remote: https://github.com/lukifer/voicetunes

Something I’d still like to add is a USB OTG emulation of iOS/Android/iPod/etc, so that the currently playing track shows on the dash, steering wheel controls can be used, etc, but my last experimentation a couple years ago didn’t go anywhere. (All the open source stuff for emulating CarPlay and Android Auto seem to be for the other direction: the dash, not the device.)

Re:Configure a Raspberry Pi as a USB Device by jrm4 on Saturday June 03, 2023 @12:25PM (#36177967)
This is very cool - but also waaay more complicated than what I'm talking about here.

As in, I'm fine with the SYSTEM that plays music now (I have Toyota Entune) and I don't much want to mess with it.

I literally just want to be able to remotely change the files on the USB drive in the car -- without ever having to take it out of the car; that's it.

Re:Configure a Raspberry Pi as a USB Device by sidpatil on Saturday June 03, 2023 @12:43PM (#36178161)
If you have a spare Android phone with enough storage, and can configure it to mount as a USB mass storage device, maybe you can install an FTP server/Syncthing client/etc. on it, use that to manage the music remotely, and plug it in to your car so that it can see the library.
Re:Configure a Raspberry Pi as a USB Device by numpad0 on Saturday June 03, 2023 @04:55PM (#36180451)
Android phones usually don’t mount as actual storage devices. The interface is worded that way but it’s different protocol called MTP.
Re:Configure a Raspberry Pi as a USB Device by FrozenCow on Sunday June 04, 2023 @02:07AM (#36183457)
For many phones it is possible to change the exposed protocol from mtp to mass storage. Mass storage does need an image file with fat filesystem to work on most devices. It nowadays is not possible to expose the phones internal storage.
Re:Configure a Raspberry Pi as a USB Device by FrozenCow on Sunday June 04, 2023 @02:03AM (#36183450)
I've worked on DriveDroid. There were indeed people who have done this.

Best example of such a use-case was someone who wanted to make an old printing press fetch files its files from the internet. The press only had an interface for floppy disks. He replaced the floppy disk controller with a floppy emulator that exposed an USB port. Connected a phone with DriveDroid. Synced usb image files from the internet to be exposed over usb mass storage. The image files were fat images that hold the printing job files. They were generated by the server automatically. It worked pretty well from what I heard.

Re:Configure a Raspberry Pi as a USB Device by noisy_boy on Saturday June 03, 2023 @09:04PM (#36182029)
I don't have much idea about these things but is it possible to make a pi act as a usb drive? Then you can plug-in a wifi-enabled pi in the usb slot of your car which can store your music files and grant you tons of control.
Re:Configure a Raspberry Pi as a USB Device by KeplerBoy on Sunday June 04, 2023 @02:51AM (#36183611)
There are some SD-cards with Wifi Modules in them around (Toshiba FlashAir for example). Pop one of those in a USB adapter and you're done.

Similar solutions are also popular in the 3D printing space, look up Fysetc or BTT wifi sd cards.

Re:Configure a Raspberry Pi as a USB Device by stefan_ on Saturday June 03, 2023 @12:38PM (#36178108)
There is a mass storage gadget: https://linux-sunxi.org/USB_Gadget/Mass_storage
Re:Configure a Raspberry Pi as a USB Device by aloer on Saturday June 03, 2023 @12:44PM (#36178162)
I would also take a look at esp32 and possibly raspberry pi pico W as well.

For the esp32 there is this official example of what I think is faking a usb drive: https://github.com/espressif/arduino-esp32/blob/master/libra...

Not all ESP32s support USB OTG and I don’t have the correct one here atm to test with. Not sure how much more work would be needed to serve files from sd card.

You could then use a web server on the esp32 to transfer your files

Re:Configure a Raspberry Pi as a USB Device by rektide on Saturday June 03, 2023 @01:29PM (#36178632)
You could get a Toshiba FlashAir sd card, which can be read/write to from wifi. Plug that into a USB sd card adapter & away you go. Discontinued but there are some available about.
Re:Configure a Raspberry Pi as a USB Device by Firerouge on Saturday June 03, 2023 @01:39PM (#36178726)
These seem to be around $70 used for 16Gb at the moment. Are there any alternative options?
Re:Configure a Raspberry Pi as a USB Device by schwartzworld on Saturday June 03, 2023 @01:54PM (#36178857)
Search for "wifi sd card". There are a million of them
Re:Configure a Raspberry Pi as a USB Device by rektide on Saturday June 03, 2023 @02:06PM (#36178991)
Ebay seems to have better prices. $120 for 64GB. Big investment, not a ton of space, but if this is an mp3 collection that's a huge amount of music.

Pity the market keeps evaporating. Very cool product.

Re:Configure a Raspberry Pi as a USB Device by myself248 on Saturday June 03, 2023 @02:12PM (#36179049)
Yup, you can use the usb-gadget mass-storage framework to "plug in" a "block device" which is backed by a file on the computer. You can then "unplug" the device from the usb, and loop-mount it locally to manipulate its contents.

Nota bene, do not mount it two places at the same time!

Re:Configure a Raspberry Pi as a USB Device by adroitboss on Saturday June 03, 2023 @02:27PM (#36179209)
They are crazy expensive now, but this could have been easily done in the past with a Flash Air sd card and a USB adapter.
Re:Configure a Raspberry Pi as a USB Device by funkykong on Saturday June 03, 2023 @02:52PM (#36179446)
Perhaps a USB Armory (thumb drive computer) configured to expose a mass storage device with your music. Then push new music files to it over Bluetooth from your phone.
Re:Configure a Raspberry Pi as a USB Device by flutas on Saturday June 03, 2023 @05:02PM (#36180496)
I use this for my Teslas Dashcam (it was built for it), but it also has a feature to rsync music files from a network share every time it connects to the network and expose it as files on a USB drive to the host. Sounds like it would cover what you want, and it supports RPI Zero Ws natively.

https://github.com/marcone/teslausb

Re:Configure a Raspberry Pi as a USB Device by boneitis on Sunday June 04, 2023 @12:47AM (#36183184)
This isn't so much to build on your idea directly, but maybe some additional fodder will help further inspire ideas and yet more food for thought (for myself as well, and better yet, anyone else)..

I recently realized I can use a $15 USB capture card with an HDMI input on the other end to snag the video feed of a Pi or anything else that can output HDMI. As I use Linux, you can tap into the /dev/video<number> device as if it was a camera, using VLC/OBS. (There's also a paid app on Play store that allows me to also do this on my phone as the display side, using OTG. Would love to be able to use my tablet running a de-Googled LineageOS as well, but that'd entail figuring out how to crack/patch out Google's license checking library, and I haven't found any FOSS alternatives, ugh.)

From there, making the (my) dream happen would be if there was some convenient way to use the same device that's tapping into the video out as the keyboard/mouse input, much in the modal way of VMWare/VirtualBox, where it overtakes your input, and using the hotkeys to release when you want to switch back to your tasks on the host.

In particular, I have a Flipper Zero that doesn't get real use beyond novelty functions and have been wondering if that (or something like a ESP32/ESP8266 computer) could help facilitate that. My skillset is nowhere near that close to the metal.

At least, re: your post I'm piggybacking, and coming from knowing the capabilities of the Flipper Zero, I wonder if RubberDucky/BadUSB payloads could bring you any closer to meeting the spirit of your goal. Or, some sort of rsync like mechanism baked into the Pi when it (automatically) connects to a detected, saved network. Or, a RubberDucky/BadUSB payload on-demand to fire off an rsync.