yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Thanks for mentioning that. Yes the PBRP is popular and I know of at least 1 of the 'tool' guides switched to that. I don't think any of us have done any kind of empirical testing though. We've only used 1 phone, ours, and once we got it to work, we didn't test 'other' ways (or versions of TWRP). Experiences are varied, working vs not working. But trying it shouldn't hurt anything.

Maybe at some time we'll have a better understanding of why experiences vary.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Ajakazema:
It works!! Tnx mate.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Rafael Cardoso:
Thank you, I applied this on my phone and it worked successfully. After a moment I received an ota update and I could install without problems.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] vagsvag:
New ota update?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Neel@1234:
Must be the older one. I didn't receive any new OTA update.

---------- Post added at 08:46 AM ---------- Previous post was at 08:44 AM ----------

Can you check and confirm if you still have camera2api support after the OTA update?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
You will definitely still have cam2api support after updates. If you research the way the 'setprop persist' commands work, they make changes to the 'Data' partition, which then gets propagated to relevant tables. Because 'Data' doesn't change with an update, the settings 'persist'.

Cheers
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] juve21:
Okay reading this thread I am definitely tempted to try this. Had the Xiaomi Mi A1 last year and it was so easy to enable Camera2api, enabled the first week I got the phone, and the phone still recieves OTA's and still has the Camera2api. I think this method is the same as that one although a little bit more complicated to enable it compared to the Mi A1.

If any of the more experienced users could send me some concrete steps to do the Unlocking bootloader and having fastboot that supports dual slot phones, that would be a life saver for me since there are different guides there and Im not sure what to do. Im on Stock October 5 build, no root no anything, exactly how I got the phone never changed anything. I have a software update notification for some days that I didn't install since I was not sure if this method would work if I updated.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
1) You can do the update right now, or not, won't matter. While yes, some cam2api enable methods need a specific version of the OS running, this one does not.

2) The easiest way to determine if your version of fastboot supports dual slots is to type in 'fastboot -h' and then look for the following in the output: ' --set-active[=SLOT] '. That tells you dual slots are supported.

3) Unlocking the bootloader with the MiA2 is quite simple. But! remember! doing this will do a factory reset of the phone, so backup pictures etc etc. Then you have to reinstall apps you like etc.

a) In developer options, enable adb (of course) and also enable OEM unlock. connect the phone with adb and type 'adb reboot bootloader'. You'll now be in fastboot mode. Type 'fastboot oem unlock'. The device will wipe, reboot, and bootloader will be unlocked.

Cheers
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] juve21:
Okay, thank you. Here is what I did.

I unlocked the bootloader, than after phone erased all data I went to settings turned adb usb debugging on, then I connected with adb, and typed adb reboot bootloader,

After, I typed fastboot getvar current-slot, adb said current-slot: b

Then I typed adb set_active a

Then I typed fastboot boot TWRP.img after renaming, and adb said this:

downloading 'boot.img'...

OKAY [ 0.839s]

booting...

OKAY [ 10.272s]

finished. total time: 11.113s

But the phone is stuck on a white screen with a colorful line swiping from left to right all the time.

What should I now please.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
[MENTION=9534659]juve21[/MENTION]

can you type in fastboot devices and does fastboot see the phone? If yes, use fastboot to reset the active partition to b, then do fastboot reboot. that will get you back to 'normal'.

If fastboot doesn't see the phone, press and hold the power button and up vol until the phone reboots. Then go back to fastboot and reset b active.

It sounds like you've run into the same problems others have, associated with Windows drivers, twrp being booted vs being used as a recovery app, etc.

I'd suggest trying PBRP mentioned a few messages ago, it seems to have better success with windows.

cheers

Edit: just thought, it's probably more likely that adb might see the device, try adb devices, if that works do adb reboot bootloader and set active back to b, get back to normal first.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] juve21:
Adb did not recognize phone when I wrote adb devices

I did get back to boot the phone to normal again and I am not sure how. I changed the usb cable port on the pc and I did hold the power and vol up button, and somehow the phone started.

Now when I tybe adb devices it recognizes the device, but when I type adb reboot bootloader, it puts the phone on fastboot mode and then after that it doesnt recognize the phone anymore.

Also I searched the PBRP thread and I can not find a twrp.img to download. That method of installing TWRP is very different as I can see. I do not understand that.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
It sounds like at least yer back to normal, that's a good thing.

So first, PBRP **IS** TWRP, just another version of it - with a different name. Some, on windows, said it worked but twrp didn't (you would type fastboot boot pbrp.img).

