Atmosphere-NX / Atmosphere

Atmosphère is a work-in-progress customized firmware for the Nintendo Switch.
GNU General Public License v2.0
14.38k stars 1.21k forks source link

haze USB compatibility issue #2357

Closed urherenow closed 2 months ago

urherenow commented 3 months ago

Bug Report

What's the issue you encountered?

USB connection works immediately with a USBC -> USB A cable, but is not recognized at all using a USB C -> USB C cable. This same cable works in hekate/NYX, and it also works in haze, if I plug it into a C<->A adapter.

How can the issue be reproduced?

1) Open haze
2) Plug in USB C -> USB C cable
3) Nothing happens

Crash Report

N/A

System Firmware Version

18.1.0

Environment?

Additional context?

N/A

SciresM commented 2 months ago

I don't actually know enough about the usb APIs to debug this; I wouldn't expect that type-of-cable would be relevant to the usage of usb:ds. Do other homebrew tools making use of usb:ds work?

Also, worth noting that haze's author(/nominal maintainer) is no longer working on Switch-related projects, so haze stuff is harder than other modules to get sorted.

urherenow commented 2 months ago

Honestly I don’t know. I just know it works without an adapter through nyx. I wonder if @CTCaer can chime in. Is source available for haze?

SciresM commented 2 months ago

@urherenow Yeah, haze is open source. USB init/config is done here: https://github.com/Atmosphere-NX/Atmosphere/blob/master/troposphere/haze/source/usb_session.cpp#L72

SciresM commented 2 months ago

Whoops, didn't mean to close this.

urherenow commented 2 months ago

From CTCaer: "nyx forces device mode by not setting the spdsrc bit which allows power to be enabled for otg. your pc probably favors device mode. there are several laptops/dekstops that have that bs behavior. it's possible to do a role swap if I remember with hos ipc"

So I'm not sure if this is something I can correct on my pc and laptop, and I'm not sure if it's related to hos behavior or haze's behavior.

urherenow commented 2 months ago

This could go either way, I guess. On one hand, there might be a way to force the correct mode as CTCaer said, and on the other hand, this is ultimately a result of my PC's behavior. It's up to you to decide if the juice is worth the squeeze, but keep in mind that it's several brands that do this, and not just mine (my PC is AMD-based, and my laptop is Intel...).

If you might be interested in looking into this in the future, please feel free to re-open, but I'll close the issue since it's way over my head and not necessarily a bug.

SciresM commented 2 months ago

@urherenow i don't think any such IPC exists? USB provides usb:ds for device mode and usb:hs for host mode, and we use usb:ds and configure the same way Nintendo does. IPC reference here: https://switchbrew.org/wiki/USB_services -- I don't see anything that does what you say.

If you have a specific change to make that would help I would do so, but yeah not actually sure what you want is even possible.