friedkeenan/GoldtreePy

Release USB resource on return

MegaphoneJon opened this issue · 11 comments

I seem not to be able to install multiple NSPs without unplugging and plugging in my USB-C cable. My guess is that this is due to not releasing the USB resource when complete: https://stackoverflow.com/questions/25617039/usb-device-release

Sorry for getting back to this so late, I'm not used to people caring enough about my code to make an issue.

Can you give me more details about the errors you get? I've tried this on a different USB project with libnx and pyusb, but it didn't really affect anything in my experience, nor does it seem to affect anything when I add it to this project.

I'll need a couple of days before I have some time free to replicate the issue, at which point I can give you the backtrace.

Cool. Also please remember to tell me what happens on the Switch as well

Is this the usb.core.USBError: [Errno 32] Pipe error issue? i'm having this aswell, it would be nice if this could be fixed. it's very hard to use this otherwise. I have to force poweroff my switch (twice, because first time reboot i don't get display after goldleaf locks me into it) whenever it happens and i need to restart my computer because unplugging the cable doesn't fix it. Even after rebooting my computer and restarting my switch multiple times I can't seem to use it again.

@NekoNoor Could you try reinstalling pyusb and/or libusb? As far as I know it's nothing caused by my code

Still getting the same problem, even when it's the first nsp I'm installing. I haven't had this same error in tinfoil usb install but i've had it with goldtreepy even after reinstalling pyusb and libusb. I would use this all the time if it weren't for this fatal flaw. It's quite unusable like this.

Could you try using Fluffy with Goldleaf and see if that works? I'm sorry that you're having such a hard time with it, but I'm not sure what I can do

That just throws an error (with no debug information, so I don't think it even works on linux), no matter if it's the first nsp or not. So that's not even an option.

image

I can atleast get goldtreepy to consistently install nsps now by unplugging before each nsp install but that's more of an annoying workaround than an actual fix. It didn't use to do that before so I don't feel it's fair to just blame it on libusb/pyusb.

edit: actually unplugging before installing isn't even consistent, so it's still unusable.

Actually, it appears this is a known issue on goldleaf's side: XorTroll/Goldleaf#213 and not with goldtreepy or pyusb/libusb. Using a USB 2.0 is a much better workaround to the issue. I can install as many nsps as i want without it giving me an error. You can probably close this issue now.

Edit: I still got pipe 32 error after around 8 nsps in the middle of installing one but it happens less than when I have my switch plugged into a USB 3.0 port. i'm just gonna assume this is also goldleaf's fault and hope it's fixed soon. Idk if I was just lucky the first 8 times but it seems like it's just as unreliable using a usb 2.0 port as usb 3.0 now

I have just confirmed goldtree on windows exhibits the same behavior. so if you wrote the code to do the exact same thing, it's not surprising that the bug is existant on both.

I'm glad you figured out a way to make the problem less terrible. I think the underlying cause might not be Goldtree (mine or the original) or Goldleaf, but rather the wonkiness of libnx usbComms, as other USB projects I have done with libnx have had similar errors, and from speaking to other devs, it seems like that's a common thing.

I'll probably keep this open as I still don't know what error @MegaphoneJon is getting

I'm going to close this since I've gotten no information from @MegaphoneJon