I"m afraid I can't help much as I run Linux, not windows. But, you do for sure need to have the right kind of usb cable for this (or anything like it). DON'T use one of those thin wire cables that work basically only for charging the phone. One of the thicker wire ones is needed as you are transferring data, not just an electrical pulse.

I do remember reading some talking about a usb 2.0 port worked where a 3.0 wouldn't. It's worth a shot. It does sound like it's a problem with windows, windows usb drivers (version), and usb ports.

cheers
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] juve21:
Thanks for the quick responses. :good:

About the cable, I use the original cable that came with the phone box.

Okay, seems this thing is not for me. Anyway, do you know how I can get back to stock, locking the bootloader again, thus returning the phone like it was before this, because there is no need to leave it unlocked If I am not able to enable camera2api.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Yes, it's easy to do. But, first, I'd suggest you reboot windows. It's not the most stable OS and rebooting will hopefully reset everything and the following will work;

All that's needed to get back is get into fastboot again (make sure you're reset to active is b - whatever was original), then type 'fastboot oem lock'.

It will wipe again, reset to factory, and lock the bootloader.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Neel@1234:
I just read some documentation, and got it. Pretty nice implementation.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Jamesismo:
Hello, sorry if it is obvious but I have to ask, when unlocking the BL it will delete my data? and after all the procedure is done you must not lock the BL? Thanks in advance.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Yes, unlocking the BL will essentially set the phone back to what it was brand new. Think of it like this; if someone stole your phone, but you had it pin / fp locked. Would you want them to be able to somehow use fastboot and unlock it and get to any data you had on the device?

Neither do the Mfg's. When doing a BL unlock, or a BL lock, it wipes everything back to factory.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Jamesismo:
Thanks a lot for your quick and respectful answer, and yes, it makes sense!

In case I decide to follow this procedure, I'll leave feedback. Thanks again. :fingers-crossed:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] juve21:
I DID IT!

Okay so before relocking the bootloader I thought I'd give it another try. I did manage to find PBRP's recovery.img file, downloaded it and booted the device. ADB still recognized the phone and than I run the commands:

adb shell

setprop persist.camera.HAL3.enabled 1

setprop persist.camera.eis.enable 1

exit

adb reboot bootloader

fastboot set_active b

fastboot reboot

And after installing the Gcam apk, it WAS WORKING.

Thank you so much to the OP [MENTION=2129545]AsItLies[/MENTION]

All I have to do now is Update the phone through the OTA which I had waiting on the notification bar before doing all of this ADB stuff. Hope camera2api remains after this update.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
[MENTION=9534659]juve21[/MENTION] Congrats, good for you.

"Hope camera2api remains after this update."

It will remain.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] salmonthefish:
Hey guys, has anyone successfully done this using terminal on macos? I got to "adb devices" "fastboot devices" "fastboot oem unlock" working. and also the detecting which slot (A or B) the phone is in. but when it comes to booting into TWRP it did not work. I'm doing "fastboot boot twrp.img" because that is what i the recovery img set to. but failed ( did set slot A to be active). Do I have to the cd directory to where I have the twrp.img and fastboot boot twrp.img from there? Any advice would be welcome.

Sorry for the lengthy post
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Yes TWRP image has to be in the directory.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
hi,

tried your method. my active partition was b. executed all commands and camera2api was enabled. checked with camera2api probe app. level 3 was on. installed gcam and it worked. then i locked the bootloader. It erased everything and i lost the camer2api. got a security update of nov 5. isntalled it. then again i unlocked bootloader. and executed all commands. but now camera2api is not enabled no matter how many times i did.

did updating november 5 patch disabled the trick??
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Well, first off, there's no need to re-lock the bootloader. You will still receive updates (including security patches), with the bootloader unlocked.

I don't know if the Nov patch did anything to disable setting the cam2api this way, but I highly doubt it. More than likely something is going wrong in your attempts to 'do it again' (which again, u didn't have to do).

I have no way of testing this, sold my A2, so we'll have to wait for others to chime in re attempting this with a new device and Nov patch.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
yeah. there was no need to relock but i did it thinking it will persist. my bad.

after relocking. i unlocked again and repeated the steps except that my current slot is 'a' instead of 'b'. so skipped the set_active commands. i did exactly like i did the first time but it is not getting enabled. i think it's something to do with nov patch. let's see if someone else succeeds with the latest patch.

Thank you for the wonderful trick by the way :)
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Yes it would change the active slot, makes sense. When you say "it's not getting enabled", what exactly do you mean? You entered the commands after 'adb shell' etc? Twrp booted no problems?

