yashsingh1/xdaforums huggingface dataset:
[Nook Touch General] liptonthe:
Hello [MENTION=4474482]Renate NST[/MENTION]

I've retry to setup the gps library on a brand new NST BNRV300 from ebay this week to create an second topographic eReader like mine.

The result is the same i'm stuck with the gps.default.so, i don't know how to rebuilt it to integrate debug and check if it's loaded correctly. On the other hand it seem the OS has not GPS settings enabled. (But my params has been pushed successfully by sqlite). i'm really confused about that point.

I'm still getting thoses errors in logcat when i'm launching an app with GPS location needs :

E/LocationManagerService( 822): requestUpdates got exception:
E/LocationManagerService( 822): java.lang.IllegalArgumentException: provider=gps
E/LocationManagerService( 822): at com.android.server.LocationManagerService.requestLocationUpdatesLocked(LocationManagerService.java:863)
E/LocationManagerService( 822): at com.android.server.LocationManagerService.requestLocationUpdates(LocationManagerService.java:833)
E/LocationManagerService( 822): at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:79)
E/LocationManagerService( 822): at android.os.Binder.execTransact(Binder.java:287)
E/LocationManagerService( 822): at dalvik.system.NativeStart.run(Native Method)
I/PowerManagerService( 822): setPowerState: mPowerState=0x3 newState=0x3 noChangeLights=false reason=2
E/LocationManagerService( 822): isProviderEnabled got exception:
E/LocationManagerService( 822): java.lang.IllegalArgumentException: provider=gps
E/LocationManagerService( 822): at com.android.server.LocationManagerService._isProviderEnabledLocked(LocationManagerService.java:1387)
E/LocationManagerService( 822): at com.android.server.LocationManagerService.isProviderEnabled(LocationManagerService.java:1361)
E/LocationManagerService( 822): at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:237)
E/LocationManagerService( 822): at android.os.Binder.execTransact(Binder.java:287)
E/LocationManagerService( 822): at dalvik.system.NativeStart.run(Native Method)

I guess the glowlight 3 you are using has some differences about that in the firmware.

Do you have an opinion on that ?

##### Other Subject #####

I just read your thread about the SD card soldering perfomed on Glows 2/3/4 and it's very interesting :)

I will maybe buy a BNRV510 (Glow2) and try to reproduce the SD card mod but also soldering a GPS on the UART. I'm not totally sure but i guess it will be easier to make it work natively with a 4.4 Android OS.

The BNRV510 is waterproof, has SD card (after mod) and an UART serial input so it's a good setup for me but i'm not aware about what expect.

Advices ?

By the way, thank's for your time ! :)
[Nook Touch General] Renate:
Yeah, I've got to get back on this.

I had tried the two different sources for gps.default.so, the one with a bunch of files, the one with one big source file.

I'm just building them using the stock Android NDK toolchain.

The bunch-of build is detected as GPS but it does weird stuff like using NaN for no fix and I think it's reporting erroneous time which drives the AlarmManager crazy and eats CPU.

The big-file build is not recognized as GPS. I haven't really looked at it, but it doesn't touch the serial port at all.

When troubleshooting it helps to look at the serial port and see if the driver has set baud rate and characteristics.

# busybox stty -F /dev/ttymxc3

(Or whichever your device is.)

You should be able to cat it and see NMEA sentences. (Although it "steals" the text while you are doing this.)

# cat /dev/ttymxc3

Are you sure that your serial port is accessible?

I added this to ueventd.rc

/dev/ttymxc3 0666 root root

Adding an SD card on the Glow2 & Glow4 is easy.

The Glow3 needs a kernel mod and/or NTX hwcfg mod.

Oh! I see a problem with my build of the single-source gps.default.so:

E/HAL ( 2454): dlopen failed: cannot locate symbol "floor" referenced by "gps.default.so"...

Interesting, the other one didn't use math.

Also, I had to patch the source to understand 4800 baud, slow, but the official baud for NMEA-0183.

So, here's gps.default.txt, just rename it gps.default.so (it's not zipped or anything).

MD5=4c3eb7408a1ef94ec90ea44d045b7df2

The setup goes in /system/etc/gps.conf (not in build.prop like the other one).

GPSPORT /dev/ttymxc3
GPSSPEED 4800
[Nook Touch General] liptonthe:
Yes, the GP-735 is running well at 9600 baud on ttyS1 in my case :

# busybox stty -F /dev/ttyS1
speed 9600 baud;

