Emulate camera in waydroid

Hello,
I need to scan a QR-Code with an android app :unamused:

I installed waydroid in my librem5, but the camera in waydroid isn’t working. Have someone successfully mounted the camera in waydroid?

Alternatively: I’m fine if there is an emulated camera just rendering a screenshot as its video… Hopefully I’m not the first one who needs to scan a QR-code…

1 Like
1 Like

Without showing us the QR code or telling us the full contents of the QR code (because QR codes sometimes have sensitive information encoded within them) … can you give some idea of the nature of the QR code e.g. what its purpose is?

For example if you install the package zbar-tools (outside of Waydroid), you can photograph the QR code (outside of Waydroid, using the normal camera app) and then use the command
zbarimg -q --raw whatever.jpg
to see the contents of the QR code. In the contents of the QR code, the part before the first colon character (if there is one) will usually tell you something about the purpose of the QR code.

2 Likes

I believe the problem is a quite obvious. A lot of apps require access to camera to scan QR-codes for authentication, payment, etc. I’ve found one mention about using libcamera with waydroid and I was able to connect Librem5’s camera with libcamera recently. So, in principle, just one step needed to pass-through L5’s camera to waydroid, but in fact it requires to much time to spend for both sides: optimize and patch libcamera and rebuild and debug waydroid… There is no prediction about real dates. :man_shrugging:

1 Like

Currently I need to scan a QR using Signal to enable second device. Knowing the data content of this code won’t help, as I cannot enter it in the app. I expect, that there will be other apps in the future with this issue, so I hope, there will be a solution for waydroid.

I’ve tried several apps like pict2cam, but none of them works since android 11 dropped the support of selecting cameras. I was unable to downgrade to android 10. It is mentioned, that this apps works on rooted android, I tried to root my waydroid using Magisk on Waydroid, but the script failed on

sudo venv/bin/python3 main.py install magisk

with some Error sudo: Validating the account failed…

For the moment I gave up and searched my old android smartphone and installed signal there. I’ve bought a hosted matrix server, where several bridges are enabled and hope, I will not need the signal app anymore. On my desktop, signal lost connection a few weeks ago, as I haven’t used the app for a year… Annoying.

1 Like

You could ask the app developer to enable that as an alternative input option. (I have seen apps where the intention is that you scan a QR code but they do alternatively allow the contents of the QR code to be entered manually in a text input box.) There must be some mobile phones around the world where the camera has failed or is otherwise unusable (but for reasons that differ from the more niche problem here).

Perhaps there could be a virtual camera that is dedicated to supplying QR codes i.e. you feed the contents of the QR code into the virtual camera outside Waydroid and the virtual camera converts the QR code back into an image and supplies the image to the app inside Waydroid. While this is proposed just as a hacky workaround it would actually be more secure.

2 Likes