Homebrew WIP libusbhsfs - USB Mass Storage Class Host + Filesystem Mounter static library.

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,289
Trophies
1
Age
27
Location
Madrid, Spain
Website
github.com
XP
2,527
Country
Spain
Link: https://github.com/DarkMatterCore/libusbhsfs. Co-developed with XorTroll and Rhys Koedijk.

This is a static library for homebrew applications which is aimed at developers that wish to integrate USB Mass Storage (UMS) support into their projects.
  • Provides a very easy to use interface, which lets the application retrieve:
    • A user-mode status event to wait for UMS changes.
    • Total count of mounted devices.
    • List mounted devices.
  • Spans a background thread that's capable of:
    • Listening for UMS status changes (new device, device removed).
    • Starting logical units from each detected UMS device.
    • Automatically mounting any detected filesystems from the logical units in each detected UMS device.
      • Supports MBR/EBR/GPT/SFD partitioning schemes.
      • Supports FAT12, FAT16, FAT32, exFAT, NTFS*, EXT2*, EXT3* and EXT4* volumes.
    • Signaling the user-mode event to let the application know it detected some changes and processed them.
  • Support for variable-sized logical blocks and long (64-bit) logical block addresses.
  • Automatic devoptab device (un)registration, so you can use standard libc I/O calls on mounted filesystems.
  • Relative path support.
  • Dedicated 8 MiB buffer per each UMS device, which helps speed up data transfers.
  • Unlike fsp-usb, the library doesn't depend on using a custom "ams_mitm.kip" with Atmosphère - just link your homebrew application against it and it will work.
  • Licensed under the ISC License, so anyone can freely use it - even as part of private/closed-source projects. We really want developers to adopt this library.
* Only in GPL builds of the library. ISC licensed builds only offer FAT support.

I'll just say this once before someone throws the usual question: this doesn't open any possibility whatsoever to launch Switch games from a UMS device, and never will. Something like that demands system-wide UMS support, which this library clearly doesn't provide.

Please let me know what you think. :)
 
Last edited by DarkMatterCore,

iriez

Well-Known Member
Member
Joined
Oct 27, 2016
Messages
549
Trophies
0
Age
48
Website
www.xbins.org
XP
1,857
Country
United States
Finally! The other implementation was very quirky. Glad to see some alternative options and hope this is stable :)

Are there any file transfer limitations? I see it supports EXfat! This is great.
 
Last edited by iriez,

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,289
Trophies
1
Age
27
Location
Madrid, Spain
Website
github.com
XP
2,527
Country
Spain
Thank you all for your kind comments and support!

Please feel free to test it and report any bugs or feature requests. If they can be implemented, I'll gladly add them to our to-do list.

Aree there any file transfer limitations? I see it supports EXfat! This is great.

Only limitations inherent to the underlying filesystem used by the UMS device you're working with. That's why the listed UsbHsFsDevice elements include a fs_type field, to let developers workaround filesystem-specific limitations.

Other than that, the whole interface is pretty much filesystem-agnostic to the end-user.
 

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,289
Trophies
1
Age
27
Location
Madrid, Spain
Website
github.com
XP
2,527
Country
Spain
How high is the transfer speed of a common HDD? (seagate)

We performed benchmarks reading the first raw 128 MiB (concurrent reads) from each connected drive with logging enabled back when the Bulk-Only Transport driver was still being developed, and we got speeds between 4 and 6 seconds. We used portable Seagate HDDs and WD HDDs with custom enclosures. So we could be talking anywhere between ~21 and 32 MiB/s - which yes, is better than fsp-usb's performance.

Disabling debug logging makes transfers go even faster, but we can't properly do benchmarks without it. Even if you're using the example test application, there's a noticeable difference if you link it against the debug build of the library vs the release one.
 

nWo

The Game Master
Member
Joined
Oct 20, 2016
Messages
868
Trophies
0
Website
www.facebook.com
XP
2,392
Country
Mexico
Thank you, this is awesome. I just want this implemented so I can play music and movies from a USB on the TV, that would be ill. Then, run some classic games on retroarch, all of that without using up space on the SD card. As a matter of fact I still use from time to time my Wii to do these things, so it will be a great, great addition to be able to do it at last on the Switch.
 
General chit-chat
Help Users
  • Skelletonike @ Skelletonike:
    link doesn't work
    +2
  • Skelletonike @ Skelletonike:
    1H left, such a slow week.
  • Sonic Angel Knight @ Sonic Angel Knight:
    Okay, I had spaghetti :P
  • SylverReZ @ SylverReZ:
    Hope they made lots of spaget
  • K3N1 @ K3N1:
    Chill dog
  • SylverReZ @ SylverReZ:
    Chilli dog
  • Skelletonike @ Skelletonike:
    Damn, I'm loving the new zelda.
  • xtremegamer @ xtremegamer:
    loving the new zelda, i started a game, it was so fucking good, so i
    am waiting on my friend to get home so we can start a new one together
  • Skelletonike @ Skelletonike:
    I just dislike that they don't let me choose the voices before the game starts. Happened with botw as well, had to change to japanese and restart.
  • K3N1 @ K3N1:
    But the important question is can you choose gender
  • Skelletonike @ Skelletonike:
    Same way you can choose Gerald's gender.
  • Skelletonike @ Skelletonike:
    *Geralt, damn autocorrect.
  • Psionic Roshambo @ Psionic Roshambo:
    But can he be trans? Lol
  • K3N1 @ K3N1:
    Zelda transforms into link
  • Psionic Roshambo @ Psionic Roshambo:
    Link I'm not the princess your looking for.... *Pulls a crying game*
  • K3N1 @ K3N1:
    *skirt up* it's exactly what I always wanted
  • Skelletonike @ Skelletonike:
    Just scanned all my zelda amiibos, took a while but didn't get anything that cool, did get the lon lon ranch hylian fabrics though.
  • Skelletonike @ Skelletonike:
    It was pretty funny when I scanned wolf link and got a shit load of meat.
  • K3N1 @ K3N1:
    @Skelletonike, btw I ran that custom for mgs4 on the deck I'm amazed it got that far in game
  • K3N1 @ K3N1:
    Plug in*
  • K3N1 @ K3N1:
    Your favorite activity
    K3N1 @ K3N1: Your favorite activity