Yeap this is work perfectly too, i'm able to see NMEA sentences :

# cat /dev/ttyS1
$GPRMC,224350.00,V,,,,,,,271120,,,N*78

$GPVTG,,,,,,,,,N*30

$GPGGA,224350.00,,,,,0,00,99.99,,,,,,*64

$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30

$GPGSV,1,1,02,26,,,33,30,,,24*7A

$GPGLL,,,,,224350.00,V,N*48

Yes it was 0660, but worked perfectly with the UsbGps app.

But i changed it to try with 0666, it seem not changing the matter.

This is a very good news, do you think the UART serial port is also ready to use on the Glow2 ?

Thank's you, i have tried with the gps.default.so an gps.conf you provide (but with adapted params).

I'm not able to see anything in logcat or dmesg at this time. But the error about GPS not enabled in Android still present.

This last error is not a problem with the lib for sure but with the android system itself about his settings parameters. I will continue to try things with the settings.db
[Nook Touch General] Renate:
Since you're using the default of 9600 that won't tell you anything.

If stty says "echo" then the driver hasn't touched it.

It should show "-echo".

Check to see if it even tried to load.

I'll get you the debug version in a bit.

Edit: Charging up my old Nook NST to check what the scoop with that is...

Edit^2: What I posted above is actually the verbose one (that spams logcat) but works fine on the Glows.

The NST needs a different build.

I'll post a non-logcat-spamming versions for the Glows in a bit.
[Nook Touch General] liptonthe:
I guess i have understand what you want mean. It's about using the "GPSSPEED" value to check with stty if the lib module is correctly loaded by alterating the link speed ?

So to test it i have changed the value to 4800 has you recommanded. But the stty stil give back the 9600 default value.

# busybox stty -F /dev/ttyS1
speed 9600 baud; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-brkint -imaxbel
#

nothing revelent about :

/ # dmesg | grep gps
/ # logcat | grep gps

Alright !
[Nook Touch General] Renate:
[If I can only figure out how this forum works now...]

Ok, so the problem was getting this to run on the NST, which is still running Android 2.1, API 7.

Android forced us to Clang for builds, there's an incompatibility with libdl.so, dladdr() is too modern.

So, here's a version that should work on both old and new.

I haven't double-checked it on the Glow3 yet.

It loads on the NST but I don't have any hardware check of it yet.

This is called gps.default.txt, rename it gps.default.so

MD5 188477c37d86b7a3ae43573e7174238b
[Nook Touch General] Renate:
Well, I'm getting about the same here.

gps.default.so is being loaded:

# ./dlcheck /system/lib/hw/gps.default.so HMI
Already loaded /system/lib/hw/gps.default.so
Found HMI at 8000a008
Tag: HWMT
ModVer: 3
HalVer: 0
ID: gps
Name: HZZKW GNSS Module
Author: Jarod Lee

Since I have a verbose version and I don't see a peep, I can only presume that the NST turned its nose up at it and didn't run the open method.

I'll have to look into this some more.

Just to be clear, we're working on a problem with the NST, the Glow3 works fine.
[Nook Touch General] Renate:
So, mystery solved, but not problem solved.

Here is what is supposed to be called:

system/framework/services.jar com.android.server.LocationManagerService loadProvidersLocked()
system/framework/services.jar com.android.server.location.GpsLocationProvider
/system/lib/libandroid_runtime.so
/system/lib/libhardware_legacy.so
/system/lib/hw/gps.default.so

services.jar is gutted.

There is a LocationManagerService but it doesn't even try to load any providers.

All the providers are missing too.

I could/might see about putting that stuff in.

It would be better than just trying random services.jar because who knows what else is B&N modified.

Interesting to note: Anything in /system/lib/hw gets loaded (including a stupid test file that I made).

Afterwards the system decides if it wants/needs it, but it remains loaded in any case.
[Nook Touch General] liptonthe:
So the loading chain natively present in android but altered by B&N is the concern ?!

This is over my capabilities about Android, but i read it carrefully :)

If this is working on the Glow3, can we assume it's also working on the Glow2 (Glow plus BNRV510) ?
[Nook Touch General] Renate:
No, we can't assume. But we can test!

I don't have any hardware on my Glow2.

Instead I made a test program that spits out NMEA to a FIFO called /dev/fakegps.

The gps.default.so opens that up fine and reads the NMEA from it.

My hiking app gets the GPS fine from that over the normal channels.

