octo4a icon indicating copy to clipboard operation
octo4a copied to clipboard

/dev Permission error

Open Madcamper opened this issue 1 year ago • 9 comments

I've been getting this spam error in my octo4a logs for a while, it stops after I've made a successful connection to the printer though. Today, I am having some weird issues with octo4a where it crashes when trying to connect or detection serial connection times out after about 30 seconds, camera server stops running randomly. This all happened out of no where, it worked fine last night, I woke up this morning and tried to connect to octoprint and it doesn't work. I am using octoprint fine on another printer with the same phone.

image

Madcamper avatar Aug 22 '23 12:08 Madcamper

Same issue. It's because android doesn't recognise the printer as a USB device, because octo4a lacks permissions to access the dev area Funny enough, I got mine rooted but octo4a doesn't even ask for permissions, it just continously tries with standard access. The magic trick cmod 666 /dev/tty? didn't work for me either. The following is something else Ill try tomorrow. For reference, I use octo4a with nvidia SHIELD and a skr mini e3.0 v3 Board on an ender 3v2. Apparently that board utilizes the CDC driver. If it loads properly that is. FINAL SOLUTION

Sc0r avatar Aug 24 '23 00:08 Sc0r

My phone is not rooted but ssh'ing into the phone via enabling it in octoprint, I don't have a "udev" folder under \etc\ - not sure if this is because octoprint is creating the SSH connection or what. I also tried changing the permissions on the \dev folder and it acts like it takes it but then when I try to list the contents of "\dev" I get access denied. My guess is this is also because it's octoprint making the SSH connection or dev is locked down by default. The type of phone I am using is a TracFone Blu View 2 - https://www.amazon.com/gp/product/B08J4JYD47/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

image

Madcamper avatar Aug 24 '23 12:08 Madcamper

ultimately switched back to a different system, where I encountered the same (or similar) error. after hours of googling, trial and error, I found a solution. It might work for you as well: https://github.com/MarlinFirmware/Configurations/issues/535 How it works:

  • go to your downloads(or documents), go one folder up and follow this path: /.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/
  • open usbd_ep_conf.c (I recommend notepad++)
  • In Line 40 you find {CDC_OUT_EP, PMA_CDC_OUT_ADDR, PCD_DBL_BUF},
  • change "DBL" to "SNG" at the last bit, so it says {CDC_OUT_EP, PMA_CDC_OUT_ADDR, PCD_SNG_BUF},
  • save the changes
  • in visualstudio, verify the appropriate serial port is defined. with my board its: #define SERIAL_PORT_2 -1
  • save, now compile firmware, update firmware (I use Marlin 2.1.2.1)

after doing this, it instantly worked for me

good luck!

Sc0r avatar Aug 31 '23 11:08 Sc0r

Unfortunately I'm on a prusa and don't use custom firmware with it but hopefully this information will be helpful for anyone coming along and/or the dev to maybe pinpoint somewhere in the octo4a code to remediate it.

Madcamper avatar Aug 31 '23 12:08 Madcamper

Anyone got something new? I am stuck on the same problem on my old Oneplus 6. I already tried every chmod method, adding groups, trying out sudo, editing the octoprint user, etc...

Tought about either hardcoding the devices in the comm-fix.py or trying to ask for root access. I will try to build the app and test it out locally

Pyenb avatar Oct 17 '23 20:10 Pyenb

I got it working by setting SELinux to permissive:

"setenforce 0" in android shell

to make it permanent, repack your boot.img with "androidboot.selinux=permissive" in kernel cmdline

yep, ugly and insecure; but for a single purpose device that has no outside network access, you'll probably survive ;-)

mattmon avatar Dec 08 '23 20:12 mattmon

"setenforce 0" in android shell

Thanks @mattmon, will definitly try that out later. I tried rebuilding the app with it asking for root access, by editing the said comm-fix.py, but couldn't get it to compile.

Just to make sure, did you set it it inside octo4a or on the host phone?

Pyenb avatar Dec 08 '23 20:12 Pyenb

"setenforce 0" in android shell

Thanks @mattmon, will definitly try that out later. I tried rebuilding the app with it asking for root access, by editing the said comm-fix.py, but couldn't get it to compile.

Just to make sure, did you set it it inside octo4a or on the host phone?

You need to set SELinux to permissive for android's kernel.

"adb shell su setenforce 0" is ephemeral

repacking the boot.img is permanent

mattmon avatar Dec 08 '23 20:12 mattmon

"adb shell su setenforce 0" is ephemeral

Ok, thank you very much

Pyenb avatar Dec 08 '23 21:12 Pyenb