Keep in mind, the only way to 'see' that they are enabled is; 1) after a reboot 2) use the cam2api detection app on playstore (it will tell you if it's level 3).
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] hugomoya:
Hello,

November 5 (OTA) installed on Mi A2 with unlocked bootloader.

Camera2 API still enabled and GCam working OK!

Regards!
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] salmonthefish:
So i booted into twrp and did the adb shell commands. I don't know if I'm supposed to get any sort of confirmation if its done correctly. This is what I did on the mac and what i get on the phone after the NOV patch.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
[MENTION=6680624]salmonthefish[/MENTION] thanks for that info, very clear.

So you're the 2nd person to indicate Xiaomi *may* have done something to stop this from working...

You did everything as you should have I think. You do see the twrp logo and selections etc after booting twrp right? It should show you that after having booted. If it's blank, that could indicate that somehow the image you used somehow got mixed up with some other image.

But, if you are seeing twrp booted, with all of it's selections etc, then yeah, looks like Xiaomi may have changed something.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] salmonthefish:
Yeah booted into twrp. Didn't select "Read only" just stayed in that first screen when you boot into twrp for the first time. Ran the adb shell comms from there.... I'M REALLY REGRETTING BUYING THIS PHONE... ugh... Don't think it was an upgrade from OnePlus one
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Wow, don't blame you. Must say it's surprising Xiaomi would do anything to stop these working. I mean why? It's not causing any harm? Sheeeesh.

Well, sounds like you did everything just as you should have. We'll have to hear back from a few more people to consider it definitive, but it looks as though the setprop ability has been stopped. Maybe there's some kind of work around. But these setprop commands are very very common, used on all android devices, not just this one. If they stopped this from working on the A2, that seems it would be intentional, not a mistake...
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
you typed the setprop command wrong. chk the first image. u typed presist instead of persist

---------- Post added at 05:35 PM ---------- Previous post was at 05:30 PM ----------

the twrp was not detecting device in adb. so used pbrp img. it booted without problem. didnt select anything in the screen and typed adb shell. after typing setprop persist.camera.HAL3.enabled 1, i typed 'getprop persist.camera.HAL3'. That showed me 1. but after rebooting, the cam2api detection app says its not level 3.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Wow, well, that seems to indicate quite positively, Xiaomi's Nov patch is breaking this 'setprop' ability. Maybe intentional, maybe not (seems as though it must be though).

I'm going to update the original post indicating that, in all likelihood, this Nov patch is now stopping this from working. thanks for making it clear what you did. It's too bad as the A2 has some good hardware, but it looks as though they are insisting you only use their camera app? Alas
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Neel@1234:
Damnit. Just one question, if I update now, will I lose my camera2api support? I did not relock bootloader or anything.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] salmonthefish:
Oh man, you were right. I did mess up the spelling. Check it out. USER ERROR on my part.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] salmonthefish:
So, It did work using mac. november patched and all.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Enrique25:
Maybe Xiaomi is disabling camera2api in nov patch because they are going to eneable It in pie update but the probability of this is quite small but the Hope is there :good:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
It seems there's a little uncertainly re that. I'd say give it a go, I bet it will work, Let us know! ;)
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Thanks for the update. I've changed the thread back to original. Mistakes happen, so until we're 100% positive, I'm betting it's still working no issues.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Neel@1234:
Thank god. I can update peacefully now.

UPDATE : I just updated, did not lose camera2api support. Gcam works perfectly. Great!
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
well, seems to work for everyone else except me. :(:(

Am doing exactly like mentioned and like everyone else. The hal3 enabled is set to 1 as long as am in adb shell. Once i come back to fastboot and again boot to pbrp(or back to system), then the property is empty. Something is making it not persistent.

Is there a way to roll back to previous update? tried flashing 9.6.14 but it gives "devcfg_a" error.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] minnuss:
You are typing commands wrong, go slowly character by character, it doesn't make sense that it works for 98% of people here, and that you are the only one with a problem.

Slowly, patiently, and you will succeed. :good::fingers-crossed:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
tried all sorts of tricks. copy pasted, typed character by character etc. but nothing works. The twrp mentioned is also not working. shows adb devices list empty. PBRP works with adb devices.

I think everyone here enabled the camera2 before the nov update and it persisted through the update whereas i'm trying to enable after the nov update.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] minnuss:
Nope, read the post #73, it still works...it was user mistake, not guides.

I'm not judging you, just to make clear about that, it just doesn't make sense...
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Well, I can see a couple of things, 1st) you should not be able to do 'getprop' while in adb shell, after setting them, and get back 'they are set to 1'.

That's NOT the way setprop persist works. Those values don't get propagated to the appropriate tables UNTIL AFTER THE DEVICE REBOOTS. So if you are seeing 1, somethings wrong.