Info: The shell commands stop and start will close and reopen the HAL drivers.

That's handy when testing.
[Nook Touch General] liptonthe:
That's it the mind spirit we like :LOL:

Sincerely Renate yours skills blow my mind, i'm really impressed by what you are doing here.

By the way you giving me a really huge hope about stepping up my E-ink GPS map reader projet's with the Glow2 for the future.

You mean the init.d deamon of your NMEA simuation app i guess ?

Now i will keep my fingers crossed hoping you will find how-to make the driver work on the NST :)

PS :

I just received this morning a new 3D printed case made of nylon (SLS method this time).

The quality very clean, it's quite nice !
[Nook Touch General] Renate:
No, the fakegps (executable) I just run from the shell.

I could have put it as a service in init.rc but then I'd have to modify the ramdisk

That's not a big deal, but I make so many mods I lose track of what I'm running.

stop - stops the Android subsystem including all Java things and HAL drivers like gps.default.so

You still have the (somewhat) normal Linux running still.

Since the NST boots up normally gps.default.so has already started to run before I can run fakegps.

It has already discovered that /dev/fakegps doesn't exist and goes off to sulk.

So, using a few ADB shell windows, I run fakegps in one, then stop/start in another and logcat in another.

I like your case, is that your own 3D design?
[Nook Touch General] liptonthe:
Ok thank's for the précision, i haven't undersand the first time :)

I can't blame you for that, it's frequently the same for me..

Yes, you can found the STL files here : https://www.thingiverse.com/thing:4558240

If you need it i can send you the sources file. Originaly i designed it to be 3D printed at home, but after testing SLS professionnal printing is just far away better in quality results.

By the way if you want to print it for yourself you should scale the parts at 99.7% in print settings.

Also it's require 5 x M3*12 screws
[Nook Touch General] Renate:
Thanks, I don't need a case. That's a nice quality print though.

I've been looking at Frankensteining a services.jar from the B&N 1.2.2 and Eclair source.

It tries to pull in a lot of stuff, I'll have to dummy around it.
[Nook Touch General] Renate:
I've gotten bogged down in other stuff, but I'm still pursuing it...

I got confused because the NST does have the GPS stuff in it, it's just not in services.jar (like the Glows), it's in framework.jar

LocationManagerService (in services.jar) was gutted to not load any LocationProviders.

I do have a patch for that.

Now it tries to load providers but there are still problems.

Oh, and I went down the rabbit hole writing a utility to turn smali into java stubs so that I could build patches without pulling in the world's supply of source.

(And it's useful because it works on what you actually have vs. source code that may not match.)

libhardware_legacy.so wasn't built with any GPS support.

All this stuff is very OEM-ish, I'll have to dive in.
[Nook Touch General] liptonthe:
Hi Renate, happy new year :)

it's good to know you still working on it, on my side i'm really considering buy a Glowlight bnrv510.

I still keep my fingers crossed, hoping you will succed :)
[Nook Touch General] Renate:
This whole pursuit has been valuable in making me write new utilities. :p

root@ntx_6sl:/ # whomaps gps.default.so
2443 system_server /system/lib/hw/gps.default.so

It should be possible to get the NST working using LD_PRELOAD.

I was trying to figure out how to patch libhardware_legacy.so

There doesn't seem to be any example sources.
[Nook Touch General] SJT75:
I remember reading on forum about xcsoar program running on NST. That is application for people using gliders and it can use GPS as far as I have seen on YouTube videos about it. Some guy videoed NST running xcsoar with simple GPS module attached while driving his car so it seems to work. What you do Renate is way over my head I am afraid but just wanted to mention this so if the guys that messed up with xcsoar are still around on this forum it might be useful to get in touch with them for some insight into this matter.

I on another hand would have way smaller goal then you. I have seen programs being able to exploit Wi-Fi positioning to place your device on the map. I think that something like that is good enough for NST paired with any GPS enabled phone working as hotspot for NST.
[Nook Touch General] Renate:
Well, there's lots of ways to skin a cat.

When I first did GPS on the Glow3 I simply wrote the GPS directly into the app that I was using.

Opening a serial port and processing NMEA-0183 is not rocket science.

Playing nice with Android location services is more complicated.
[Nook Touch General] liptonthe:
Hi Renate, Hi SJT75

Yeah, news tools are always for the best :)

