Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add Android support 2 #322

Merged
merged 31 commits into from
Oct 26, 2016
Merged

Add Android support 2 #322

merged 31 commits into from
Oct 26, 2016

Conversation

dylanaraps
Copy link
Owner

@dylanaraps dylanaraps commented Aug 27, 2016

This PR is the same as the last one, it just has all of the new changes from master (350~ Commits). A lot of the bugs from the previous PR should be fixed now and I'd love it if you guys could help me test it out. I've only got one Android device in my house and I'd like to make sure it works for as many people as possible.

Known bugs:

  • Ascii art padding is broken with ascii art that uses the unicode block char. (Android, Manjaro).
    • Cause: Android devices don't seem to have any locale related envars set(?) so neofetch is using LANG=C which incorrectly calculates the padding when unicode block chars are involved.
    • Solution: Assume block char is 3 chars wide when calculating padding.
  • ./neofetch doesn't work.
    • Workaround: bash ./neofetch
    • env doesn't exist on android.
  • Fixed missing CPU name. @konimex
  • Broken uptime output.
  • Added model output. @konimex

Old PR: #240

@dylanaraps
Copy link
Owner Author

dylanaraps commented Aug 28, 2016

To fix the CPU speed issue in the previous PR I need to know the output of this command on multiple devices:

ls /sys/devices/system/cpu/cpu0/cpufreq/

@konimex
Copy link
Contributor

konimex commented Aug 28, 2016

You should consider adding Busybox as a dependency for Android, as (interesting in my case) awk doesn't exist in default Android.

This is the output without Busybox (and the files in cpufreq).
nobox

This is the output after Busybox (with --test).
android1

@dylanaraps
Copy link
Owner Author

Will do, thanks for testing.

@dylanaraps
Copy link
Owner Author

dylanaraps commented Aug 29, 2016

@konimex, can you send me the output of cat /proc/cpuinfo on your device?

@konimex
Copy link
Contributor

konimex commented Aug 29, 2016

This is the result:
`processor : 0
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 1
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 2
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 3
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 4
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 5
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 6
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1

processor : 7
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 1`

@dylanaraps
Copy link
Owner Author

It looks like we'll have to find another way to get the CPU name on Andoid since it isn't in /proc/cpuinfo

@dylanaraps
Copy link
Owner Author

dylanaraps commented Aug 29, 2016

Output from my friend's phone:

14194384_1056800781064189_834584356_n

  • Uptime is broken
  • We should set shell_path to on on android

dylanaraps and others added 6 commits August 29, 2016 14:22
Included:
- Added model support for Android
- Changed CPU command to use native Android ones
Added and changed some Android commands
@dylanaraps
Copy link
Owner Author

dylanaraps commented Oct 18, 2016

I recently discovered termux which is an open source terminal emulator/linux environment for android.

Website: https://termux.com/
Source code: https://github.com/termux

#322 should work relatively bug free on Termux. My current thoughts are to officially support a single environment on Android (Termux) and either list Termux as a dependency or recommend it in the readme.

There are too many environments on android and due to the nature of neofetch (looking for files, commands etc) it'll be impossible to support them all.

Note: Termux also doesn't require a rooted phone to function.

What are your thoughts on this?

Edit: Termux requires android 5.0 and above, which may be an issue.
- See: termux/termux-app#6

Edit2: There is terminal IDE for older devices.

@konimex
Copy link
Contributor

konimex commented Oct 19, 2016

Actually, I don't think Termux is needed at all (well, for non-rooted devices, Termux is a comfortable solution since it has built-in Busybox environment so no hassle). Android has begun trying to get its shit together since 6.0 but Toybox hasn't caught up with Busybox yet, so Busybox is needed.

But since Termux's built in ps is much saner than Android's, I think just a dependency on Busybox will be fine, and add that it is recommended to install Termux since it has Busybox and a good ps built-in.

@dylanaraps
Copy link
Owner Author

Sounds good.

I'll fix the merge conflicts and reopen this PR with the latest changes from master. Then we can test the current status of this PR and fix any other bugs that come up.

@dylanaraps
Copy link
Owner Author

Fixed all merge conflicts and rebased with master.

Please test the branch now.

@konimex
Copy link
Contributor

konimex commented Oct 19, 2016

screenshot_20161019-212538

Looks good enough.

@dylanaraps
Copy link
Owner Author

I'm assuming that ./neofetch still doesn't work?

Can you also try with neofetch --config off --test?

@konimex
Copy link
Contributor

konimex commented Oct 19, 2016

Yep, ./neofetch doesn't work. Could this be related with the shebang on the first line since Android doesn't have /usr/bin/env ?

This is the second command (+ --disable publicip)

hello

@dylanaraps
Copy link
Owner Author

This looks bug free!

I'll test some more at home and probably merge this later today.

Could this be related with the shebang on the first line since Android doesn't have /usr/bin/env ?

Yup

Thanks!

Copy link
Owner Author

@dylanaraps dylanaraps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminders

@@ -452,6 +465,8 @@ getpackages() {
packages="$(pkg list | wc -l)"
;;
esac

[ "$packages" == 0 ] && unset packages
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not need this.

@@ -1717,8 +1736,8 @@ getbattery() {
*) index="$battery_num" ;;
esac

batteries=("$(cat /sys/class/power_supply/BAT$battery_num/capacity)")
battery_state=("$(cat /sys/class/power_supply/BAT${battery_num}/status)")
batteries=($(cat /sys/class/power_supply/battery/capacity /sys/class/power_supply/BAT${battery_num}/capacity))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as a distro case statement.

while IFS='\n' read -r line 2>/dev/null; do
[ ${#line} -gt "$ascii_length" ] && ascii_length=${#line}
lines=$((lines+=1))
while IFS='' read -r line 2>/dev/null; do
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ovewrites some bug fixes

@dylanaraps
Copy link
Owner Author

I pushed some fixes, can you test again with neofetch --config off --test?

@konimex
Copy link
Contributor

konimex commented Oct 20, 2016

Screen2

@dylanaraps
Copy link
Owner Author

👍

@dylanaraps
Copy link
Owner Author

dylanaraps commented Oct 21, 2016

The block chars in the ascii logo break the output in Material Terminal and Terminal Emulator for Android. Other logos render just fine, any ideas?

33333

333p333

@konimex
Copy link
Contributor

konimex commented Oct 21, 2016

The block characters probably isn't ASCII so the render broke.

@dylanaraps
Copy link
Owner Author

Yeah, the only solution is to create new ascii art that uses regular characters. I've attempted it and none of my attempts look as nice as this blocky art.

@dylanaraps
Copy link
Owner Author

dylanaraps commented Oct 26, 2016

Merging this now.

Thanks again for testing.

@dylanaraps dylanaraps merged commit 51354b2 into master Oct 26, 2016
@dylanaraps dylanaraps deleted the android2 branch October 26, 2016 22:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants