feelfreelinux / octo4a

Use your old Android device as an OctoPrint server.
GNU Affero General Public License v3.0
1.53k stars 144 forks source link

When powering on printer, app requests permission to connect. #225

Open elrodvoss opened 2 years ago

elrodvoss commented 2 years ago

I leave my phone on, but I'll shut down my printer. When i turn printer on, it will need permission to connect.

App has full permissions.

What am I missing? How can I get it to auto connect without interaction? 20220609_160916

tycho94 commented 2 years ago

I have a similar issue, manually accepting still works. Probably something on the android side not automatically allowing USB connections?

jdmz1 commented 2 years ago

I have the same issue. It was working fine on my creality board but became an issue with the skr mini e3 v3. I use a TP-Link Smart adapter so I need this working to remotely access the printer. Please help!

tycho94 commented 2 years ago

Seems to be related to something like this.

https://stackoverflow.com/questions/12388914/usb-device-access-pop-up-suppression/15151075#15151075

Seems to be related to vendor_id/product_id.

I'm not sure what printer/board you are running. But mine for the skr mini e3 v1.2 it is: vendor_id 0483 & prodruct_id 5740. I'm somewhat certain if this is added to the res/xml/device_filter it should work.

jdmz1 commented 2 years ago

I have the same vendor Id and product Id. Tried adding it to the device_filter and deleting the rest and still same issue. I used a newer S10+ and had same problem. I recently updated the older android phone as well which may be the cause.. maybe new devices have something to do with it ? I'm going to try a different mainboard next to see if that's what is causing the issue.

jdmz1 commented 2 years ago

Well I fixed the issue after many late nights trying to learn to build an android apk and messing around with the settings. Basically modifying the res/xml/device_filter is what it boils down to. The latest release v1.1.1 does not have the VID and PID for the SKR mini e3 v3 board. The issue is that I was using VID: 0483 and PID: 5740 which are HEXADECIMAL. I thought they were already decimal because there are no letters.

Converting them to decimal results in: usb-device product-id="22336" vendor-id="1155" in the device_filter.xml file. The pop up no longer shows up.

tycho94 commented 2 years ago

Well I fixed the issue after many late nights trying to learn to build an android apk and messing around with the settings. Basically modifying the res/xml/device_filter is what it boils down to. The latest release v1.1.1 does not have the VID and PID for the SKR mini e3 v3 board. The issue is that I was using VID: 0483 and PID: 5740 which are HEXADECIMAL. I thought they were already decimal because there are no letters.

Converting them to decimal results in: usb-device product-id="22336" vendor-id="1155" in the device_filter.xml file. The pop up no longer shows up.

I had only tried unpacking and repacking the apk using apktool but of course I was stupid enough to miss that it was in hex. Thanks for figuring it out. I guess this file will need a lot of additions over time, or some remember device function (which should exist in android). I'll make a pull request for this vid/pid, seems its the same for skr mini e3 v1.2 and v3. Now let's hope @feelfreelinux can find time for the project again. It really took off after lots of youtube videos.

@jdmz1 I am planning on starting the build myself, any tips/issues you came across that might speed things up for me?

jdmz1 commented 2 years ago

@tycho94 Download Android studio, download octo4a source code, unzip source code into a folder. Biggest tip is open the app folder within the extracted folder when opening in Android studio. I was opening the root folder and it gave me issues. From there just find your xml file, edit it, and build apk. Let me know if you run into issues.

tycho94 commented 2 years ago

@tycho94 Download Android studio, download octo4a source code, unzip source code into a folder. Biggest tip is open the app folder within the extracted folder when opening in Android studio. I was opening the root folder and it gave me issues. From there just find your xml file, edit it, and build apk. Let me know if you run into issues.

Thanks, I'll get it to work but it's been a while since I even worked with Android studio.

alufers commented 1 year ago

Merged your PR!

p2baron commented 1 year ago

Should this be fixed? I am getting the "Allow the app OctoPrint for Android to access the USB device" warning similar to the Stackoverflow link posted earlier. Unfortunaty it doesn't remember my choice.

image

I am running it on a Huawei p20 Pro (Android 10) with a broken screen which makes this annoying

tycho94 commented 1 year ago

Should this be fixed? I am getting the "Allow the app OctoPrint for Android to access the USB device" warning similar to the Stackoverflow link posted earlier. Unfortunaty it doesn't remember my choice.

image

I am running it on a Huawei p20 Pro (Android 10) with a broken screen which makes this annoying

If you read the thread you can see how some of us fixed it. The fis has been added to the master branch in October but no release has been made since September. You could try building an APK.

p2baron commented 1 year ago

Thanks, I've compiled an APK and this fixes it for me!! I'm using an Ender 3v2 with a 4.2.7 board and marlin firmware. This uses: usb-device product-id="29987" and vendor-id="6790"

Many thanks, this software is amazing.

RAW2023 commented 1 year ago

Not working this method for me Creality Ender 3 S1 Pro ( <usb-device product-id="29987" vendor-id="6790" /> ) -- VID 1a86 / PID 7523 Magicsee TV Box. Android 9, Amlogic S905X2

This line was in the file \res\xml\device_filter.xml in decompiled .apk (octo4a-1.2.4) Tried leaving only one device

But the message "Allow the app OctoPrint for Android to access the USB device" after restarting and running OctoPrint Android appears again, you need to manually allow

ozcet commented 1 year ago

@p2baron Can you send me your octo4a compiled apk file ? I am using same board and printer like you. Ender3 V2 . 4.2.7 board. Thank you in advance.

p2baron commented 1 year ago

@p2baron Can you send me your octo4a compiled apk file ? I am using same board and printer like you. Ender3 V2 . 4.2.7 board. Thank you in advance.

Sorry, I don't have it anymore. But the latest release has the correct configuration so you should be able to use that.

ozcet commented 1 year ago

@p2baron Can you send me your octo4a compiled apk file ? I am using same board and printer like you. Ender3 V2 . 4.2.7 board. Thank you in advance.

Sorry, I don't have it anymore. But the latest release has the correct configuration so you should be able to use that.

I checked the apk file. Though its there , still I get pop-up for USB confirmation. Maybe There are different kind of boards....