Also SJT75, the current goal is effectively like Renate mentionnied it to work with the native Android location provider to make work serial GPS directly soldered on the motherboard. As you said there is actually a gps's serial support in XCSoar and others apps like that used by glider's and parapentist's community.

By my side i actually using a work-around not really clean called USB4GPS who translate NMEA serial input in MOC location provider for Android, and make it usable by the whole systeme. But, that's not perfect.
[Nook Touch General] SJT75:
Whoa you both are in hardware modding? Hats off to you I am not even near that level of tech savvy! Most ambitious thing that I want to do is to make some USB gadget for this device and maybe also usable on some others that is why jumped in to point out something like Captain Obvious. Now that you mentioned that I remember to have seen the post mentioning that there is a place inside NST where GPS module can be placed but I forgot about it. I will not disturb you in your work anymore. Android bloat things in my opinion. Its designed to prevent user doing something stupid on Linux layer bellow and provides proprietary drivers with UI mostly and merges huge base of Java programming in to prevent software obsolesce (in theory) and expand programmers base as that also removes (in theory) platform dependence. I bet that you will make that module running circles in Linux before you manage to sneak it in Android. When I see Android its like someone is trying to run CubeOS on device. Yes CubeOS is a Linux distro but since they strive to make it secure/hardened they containerized almost everything and hardware requirements are insane. For the record I do not propose someone put CubeOS on NST quite the oposite although there were some Linux distro placed on NST for the fun I guess and to point that is possible (Backtrack 5 if I remember well). I can see you will make this project work but in a way feel your pain while wrestling with Android. Best wishes and fingers crossed on this side.

EDIT: Today I realized typo mistake I made in this post that might go unseen but changes meaning of what I have intention to wrote about. I by mistake mentioned here CubeOS which is existing distribution for embedded systems for educational puposes. What I have intention to write is Qubes OS another Linux distribution that is undoubtedly secure but also overblown because as far as I can see it follows the logic similar to Android. Rather then just correcting my mistake I decided to add this few lines of shame admitting my mistake. Mea culpa!
[Nook Touch General] Renate:
So, the NST is Eclair 2.1 is Linux 2.6

The Glows are KitKat 4.4.2 is Linux 3.0

LD_PRELOAD in linker only came along in Ice Cream Sandwich 4.0, Linux 3.0

So to make LD_PRELOAD work on NST I'd have to backport the linker.

To add a dependency to libandroid_runtime.so I need to add a DT_NEEDED to .dynamic

There is a patch tool to do this (patchelf) but apparently it breaks libandroid_runtime.so
[Nook Touch General] liptonthe:
Hi Renate !

I have buy a Nook Glow 2 (BNRV510) on ebay, i should receive it in few weeks.

I will try to make the GPS work natively with your lib. I will also soldering the SDcard has described on your website.

About the NST i guess it's too difficult to backport the whole location provider to an older version.
[Nook Touch General] Renate:
Everything moves on.

My main reader is now a Onyx Boox Poke 3 with Android 10.
[Nook Touch General] liptonthe:
Hi @Renate, somes time from our last exchanges.

I'm back on my work about modding the BNRV510 (Glow2).

I soldered a GP-735T from Sparkfun to the UART1 (J4) of the nook.

Got a shell on the nook thought ADB to take a look to /dev/ttymxc0

But get what's look like an empty payload.

I should get GNSS sentence but got only blank return.

Do you have some advices about the UART on BNRV510 ?

Thank's.
[Nook Touch General] Renate:
On the Glow3 I was using /dev/ttymxc3 (UART4).

On the Glow2 /dev/ttymxc0 (UART1) is console and also output of dmesg.

On the Glow2 the accessible spare UART is UART4 on J9 (which would be /dev/ttymxc3) but doesn't have a driver bound.

Since the driver is there you have to figure out how to bind it.

In the modern world, you'd just add it to the dtb, but the Glow2 isn't modern.
[Nook Touch General] liptonthe:
That's explain why i was getting empty payload. Thank's for the light.

Can i ask how did you determine the tty it should be associated ?

I was not aware about the UART was not natively binded in the system.. quite a bad surprise.

Unfortunally this step about the driver could be a stop for my project. This is rising over my skills on Android i believe.

By the way i'm gonna search closer with the inputs you gived to me.