Also, I've mentioned, TWRP seems to work fine for some, others have had to use PBRP (so your statement "The twrp mentioned is also not working. shows adb devices list empty. PBRP works with adb devices.

" is flat out wrong, it's anecdotal only). Use whatever works.

AGAIN! "Once i come back to fastboot and again boot to pbrp", YOU ARE NOT GOING TO SEE THE PROPERTY ENABLED until the device has been rebooted! AND even then you need the playstore app that checks for Level3.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
Hi, chk the attached images. when i used getprop first time it is empty, after i set it with setprop and then use getprop it shows 1. I guess something's wrong.

Anyways i just want to giveup and try after next OTA or wait for Pie update hoping they'll enable by default.

[IMG="Command Prompt"]https://imgur.com/a/OY8kEdm[/IMG]

[IMG="App Screenshot"]https://imgur.com/a/KlvLZfs[/IMG]

edit: image links seems to be broken. Here's the links - imgur.com/a/OY8kEdm, imgur.com/a/KlvLZfs
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Look, as has already been indicated, this works as it has been working. You seem to be the only one having trouble...

hmmmmmm
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] raiden_1115:
Does booting on twrp wipes data just like on mi A1?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
It didn't for me. Have never heard of that happening on the A1.

Most people don't have their bootloader unlocked, they have to unlock that first, and that wipes data.

If your's is unlocked, why? what have you already done to the device? If you've installed Magisk, then

uninstalled it, then etc etc. I've no idea what condition the device is in.

I'd suggest, start from scratch. Clean wipe.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Sift:
Everything went smooth, I was able to boot into PBRB and adb shell. But after reboot, Gcam crashes and I checked with Manual Camera Compatibility and it shows that cam2api is not enabled.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
I'd suggest using this app https://play.google.com/store/apps/details?id=de.weis.camera2probe

the reviews of manual camera indicate it gets things wrong quite often.

What Gcam version are you using? That may be the problem. Let us know what camera2probe says.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Sift:
I'm using Arnova8G2-1.4 Also I'm on November Build.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Others have indicated that this works on Nov build. I'd try the version of twrp from the OP.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Sift:
The problem is, using TWRP I couldn't get adb shell working. Which is why I used PBRB.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Here's what I'd suggest then, there's another guide that does basically the same as this one, except instead of 'fastboot boot' for twrp, it flashes it. After flashing it a fastboot reboot and holding down vol up, should certainly get twrp to go into recovery.

Read the entire guide first. You'll need your prior boot.img file, that's what you'll flash over twrp when it's done.

https://xdaforums.com/mi-a2/how-to/guide-enable-cam2api-root-t3848058
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] lept_2014:
In TWRP, try to disable MTP (inside 'mount' option), and you'll can get adb shell working.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] AsItLies:
Thanks for that lept, some additional things I've found re twrp not working:

Using TWRP:

You must go to the advanced menu and use the "ADB sideload" functionality. It will allow you to use adb sideload commands (which you can use to flash zips). You should not be prompted for fingerprint authorization.

-----------------------------------------------------

While phone is ON:

If your phone still doesn't connect while ON, be sure you have gone to the developer settings and enabled adb debug through USB.

In any case:

When the connection is not working it's always useful to restart the adb server:

adb kill-server

adb start-server

------------------------------------------------------

and another thing re mtp setting:

--------------------------------------------------

On most devices, adb doesn't work when mtp disabled. For more details on USB connections behavior, you may check kernel resources of your device or simply /init.*usb.*rc files.

Disable and then enable MTP in Mount options (TWRP).

Mount /data so that /data/misc/adb/adb_keys can be read by adb daemon if needed.

--------------------------------------------------------------

I can say I've never had an issue like this, but that's anecdotal of course, I have one device, and only me testing it. But it certainly seems very feasible that starting and stopping the daemon is a good possibility to help, as does disable / enable mtp. I've never been able to get adb to work without mtp enabled.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] s5282noob:
Thanks to the tip, it finally worked for me. I ditched PBRP and used the twrp, then disabled the MTP option as mentioned. Apart from that i select "Persist" from mount menu. (Don't know if it was necessary). Once i disabled MTP option in twrp, adb devices worked and setprop as well. Once i rebooted LEVEL 3 was enabled.

Thanks a lot lept and AsItLies :) :)
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] minnuss:
So we learned that with PBRP, setprop doesn't work, and we learned how to get adb to work with twrp. [MENTION=2129545]AsItLies[/MENTION], add those information's on the first page, so nobody has to search over the thread.