XiaoMiToolV2 icon indicating copy to clipboard operation
XiaoMiToolV2 copied to clipboard

Fix/linux login url

Open edd34 opened this issue 2 years ago • 11 comments

This fixes #40 for linux branch

edd34 avatar Nov 13 '21 08:11 edd34

Please release the new build

heysagnik avatar Dec 26 '21 15:12 heysagnik

Hi @devgossips you can still run the program with the fix by compiling it yourself. Please perform the following instructions :

  • Clone the project locally : git clone [email protected]:edd34/XiaoMiToolV2.git -> the fix exists within my fork and not yet within the official project.
  • Checkout to the branch that contains the fix : git checkout fix/linux_login_url
  • Compile and run the program using the gradlew executable with sudo ./gradlew build && sudo ./gradlew run and then you should be good to go !

Tell us if you succeed !

edd34 avatar Dec 26 '21 15:12 edd34

I end up with this:

./gradlew build

> Configure project :
Project : => no module-info.java found

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x6e875475) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x6e875475

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

on

java --version
openjdk 18-ea 2022-03-15
OpenJDK Runtime Environment (build 18-ea+15-Ubuntu-4)
OpenJDK 64-Bit Server VM (build 18-ea+15-Ubuntu-4, mixed mode, sharing)

I've tried both openjdk 17 and 16 too, with same results

renefritze avatar Mar 02 '22 20:03 renefritze

I end up with this:

./gradlew build

> Configure project :
Project : => no module-info.java found

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x6e875475) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x6e875475

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

on

java --version
openjdk 18-ea 2022-03-15
OpenJDK Runtime Environment (build 18-ea+15-Ubuntu-4)
OpenJDK 64-Bit Server VM (build 18-ea+15-Ubuntu-4, mixed mode, sharing)

I've tried both openjdk 17 and 16 too, with same results

Same Here, any suggestion?

gastonmatias avatar Mar 05 '22 06:03 gastonmatias

Have you tried with "sudo" ?

edd34 avatar Mar 05 '22 06:03 edd34

Have you tried with "sudo" ?

Kinda. I can reproduce the issue with this Dockerfile where the build runs as root:

FROM ubuntu:21.10
RUN apt update ; apt install -y openjdk-18-jdk git
RUN git clone --branch=fix/linux_login_url https://github.com/edd34/XiaoMiToolV2 /src
RUN cd /src/ && ./gradlew build

renefritze avatar Mar 05 '22 10:03 renefritze

After realizing that the README mentions java 11, I tried again with an older base image where one can install openjdk-11

FROM debian:stable-slim as builder
RUN apt update ; DEBIAN_FRONTEND=noninteractive apt install -y openjdk-11-jdk git x11-apps xserver-xorg-video-amdgpu \
    gtk2-engines libswt-gtk-4-java libxslt1.1 libxtst6 libxxf86vm1
RUN git clone --branch=fix/linux_login_url https://github.com/edd34/XiaoMiToolV2 /src
RUN cd /src/ && ./gradlew --no-daemon build

WORKDIR /src
CMD [ "./gradlew", "--no-daemon", "run" ]

This actually builds successfully. I can run that with

docker run -it --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix  --net=host -e DISPLAY=$DISPLAY  the_image_name

and successfully unlock my device. That's pretty rough since I mount the entire /dev tree. There's a nicer solution for that which still makes the phone usb device available to the container after fastboot/adb switch. For some reason you need to login before selecting your device. If you try to login after the process started the browser component hangs on "loading". The Dockerfile includes the amd driver, which is specific to my setup.

renefritze avatar Mar 06 '22 11:03 renefritze

I just can't this to build on ArchLinux which annoys me so much...

skylabhalo avatar Mar 28 '22 19:03 skylabhalo

Hi @devgossips you can still run the program with the fix by compiling it yourself. Please perform the following instructions :

* Clone the project locally : `git clone [email protected]:edd34/XiaoMiToolV2.git` -> the fix exists within my fork and not yet within the official project.

* Checkout to the branch that contains the fix : `git checkout fix/linux_login_url`

* Compile and run the program using the gradlew executable with  `sudo ./gradlew build && sudo ./gradlew run` and then you should be good to go !

Tell us if you succeed !

Thanks a lot, thanks to this I was able to build fine on MX Linux 21. The fix gets me around the Xiaomi token error of XMT2_Linux_20.7.28.run. However, now I'm stuck on "Failed to unlock your device, Xiaomi server returned error 10000, request parameter error"

bunchofdutch avatar Jul 14 '22 08:07 bunchofdutch

Correction: tried again with device in fastboot mode (earlier, I had to boot MIU to pick of the code that Xiaomi SMSed me for device verification and I was trying unlock from there). Now I get error 20045: Please use the common user tool on the official website

bunchofdutch avatar Jul 14 '22 09:07 bunchofdutch

i guess another dead tool. i keep gettijg serviceToken error

unfairDude avatar Aug 07 '22 13:08 unfairDude