androidthings / contrib-drivers

Open source peripheral drivers
Apache License 2.0
558 stars 174 forks source link

NMEAgpsDriver #90

Closed prasaanth-selvakumar closed 6 years ago

prasaanth-selvakumar commented 6 years ago

my program crashes when i try to register the nmeagpsdriver can someone please help me

PaulTR commented 6 years ago

Can you post the log message for how it's crashing?

Fleker commented 6 years ago

Have you tried to reboot the device after installing your app? Maybe it is related to permissions.

prasaanth-selvakumar commented 6 years ago

gps

that line corresponds to the UserDeviceDriver.register();

prasaanth-selvakumar commented 6 years ago

@Fleker Yes i tried it still crashes

prasaanth-selvakumar commented 6 years ago

The NmeaGpsModule works fine I'm having issues only with the NmeaGpsDriver

Fleker commented 6 years ago

Do you have the permission <uses-permission android:name="com.google.android.things.permission.MANAGE_GPS_DRIVERS" />

prasaanth-selvakumar commented 6 years ago

Yeah I have included that in the manifest file

Fleker commented 6 years ago

I'm not sure what else it could be. Can you post your stacktrace error?

prasaanth-selvakumar commented 6 years ago

java.lang.RuntimeException: Unable to create service com.example.acer.integrated.GpsService: java.lang.SecurityException: Caller lacks required permission com.google.android.things.permission.MANAGE_GPS_DRIVERS

prasaanth-selvakumar commented 6 years ago

I'm getting this line in the error, but I have included that line in the manifest file, I.m sorry I don't know how to post the stacktrace error

Fleker commented 6 years ago

Can you post the contents of your manifest file? The permission tag may be in the wrong spot.

prasaanth-selvakumar commented 6 years ago

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.acer.integrated">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
   <application>
    <uses-library android:name="com.google.android.things" />

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.IOT_LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps"></activity>
    <service android:name=".GpsService"
        android:enabled="true"
        />
</application>

prasaanth-selvakumar commented 6 years ago

image

Fleker commented 6 years ago

So you have done the following, in this order:

And you're still seeing a security issue? What developer preview is running on the device, and what device is it?

prasaanth-selvakumar commented 6 years ago

It worked, after I rebooted it, sorry and thank you, is there any way to do it without a reboot ?? it is 6

Fleker commented 6 years ago

At the moment rebooting is the current way to solve this while in development mode.

prasaanth-selvakumar commented 6 years ago

I tried connecting a GPS via USB, to the Pi. and I checked the available UART ports onCreate: [MINIUART, UART0, USB1-1.5:1.0] these were the available UART ports. So I tried registering the third UART port as the NMEAGPSDriver's UART port("USB1-1.5:1.0"), It returned a buffer overflow exception. Can I solve this somehow?

prasaanth-selvakumar commented 6 years ago

03-27 07:23:14.741 2072-2072/? I/main: type=1400 audit(0.0:190): avc: denied { write } for name="trace_marker" dev="tracefs" ino=47 scontext=u:r:zygote:s0 tcontext=u:object_r:debugfs_tracing:s0 tclass=file permissive=1 03-27 07:23:14.751 2072-2072/? I/main: type=1400 audit(0.0:191): avc: denied { open } for path="/sys/kernel/debug/tracing/trace_marker" dev="tracefs" ino=47 scontext=u:r:zygote:s0 tcontext=u:object_r:debugfs_tracing:s0 tclass=file permissive=1 03-27 07:23:14.807 2072-2072/? I/zygote: Late-enabling -Xcheck:jni 03-27 07:23:15.329 2072-2072/com.example.acer.uart I/InstantRun: starting instant run server: is main process 03-27 07:23:15.571 2072-2072/com.example.acer.uart D/ContentValues: onCreate: [MINIUART, UART0, USB1-1.5:1.0] 03-27 07:23:15.748 2072-2072/com.example.acer.uart D/vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. 03-27 07:23:16.089 2072-2072/com.example.acer.uart W/NmeaParser: Checksum missing from incoming message 03-27 07:23:16.133 2072-2072/com.example.acer.uart W/NmeaParser: Checksum missing from incoming message 03-27 07:23:16.133 2072-2072/com.example.acer.uart I/chatty: uid=10030(com.example.acer.uart) identical 2 lines 03-27 07:23:16.133 2072-2072/com.example.acer.uart W/NmeaParser: Checksum missing from incoming message 03-27 07:23:17.007 2072-2072/com.example.acer.uart D/AndroidRuntime: Shutting down VM 03-27 07:23:17.016 2072-2072/com.example.acer.uart E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.acer.uart, PID: 2072 java.lang.IllegalArgumentException: Invalid ASCII hex byte at com.google.android.things.contrib.driver.gps.NmeaParser.getHexDigit(NmeaParser.java:424) at com.google.android.things.contrib.driver.gps.NmeaParser.convertAsciiByte(NmeaParser.java:408) at com.google.android.things.contrib.driver.gps.NmeaParser.validateChecksum(NmeaParser.java:122) at com.google.android.things.contrib.driver.gps.NmeaParser.processMessageFrame(NmeaParser.java:75) at com.google.android.things.contrib.driver.gps.NmeaGpsModule.handleFrameEnd(NmeaGpsModule.java:207) at com.google.android.things.contrib.driver.gps.NmeaGpsModule.processBuffer(NmeaGpsModule.java:176) at com.google.android.things.contrib.driver.gps.NmeaGpsModule.readUartBuffer(NmeaGpsModule.java:161) at com.google.android.things.contrib.driver.gps.NmeaGpsModule.access$000(NmeaGpsModule.java:35) at com.google.android.things.contrib.driver.gps.NmeaGpsModule$1.onUartDeviceDataAvailable(NmeaGpsModule.java:139) at com.google.android.things.pio.UartDeviceImpl$UartDeviceCallbackDispatch.dispatchInterruptEvent(UartDeviceImpl.java:250) at com.google.android.things.pio.CallbackDispatch.onFileDescriptorEvents(CallbackDispatch.java:149) at android.os.MessageQueue.dispatchEvents(MessageQueue.java:284) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:325) at android.os.Looper.loop(Looper.java:142) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 03-27 07:23:17.031 2072-2072/com.example.acer.uart I/Process: Sending signal. PID: 2072 SIG: 9 a

Fleker commented 6 years ago

This is an unrelated issue relating to the usage of the driver.

java.lang.IllegalArgumentException: Invalid ASCII hex byte

prasaanth-selvakumar commented 6 years ago

Do you have any idea what might be going wrong?/

Fleker commented 6 years ago

I'm not sure immediately what's going on. What GPS module are you connecting? Is it an NmeaGpsModule?

prasaanth-selvakumar commented 6 years ago

Yeah it is an NMEA Gps module , it connects via the USB

Fleker commented 6 years ago

You may need to take a look at what bytes are being sent and log that to see if there's something happening there.

prasaanth-selvakumar commented 6 years ago

What all NMEA 2.0 sentences does this driver use to figure out the location? ($GPRMC , $GPRMB... etc )

devunwired commented 6 years ago

Are you still experiencing issues with your GPS module? If so, please provide a link to the datasheet of the device you are using. The stack trace provided indicates it's not sending properly encoded NMEA data (or additional data the driver doesn't recognize).

prasaanth-selvakumar commented 6 years ago

NO, I'm not facing the issue now, I was using a neo-8M GPS Module. But I think the driver was written for neo-6M GPS modules.