Would you be okay if i have more question for you later ?
[Nook Touch General] Renate:
Every pin/pad on the processor (SOC) can be configured as GPIO (general purpose I/O). That means that with sufficient rights you can "wiggle" (i.e. assert high, assert low) every pin/pad. Of course, if you wiggle something actively in use something BAD could occur. I've wiggled out the connections on the labelled, unpopulated jacks on the PCB. UARTS are labelled 1-4, they would appear as devices ttymxc0-ttymxc3 if they have drivers loaded.
[Nook Touch General] liptonthe:
Something just come to my mind, if the /dev/ttymxc0 (UART1) is already active and bind in the system, would be not more easy to disable the console output on it to use it as an input for the system ? I Didn't know if it's a good track to follow or if i must concentrate on how to enable the UART4
[Nook Touch General] Renate:
The straight console service is a service running from init.rc. The kmsg/dmesg output is part of the kernel command line.

I don't think that I have a working Glow2 at this point. I removed some swollen batteries and I haven't got around to wiring them for external power yet.

I might be able to get the Glow2 with the missing screen working.
[Nook Touch General] liptonthe:
It seem the driver things are located in /sys/class/tty/ttymxc0/device/driver

For the moment i haven't spot the the console service in init.rc but i will take a closer look.

Your help would be welcome, i hope your Glow2 will goes up.
[Nook Touch General] Renate:
Yesh, I got the power lines running out a hole I drilled in the back. I'd forgotten what a piece of junk the power switch is in every way. It's not tactile and as it wears it's impossible to activate. I replaced it. At least you know now when it's pressed.

There is only one UART initialized on the Glow2, that's why I switched to the Glow3 at the outset of this. The iMX6 Glows don't use a device tree, all that initialization comes out of the NTX HWCFG and that's all closed source anyway.

Right there in init.rc it says:

service console /system/bin/sh

Just throw a disabled in there.

The command line in the boot image has:

console=ttymxc0,115200 ... androidboot.console=ttymxc0

Just take it out.
[Nook Touch General] liptonthe:
Nice switch mod eheh !

Ok, so from what you explain i understand that unbind the console and dmesg from the actual enabled UART is my only way to be able to use it as an input for my GPS module.

I was on my way to begin the edit of the init.rc to comment the console line but i still encounter rw issues on the fs. Before that you gived me a solution with the imgutil.exe tool and it was worked perfectly. But i didn't know why it's not longer working anymore.

It's related to the FS on the nook because it seem i can't read the file if not in root.

So i can't pull it back on my computer to edit it.

root@ntx_6sl:/ # dd if=/dev/block/mmcblk0p1 of=/sdcard/img
12224+0 records in
12224+0 records out
6258688 bytes transferred in 0.166 secs (37702939 bytes/sec)

root@ntx_6sl:/ # ls -l /sdcard/
-rw------- root root 6258688 2022-05-04 12:56 img

root@ntx_6sl:/ # chmod 777 /sdcard/img

root@ntx_6sl:/ # ls -l /sdcard/
-rwxrwxrwx root root 6258688 2022-05-04 12:56 img

root@ntx_6sl:/ # exit

shell@ntx_6sl:/ $ ls -l /sdcard
lrwxrwxrwx root root 2022-05-04 12:31 sdcard -> /storage/emulated/legacy

shell@ntx_6sl:/ $ exit

C:\Users\Hlod Wig\Downloads\platform-tools_r33.0.1-windows\platform-tools>adb.exe pull /sdcard/img
adb: error: remote object '/sdcard/img' does not exist

i also have tryed to remount the fs, but it did not give more result.

adb shell mount -o remount, rw /system

.. very strange, i keep searching.

EDIT : Forget it .. i must be in recovery in TWRP to have this function work, fixed.
[Nook Touch General] Renate:
Yeah, /sdcard and its links are screwy.

But so is the adb that you are using. If you don't get a # directly from "adb shell", how are you getting it?

Don't do commands as "adb shell blah-blah-blah", you don't know whether you're speaking to # or $.

The same goes for adb pulling.

C:\>adb shell
# mount -o remount,rw /system

(You had an extra space in there too.)
[Nook Touch General] liptonthe:
So i got my init.rc well edited.

from :

service console /system/bin/sh
class core
console
user root
group root

to :

#service console /system/bin/sh
# class core
# console
# user root
# group root

I'm now going take a look to the boot img.
[Nook Touch General] liptonthe:
I was getting my ADB with the nook system running.

So it was from su command that i getted the root.

It's fixed when i pass by the recovery adb of TWRP.

I hope the screwed links will no pose much issues when i will work back on the sdcard mod.