How to connect a device through USB-C port?

ML2 OS version: 1.4
MLSDK version: 1.4.0
Host OS: Windows

I want to connect a camera through the USB-C port on the Magic Leap and be able to access the data from the camera in a native app. I tried testing this by connecting a webcam through the USB-C port and the device displayed the prompt for how to connect, but the options for USB tethering and data/file transfer were grayed out and unselectable. The specific camera I need to use likely does not have android drivers.

Note that I need to use the camera I am trying to connect for my application, and not the built in camera on the Magic Leap. How would I go about getting the Magic Leap to allow access to the data from the camera so that I can then gain access to the video feed in a native app?

Hi @coop,

Welcome to the Magic Leap 2 Developer Forums. We are so grateful to have you here engaging with us.

Unfortunately, unless the camera has Android drivers, you will not be able to connect the camera via USB-C and obtain that data. However, you could try streaming the data from another device to the ML2 headset via WebRTC.

Let me know if you have any further questions.

Best,

El

Thank you for the insight!

Would there be any issues developing Android drivers for the camera, or would this be the same process as developing drivers for an Android phone?

Hi @coop,

As long as it has android drivers it should work just fine with our device.

Best,

El

Hi etucker,

I have another question. The device I am trying to use uses UVC drivers. I am able to see that UVC cameras can be used with Android here: External USB Cameras  |  Android Open Source Project

But I wanted to ask if it is possible to do this on the Magic Leap specifically. Is it possible to download UVC drivers to the Magic Leap 2?

Best,
Cooper

Hi @coop,

My first instinct tells me that this would be compatible. I will double check with the team, though.

Best,

El

Is this a blocker for you?

Hi etucker,

Yes, this is a primary component of our application of the device. We need to connect an external camera with capabilities that the onboard cameras do not have. This external camera is compatible with UVC drivers and has been demonstrated to work on an Android phone, but up to this point we have been unable to show the camera feed on the Magic Leap 2.

Thank you for the reply and for reaching out to the team,
Cooper

1 Like

To provide more information, when the UVC camera is connected, the Magic Leap opens a window that says USB Device - Camera Name Connected, but a moment later the text changes to USB Device - null Connected. The device is listed under Connected Devices as "Power from ML2 to Connected Device", and I cannot change this to any of the other connection options.

When trying to display the camera feed in an Android app for UVC cameras, it appears the app was able to detect the camera and correctly assign the resolution, but it cannot display the feed. We also tried this with a normal UVC webcam, which connected and remained under the correct name rather than changing to null, but the app stated that the necessary permissions had not been granted to access the webcam. This webcam also displays as "Power from ML2 to Connected Device", and I am not sure if this means that the ML2 is not allowing data transfer between the cameras and the headset or if this is an app permissions issue.

Thank you for sharing this information. Would it be possible to share your overarching use case so that we can find the most comprehensive solution for you? You can also share with us privately.

Best,

El

etucker,

Our use case involves connecting a thermal camera to the headset in order to provide assistance to people with low vision.

The thermal camera we are using is the PureThermal Mini Pro with the Lepton 3.5 sensor, which can be found here. The difference being that our board is a version which has a microUSB port rather than a JST port.

This camera is not only UVC, as it has its own drivers for Linux, Windows, and MacOS, but it also has open source UVC firmware here. We have also previously worked on an Android phone app that was able to access this camera, through a modified Android USB Camera app made for the PureThermal camera.

As I had mentioned, when this camera is plugged into the port on the Compute Pack, the Magic Leap displays "USB Device - PureThermal v1.3.0 Connected" for a moment, but then a new prompt opens on top of the old one and instead displays "USB Device - null Connected". The PureThermal camera is from then on recognized as "null" instead of its correct name, such as in the Android UVC webcam apps we have tried to use. Do you know of any reason why this would happen? This does not happen with a regular webcam - the device recognizes the correct name for the webcam and doesn't reassign it to null.

Additionally, would there be any specific app permissions that need to be assigned in order to display the feed from a USB camera? We seemed to have app permissions issues when trying to test connectivity with a standard USB webcam on the Magic Leap.

I would add that we have now updated to the 1.5.0 version of the MLSDK.

I appreciate your help,
Cooper

etucker,

More information on what we have been able to find with further investigation into this issue.

It appears that the problem with the thermal camera matches a problem on Android 9 that was experienced for UVC cameras that do not have audio. The ticket for the problem can be seen here.

This is an OS issue that is leading to the device not being recognized, which leaves us unsure of how to fix it ourselves. I will attach the a text file of the error log for the issue.

Do you have any suggestions or potential fixes to this issue for the Magic Leap? Are there any updates or adjustments that can be made to the way the OS handles these devices? I know the Magic Leap is based on Android 10, and this is an Android 9 issue...is there some port of the OS that is based on Android 9?

usbdescriptorerrorlog.txt (45.4 KB)

Thank you for this information, I have submitted this request to our voice of customer team and mentioned that it is blocking your current development.

There are no known workarounds to support these types of devices outside of connecting it through an intermediate device that sends the data to the magic leap via bluetooth or wifi.

We will keep you posted as soon as we have more information.