Hi, Lionel Xu
In my xxx_gps_init , i define like blow:
nfs_gps_init(GpsCallbacks* callbacks)
{
GpsState* s = _gps_state;
if (!s->init)
gps_state_init(s);
if (s->fd < 0)
return -1;
MYD("Start init callbacks");
s->callbacks = *callbacks;
return 0;
}
and gps_state_init like :
static void
gps_state_init( GpsState* state )
{
.......
if ( pthread_create( &state->thread, NULL, gps_state_thread,
state ) != 0 ) {
LOGE("could not create gps thread: %s", strerror(errno));
goto Fail;
}
.......
}
What you mean, should I install callbacks before gps_state_init(),
and then use "s->callbacks->create_thread_call"" to instead of
"pthread_create" ?
By the way,are you chinese? I am chinese.
On 5月18日, 下午8时39分, Lionel Xu <[email protected]> wrote:
> Hi, All
>
> Thanks for your attention, i have found the route cause of this issue,
> that is
>
> Before using the callback function like nmea_callback or
> location_callback
> on gingerbread, you should use the new-added callback function
> create_thread_callback
> instead of pthread_create or something like that to create maingps
> thread in your xxx_gps_init
> function, otherwise you will get NULL as return value of below
> invoking
> AndroidRuntime::getJNIEnv()
> in your subsequent callback function, which actually will incur the VM
> restart problem.
>
> Lionel
>
> On 5月17日, 下午1时46分, Lionel Xu <[email protected]> wrote:
>
>
>
>
>
>
>
> > Thanks,
> > What i used is agpsmodule which connected with our soc via serial
> > port,
> > i think it is a little different from usb-based. MyGPShardware
> > abstraction layer code
> > was also referenced from sdk/emulator/gps/gps_qemu.c, and the
> > associated android.mk
> > is as follow:
>
> > LOCAL_PATH := $(call my-dir)
>
> > ifneq ($(TARGET_PRODUCT),sim)
> > # HAL module implemenation, not prelinked and stored in
> > # hw/<GPS_HARDWARE_MODULE_ID>.<ro.hardware>.so
> > include $(CLEAR_VARS)
> > LOCAL_PRELINK_MODULE := false
> > LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
> > LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware
>
> > ifeq ($(USE_ATHR_GPS_HARDWARE),true)
> > LOCAL_SRC_FILES := athr_gps.c
> > endif
>
> > LOCAL_SRC_FILES +=gps.c
> > LOCAL_MODULE :=gps.default
> > LOCAL_MODULE_TAGS := eng
> > include $(BUILD_SHARED_LIBRARY)
> > endif
>
> > The problem is just like topic starter says, when callback to function
> > nmea_callback
> > in com_android_server_location_GpsLocationProvider.cpp, android VM
> > restart again
> > and again, i was totally no idea about it, thanks a lot for your
> > reply!
>
> > BR
> > Lionel
>
> > On 5月16日, 下午9时05分, WuPublic <[email protected]> wrote:
>
> > > Does the usb_basedgps emulate as a serial (usb to serial)?
> > > And what 's the difference between usb_based gpsor uart basedgps?
> > > and could you show your Android.mk file to us?
>
> > > 在 2011年5月16日 下午5:38,Lionel Xu <[email protected]>写道:
>
> > > > I just got the same problem as you said, which blocked mygpsproject
> > > > nearly one week!!!!
>
> > > > On 5月9日, 下午12时55分, white <[email protected]> wrote:
> > > > > I was under the impression thatgps.default.so(or libgps.so) should go
> > > > > to the directory (/system/lib/) instead of (/system/lib/hw/).
>
> > > > > Also, is it important to name it as "gps.default.so" or it depends on
> > > > > what we specify while editing ./build/target/board/beagleboard/
> > > > > BoardConfig.mk e.g.
> > > > > BOARD_GPS_LIBRARIES :=libgps
>
> > > > > White
>
> > > > > On May 6, 1:21 pm, jack <[email protected]> wrote:
>
> > > > > > Hi
>
> > > > > > I am going to porting a USB-basedGPSmodule to Android2.3on arm
> > > > > > device.
> > > > > > In the Android2.3 source,I find the file (sdk/emulator/gps/
> > > > > > gps_qemu.c). So i change the file and Android.mk, making them been
> > > > > > builded togps.default.so and been copied to the directory (/system/
> > > > > > lib/hw/).
> > > > > > By doing these, i can grab the NMEA data and callback them to
> > > > > > JNI.
> > > > > > However , When callback to GpsLocationProvider,
>
> > > > > > env->CallVoidMethod(mCallbacksObj, method_reportLocation,
> > > > location->flags,
>
> > > > > > (jdouble)location->latitude,
> > > > > > (jdouble)location->longitude,
> > > > > > (jdouble)location->altitude,
> > > > > > (jfloat)location->speed, (jfloat)location->bearing,
> > > > > > (jfloat)location->accuracy, (jlong)location->timestamp);
>
> > > > > > make the VM restart. What happen?
>
> > > > > > D/GpsLocationProvider( 1429): startNavigating
> > > > > > D/GpsLocationProvider( 1429): start GPS......................
> > > > > > D/gps_nfs ( 1429): Start send CMD_START command:
> > > > > > D/gps_nfs ( 1429):gpsthread received 1 events
> > > > > > D/gps_nfs ( 1429):gpscontrol fd event
> > > > > > D/gps_nfs ( 1429):gpsthread starting location_cb=0x8380a67d
> > > > > > D/gps_nfs ( 1429): entery nmea_reader_set_callback
> > > > > > D/gps_nfs ( 1429): nmea_reader_set_callback: sending latest fix to
> > > > > > new
> > > > > > callback
> > > > > > D/gps_nfs ( 1429): location callback 0X39.978600
>
> > > > > > I/ActivityManager( 1429): Displayed org.gps.GPSTest/.GPSTest:
> > > > > > +1s688ms
> > > > > > E/gralloc.mini6410( 1429): [unregister] handle 0x1aaf30 still locked
> > > > > > (state=40000001)
> > > > > > D/gps_nfs ( 1429):gpsthread received 1 events
> > > > > > D/gps_nfs ( 1429):gpsfd event
> > > > > > D/gps_nfs ( 1429): received 32 bytes:
> > > > > > $GPGGA,062150.026,3958.7160,N,11
> > > > > > D/gps_nfs ( 1429): received 32 bytes:
> > > > > > 619.8405,E,0,0,,35.0,M,-6.5,M,,*
> > > > > > D/gps_nfs ( 1429): received 32 bytes: 6F
> > > > > > D/gps_nfs ( 1429):
> > > > > > D/gps_nfs ( 1429): $GPRMC,062150.026,V,3958.716
> > > > > > D/gps_nfs ( 1429): Received: '$GPGGA,062150.026,3958.7160,N,
> > > > > > 11619.8405,E,0,0,,35.0,M,-6.5,M,,*6F
> > > > > > D/gps_nfs ( 1429): '
> > > > > > D/gps_nfs ( 1429): Found 12 tokens
> > > > > > D/gps_nfs ( 1429): 0: 'GPGGA'
> > > > > > D/gps_nfs ( 1429): 1: '062150.026'
> > > > > > D/gps_nfs ( 1429): 2: '3958.7160'
> > > > > > D/gps_nfs ( 1429): 3: 'N'
> > > > > > D/gps_nfs ( 1429): 4: '11619.8405'
> > > > > > D/gps_nfs ( 1429): 5: 'E'
> > > > > > D/gps_nfs ( 1429): 6: '0'
> > > > > > D/gps_nfs ( 1429): 7: '0'
> > > > > > D/gps_nfs ( 1429): 8: '35.0'
> > > > > > D/gps_nfs ( 1429): 9: 'M'
> > > > > > D/gps_nfs ( 1429): 10: '-6.5'
> > > > > > D/gps_nfs ( 1429): 11: 'M'
> > > > > > D/gps_nfs ( 1429): callback, keeping data needed !
> > > > > > D/GpsLocationProvider( 1429): entry the JNI and the location is
> > > > > > 39.978600
>
> > > > > > I/DEBUG ( 1015): *** *** *** *** *** *** *** *** *** *** *** ***
> > > > > > ***
> > > > > > *** *** ***
> > > > > > I/DEBUG ( 1015): Build fingerprint: 'FriendlyARM/mini6410/
> > > > > > mini6410:2.3.2/GRH78C/eng.root.20110503.151546:eng/test-keys'
> > > > > > I/DEBUG ( 1015): pid: 1429, tid: 1550 >>> system_server <<<
> > > > > > I/DEBUG ( 1015): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault
> > > > > > addr 00000000
> > > > > > I/DEBUG ( 1015): r0 00000000 r1 407d1b60 r2 41645ab4 r3
> > > > > > 47defc54
> > > > > > I/DEBUG ( 1015): r4 00000000 r5 8380c7cf r6 00000000 r7
> > > > > > 407d1b60
> > > > > > I/DEBUG ( 1015): r8 849015f1 r9 84903250 10 00100000 fp
> > > > > > 00000001
> > > > > > I/DEBUG ( 1015): ip 8380e7d4 sp 47defc40 lr 8380a6f9 pc
> > > > > > 83807d0e cpsr 00000030
> > > > > > I/DEBUG ( 1015): #00 pc 00007d0e /system/lib/
> > > > > > libandroid_servers.so
> > > > > > I/DEBUG ( 1015): #01 pc 0000a6f4 /system/lib/
> > > > > > libandroid_servers.so
> > > > > > I/DEBUG ( 1015): #02 pc 000015be /system/lib/hw/
> > > > > >gps.default.so
> > > > > > I/DEBUG ( 1015): #03 pc 00001822 /system/lib/hw/
> > > > > >gps.default.so
> > > > > > I/DEBUG ( 1015): #04 pc 00011a7c /system/lib/libc.so
> > > > > > I/DEBUG ( 1015): #05 pc 00011640 /system/lib/libc.so
> > > > > > I/DEBUG ( 1015):
> > > > > > I/DEBUG ( 1015): code around pc:
> > > > > > I/DEBUG ( 1015): 83807cec ab04b082 9301cb04 6f646804 b00247a0
> > > > > > I/DEBUG ( 1015): 83807cfc bc08bc10 4718b002 b510b40c ab04b082
> > > > > > I/DEBUG ( 1015): 83807d0c 6804cb04 34f89301 47a06824 bc10b002
> > > > > > I/DEBUG ( 1015): 83807d1c b002bc08 46c04718 b510b40c ab04b082
> > > > > > I/DEBUG ( 1015): 83807d2c 9301cb04 34986804 47a06824 bc10b002
> > > > > > I/DEBUG ( 1015):
>
> > > > --
> > > > unsubscribe: [email protected]
> > > > website:http://groups.google.com/group/android-porting
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting