Live data from Hacker News

ESP32 and Termux

blog.gavide.dev

21–30 of 57 posts

Re: ESP32 and Termux

#21
post #12

I've been playing with Termux, both on Chromebook (Eve), and my Samsung Galaxy S22 - pretty cool, though hit some issue with recent `bazel` - as newer versions try to access a `/dev` endpoint that's not available. Quick fix, was to add `~/.bazelrc` this: common --experimental_collect_system_network_usage=false and then it works! Though sometimes I need to first `termux-chroot` and then it it handles cases, where some…

hm you can try out userland https://userland.tech/download/ which runs it inside proot and you can use something like alpine or debian and they can actually make the vnc/installing gui setup actually pretty easy.

Highly recommended.

I coded some python with micro in alpine in userland on my phone.

I really really enjoyed it, like more than my pc for that day. I am proud of it.

Re: ESP32 and Termux

#22

Earlier quoted context omitted.

What is your feedback in regards to battery? Android have been exhausted in development to optimize battery usage but I'm reading linux phones don't really care that much so you end up with a dead phone in less of a day. Has a power user, what has your experience been on that topic? I'd switch my phone to linux on a heartbeat because android apps seem compatible enough nowadays to run there too but battery is always…

I'm using a Librem 5 and its battery life is good enough for me - it lasts pretty much exactly what's needed for me to get through a typical day, so I often get home with the battery almost but not entirely flat. When I know that I'm going to be using it more intensively or need it to last longer, I'll usually just put a spare battery into my backpack, but I rarely actually need to use it when these days you can just…

Having a spare battery or being able to change battery seems like a fever dream for people on new android devices.

I am seriously interested in linux phones... like I am interested in either getting a grapheneos phone or somehow looking through my old garage of parents phones to see if any phone can be linux'd

I don't want to spend money right away but I am also a teenager, but the thing that's kinda stopping me from spending is that terminal can already be done through things like termux and the question I am asking myself is: is it good enough I have written back to back comments about it on why I think running android on linux using waydroid seems more performant than vice versa but I am curious.

Are there any recommendations that you have for me? I want to get linux on my phone but I am pretty sure that there are no second hand linux phones and I think it might cost me a lot of money (well for my country) anyway and I feel like the issue for me not being able to tinker is monetary of sorts.

Re: ESP32 and Termux

#23
post #14

very cool. termux has to be peak for unbridled nerddom, the new linux terminal in android 16 is really a pale shadow of it. you don't get access to anything non-virtual, not even the gpu (atleast, i couldn't get it to work.) theres so much cool hardware on modern smartphones, with quite solid drivers by virtue of the (relatively stringent) android quality requirements, and its all locked away. video encoders, decoder…

It is possible to write native code for Android using Native Development Kit. Typical NDK use would be to develop a library that is then called into by java code. But one can make whole app with it, 100% java-free: https://github.com/cnlohr/rawdrawandroid

Yes I am also interested in something like this 100% java-free but instead of C I'd prefer golang

I have been thinking more and more about creating golang applications for android simply because of how much I admire f-droid.

There are apps that have done this through 2 approaches

https://github.com/xlab/android-go?tab=readme-ov-file (Either something like this) Or https://github.com/LeastAuthority/destiny which is a dart app but uses golang's backend using https://github.com/LeastAuthority/dart_wormhole_william TLDR: they create dart bindings to go code and run it on android...

I know sooo many good golang applications on linux that I wish more people of android could access it and in an even nice way via something like f-droid so I am definitely contemplating what might be the best way for something like this...

For rust applications, I think that tauri might make the most sense, but I am just curious as to what you guys think is the best way for a beginner to create a golang/rust android application without worrying *too much*

Re: ESP32 and Termux

#24

I'm trying to repurpose my Pixel 6a that I no longer use, as a Home Assistant Core main driver. I was hoping the author will talk a little bit about that. I still haven't had the luck to have a fully working Home Assistant running inside (rooted) Termux. Anyone succeeded to start `hass` and have it running without throwing errors?

Hey maybe I didn't get ya but by home assistant core main driver, do you mean the linux application of this as in cli / terminal right?

what are your thoughts on something like https://userland.tech/download/ which can just straight up boot up into any distro that you might need (you can use something like alpine/debian/archlinux)

they are open source too btw

and also I tried and if you have a server running, then there are ways to make it so that those web servers can be accessed from outside out of the box as well so there is nothing to worry about that either.

It doesn't require root either, I run it on an unrooted phone!

Re: ESP32 and Termux

#25
post #9

Earlier quoted context omitted.

> the android development kit really is very heavy. compared to `gcc -o main main.cpp && ./main`, it is several orders of magnitude away. > the jetpack stuff and whatnot - the big android app shops probably do actually appreciate that stuff. but i wish the dev env 'scaled to zero' as they say, but in the sense of cognitive overload. I tried to build a small binary that listens for events and launches/wakes an app to…

>But apparently there's no way to send Intents or Broadcasts from native code? So I need to boot a JVM in the binary if I want it to communicate with anything else on the system! There is "am" i think which can be invoked to do this. However, Termux API exists, and is a nice package for calling other services. They have the scripts interface, which calls the actual app over a socket. Kinda inefficient, but at least t…

Yes, but the 'am' command is just a CLI Java program. At that point, it would be more efficient to just boot a JVM in the binary to avoid the JVM startup cost every time a Intent/Broadcast needs to be sent.

I believe the Termux API relies on a Java/app process that runs in the background to do stuff in response to API calls. Though I guess you get it for free if you already have the API running for other reasons.

Re: ESP32 and Termux

#26

very cool. termux has to be peak for unbridled nerddom, the new linux terminal in android 16 is really a pale shadow of it. you don't get access to anything non-virtual, not even the gpu (atleast, i couldn't get it to work.) theres so much cool hardware on modern smartphones, with quite solid drivers by virtue of the (relatively stringent) android quality requirements, and its all locked away. video encoders, decoder…

[deleted]

Re: ESP32 and Termux

#27
You could as well use any old Raspberry as go-between. If you use USB-tethering, the Raspberry will appear locally around 192.168.43.XX and you can termux-ssh into it and use mpremote therefrom.

Re: ESP32 and Termux

#28
post #12

I've been playing with Termux, both on Chromebook (Eve), and my Samsung Galaxy S22 - pretty cool, though hit some issue with recent `bazel` - as newer versions try to access a `/dev` endpoint that's not available. Quick fix, was to add `~/.bazelrc` this: common --experimental_collect_system_network_usage=false and then it works! Though sometimes I need to first `termux-chroot` and then it it handles cases, where some…

hm you can try out userland https://userland.tech/download/ which runs it inside proot and you can use something like alpine or debian and they can actually make the vnc/installing gui setup actually pretty easy. Highly recommended. I coded some python with micro in alpine in userland on my phone. I really really enjoyed it, like more than my pc for that day. I am proud of it.

Oh, wow! I would try this one! I didn't know about it! Thanks!!!

Re: ESP32 and Termux

#29

If you like this stuff, I highly recommend you look at Samsung Galaxy phones. They come with DeX, which is a linux DE that you can use with a dock.

The GNU/Linux version was dropped a while ago: https://9to5google.com/2019/10/18/samsung-discontinues-linux...

Re: ESP32 and Termux

#30
Using Termux to program an ESP32 directly from an Android phone is a brilliant hack for anyone who wants a truly portable development setup.
Post reply on HN