Android NDK now builds -- check README.android for info on libusb

https://github.com/Hamlib/Hamlib/issues/546
pull/574/head
Michael Black W9MDB 2021-02-28 15:50:36 +01:00
rodzic 7ac58fcd23
commit 83c47fad42
20 zmienionych plików z 68 dodań i 42 usunięć

Wyświetl plik

@ -4,40 +4,47 @@ include $(TOP_PATH)/src/Android.mk
include $(TOP_PATH)/rigs/adat/Android.mk
include $(TOP_PATH)/rigs/alinco/Android.mk
include $(TOP_PATH)/rigs/amsat/Android.mk
include $(TOP_PATH)/rigs/aor/Android.mk
include $(TOP_PATH)/rigs/ars/Android.mk
include $(TOP_PATH)/rigs/celestron/Android.mk
include $(TOP_PATH)/rigs/barrett/Android.mk
include $(TOP_PATH)/rigs/dorji/Android.mk
include $(TOP_PATH)/rigs/drake/Android.mk
include $(TOP_PATH)/rigs/dummy/Android.mk
include $(TOP_PATH)/rigs/easycomm/Android.mk
include $(TOP_PATH)/rigs/ether6/Android.mk
include $(TOP_PATH)/rigs/elad/Android.mk
include $(TOP_PATH)/rigs/flexradio/Android.mk
include $(TOP_PATH)/rigs/fodtrack/Android.mk
include $(TOP_PATH)/rigs/gs232a/Android.mk
include $(TOP_PATH)/rigs/heathkit/Android.mk
include $(TOP_PATH)/rigs/icmarine/Android.mk
include $(TOP_PATH)/rigs/icom/Android.mk
include $(TOP_PATH)/rigs/jrc/Android.mk
include $(TOP_PATH)/rigs/kachina/Android.mk
include $(TOP_PATH)/rigs/kenwood/Android.mk
include $(TOP_PATH)/rigs/kit/Android.mk
include $(TOP_PATH)/rigs/lowe/Android.mk
include $(TOP_PATH)/rigs/m2/Android.mk
include $(TOP_PATH)/rigs/meade/Android.mk
include $(TOP_PATH)/rigs/pcr/Android.mk
include $(TOP_PATH)/rigs/prm80/Android.mk
include $(TOP_PATH)/rigs/racal/Android.mk
include $(TOP_PATH)/rigs/rft/Android.mk
include $(TOP_PATH)/rigs/rotorez/Android.mk
include $(TOP_PATH)/rigs/rs/Android.mk
include $(TOP_PATH)/rigs/sartek/Android.mk
include $(TOP_PATH)/rigs/skanti/Android.mk
include $(TOP_PATH)/rigs/spid/Android.mk
include $(TOP_PATH)/rigs/tapr/Android.mk
include $(TOP_PATH)/rigs/tentec/Android.mk
include $(TOP_PATH)/rigs/ts7400/Android.mk
include $(TOP_PATH)/rigs/tuner/Android.mk
include $(TOP_PATH)/rigs/uniden/Android.mk
include $(TOP_PATH)/rigs/winradio/Android.mk
include $(TOP_PATH)/rigs/wj/Android.mk
include $(TOP_PATH)/rigs/yaesu/Android.mk
include $(TOP_PATH)/rotators/amsat/Android.mk
include $(TOP_PATH)/rotators/ars/Android.mk
include $(TOP_PATH)/rotators/celestron/Android.mk
include $(TOP_PATH)/rotators/cnctrk/Android.mk
include $(TOP_PATH)/rotators/easycomm/Android.mk
include $(TOP_PATH)/rotators/ether6/Android.mk
include $(TOP_PATH)/rotators/fodtrack/Android.mk
include $(TOP_PATH)/rotators/gs232a/Android.mk
include $(TOP_PATH)/rotators/heathkit/Android.mk
include $(TOP_PATH)/rotators/ioptron/Android.mk
include $(TOP_PATH)/rotators/m2/Android.mk
include $(TOP_PATH)/rotators/meade/Android.mk
include $(TOP_PATH)/rotators/prosistel/Android.mk
include $(TOP_PATH)/rotators/rotorez/Android.mk
include $(TOP_PATH)/rotators/sartek/Android.mk
include $(TOP_PATH)/rotators/satel/Android.mk
include $(TOP_PATH)/rotators/spid/Android.mk
include $(TOP_PATH)/rotators/ts7400/Android.mk

Wyświetl plik

@ -13,6 +13,8 @@ Notes:
** But NET rigctl works fine
* Backends are named libhamlib-vendor.so, I don't know how to include libraries without lib prefix into APK
* Check the location of libusb.h and define the corresponding macro accordingly in config.h.
* Had to build without libusb as ndk did not contain it
** comment out HAVE_LIBUSB_H in android/config.h if you get libusb errors
Happy hacking
73 Lada, OK1ZIA

Wyświetl plik

@ -223,10 +223,10 @@
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <libusb.h> header file. */
#define HAVE_LIBUSB_H 1
//#define HAVE_LIBUSB_H 1
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
/* #undef HAVE_LIBUSB_1_0_LIBUSB_H 1
//#define HAVE_LIBUSB_1_0_LIBUSB_H 1
/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 1

Wyświetl plik

@ -15,7 +15,7 @@ if [ "$1" = "clean" ]; then
fi
if [ -n "$1" ]; then
ndk-build NDK_PROJECT_PATH=$HAMLIB APP_BUILD_SCRIPT=$HAMLIB/Android.mk $1
ndk-build --trace NDK_PROJECT_PATH=$HAMLIB APP_BUILD_SCRIPT=$HAMLIB/Android.mk PP_ALLOW_MISSING_DEPS=true $1
exit
fi

Wyświetl plik

@ -7,6 +7,6 @@ LOCAL_MODULE := adat
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include src
LOCAL_LDLIBS := -lhamlib -Lobj/local/armeabi
LOCAL_LDLIBS := $(LOCAL_SHARED_LIBRARIES) -Lobj/local/armeabi
include $(BUILD_STATIC_LIBRARY)

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := dx77.c alinco.c
LOCAL_SRC_FILES := dx77.c alinco.c dxsr8.c
LOCAL_MODULE := alinco
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -36,7 +36,7 @@
static enum PAGE_e curPage = NONE; /* Current memory page */
static unsigned int curAddr = 65535; /* Current page address */
static enum LOCK_LVL_e curLock = LOCK_0; /* Current lock level */
static const unsigned int 7030_PAGE_SIZE[] =
static const unsigned int AR7030_PAGE_SIZE[] =
{
256, 256, 512, 4096, 4096,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -435,7 +435,7 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
if ((EEPROM3 >= page) || (ROM == page))
{
if (7030_PAGE_SIZE[page] > addr)
if (AR7030_PAGE_SIZE[page] > addr)
{
if (curPage != page)
{
@ -1454,11 +1454,11 @@ int pageSize(const enum PAGE_e page)
if ((WORKING <= page) && (EEPROM3 >= page))
{
rc = (int) 7030_PAGE_SIZE[ page ];
rc = (int) AR7030_PAGE_SIZE[ page ];
}
else if (ROM == page)
{
rc = (int) 7030_PAGE_SIZE[ page ];
rc = (int) AR7030_PAGE_SIZE[ page ];
}
else
{

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := barrett.c barrett.h
LOCAL_SRC_FILES := barrett.c barrett.h 950.c
LOCAL_MODULE := barrett
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := dummy.c rot_dummy.c netrigctl.c netrotctl.c flrig.c trxmanager.c
LOCAL_SRC_FILES := dummy.c rot_dummy.c netrigctl.c netrotctl.c flrig.c trxmanager.c dummy_common.c
LOCAL_MODULE := dummy
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := icm700pro.c icm710.c icm802.c \
LOCAL_SRC_FILES := icm700pro.c icm710.c icm802.c icm803.c \
icmarine.c
LOCAL_MODULE := icmarine

Wyświetl plik

@ -12,7 +12,8 @@ LOCAL_SRC_FILES := ic706.c icr8500.c ic735.c ic775.c ic756.c \
id1.c id5100.c ic2730.c \
ic707.c ic728.c ic751.c ic761.c \
ic78.c ic7800.c ic7000.c ic7100.c ic7200.c ic7600.c ic7700.c \
icom.c frame.c optoscan.c
icom.c frame.c optoscan.c x108g.c perseus.c id4100.c id51.c \
id31.c icr8600.c ic7300.c ic7610.c icr30.c ic785x.c
LOCAL_MODULE := icom
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -7,7 +7,8 @@ LOCAL_SRC_FILES := ts850.c ts870s.c ts570.c ts450s.c ts950.c ts50s.c \
ts680.c ts690.c ts140.c ts480.c trc80.c ts590.c \
ts440.c ts940.c ts711.c ts811.c r5000.c \
thd7.c thf7.c thg71.c tmd700.c tmv7.c thf6a.c thd72.c tmd710.c \
kenwood.c th.c ic10.c elecraft.c transfox.c
kenwood.c th.c ic10.c elecraft.c transfox.c flex6xxx.c ts990s.c \
xg3.c thd74.c flex.c pihpsdr.c
LOCAL_MODULE := kenwood
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := esmc.c eb200.c rs.c xk2000.c gp2000.c
LOCAL_SRC_FILES := esmc.c eb200.c rs.c xk2100.c gp2000.c
LOCAL_MODULE := rs
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -7,12 +7,14 @@ LOCAL_SRC_FILES := ft100.c ft747.c ft817.c ft847.c ft890.c ft900.c ft920.c \
ft757gx.c ft736.c frg100.c frg9600.c ft1000d.c \
vr5000.c ft767gx.c ft840.c ft980.c vx1700.c \
newcat.c ft450.c ft950.c ft2000.c ft9000.c ft5000.c \
ft1200.c ft991.c ft600.c ft3000.c ftdx101.c ftdx101mp.c \
ft891.c ftdx10.c \
yaesu.c
LOCAL_MODULE := yaesu
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include src
LOCAL_LDLIBS := -lhamlib -Lobj/local/armeabi
LOCAL_LDLIBS := -Lobj/local/armeabi
include $(BUILD_STATIC_LIBRARY)

Wyświetl plik

@ -3,10 +3,10 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := rot_ioptron.c
LOCAL_MODULE := rot_ioptron
LOCAL_MODULE := ioptron
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include src
LOCAL_LDLIBS := -lhamlib -Lobj/local/armeabi
LOCAL_LDLIBS := -Lobj/local/armeabi
include $(BUILD_STATIC_LIBRARY)

Wyświetl plik

@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := prosistel
LOCAL_SRC_FILES := prosistel.c
LOCAL_MODULE := prosistel
LOCAL_CFLAGS := -DHAVE_CONFIG_H

Wyświetl plik

@ -21,21 +21,24 @@ LOCAL_SRC_FILES := \
mem.c \
settings.c \
parallel.c \
usb_port.c \
debug.c \
network.c \
sleep.c \
gpio.c \
microham.c \
rot_ext.c \
cm108.c
LOCAL_MODULE := libhamlib
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := android include
LOCAL_STATIC_LIBRARIES := adat alinco amsat aor ars celestron \
drake dummy easycomm ether6 flexradio fodtrack \
gnuradio gs232a heathkit icom jrc kachina kenwood kit \
kylix lowe m2 microtune minivna pcr prm80 racal rft \
rotorez rs sartek skanti spid tapr tentec ts7400 tuner \
uniden winradio wj yaesu
LOCAL_STATIC_LIBRARIES := adat alinco amsat aor ars barrett celestron cnctrk \
dorji drake dummy easycomm elad ether6 flexradio fodtrack \
gs232a heathkit icmarine icom ioptron jrc kachina kenwood kit \
lowe m2 meade pcr prm80 prosistel racal rft \
rotorez rs sartek satel skanti spid tapr tentec ts7400 tuner \
uniden wj yaesu
LOCAL_LDLIBS := -llog

Wyświetl plik

@ -146,6 +146,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
p->fd = status;
break;
#ifdef HAVE_LIBUSB_H
case RIG_PORT_USB:
status = usb_port_open(p);
@ -155,6 +156,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
}
break;
#endif
case RIG_PORT_NONE:
case RIG_PORT_RPC:
@ -200,9 +202,11 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type)
ret = ser_close(p);
break;
#ifdef HAVE_LIBUSB_H
case RIG_PORT_USB:
ret = usb_port_close(p);
break;
#endif
case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK:

Wyświetl plik

@ -5725,7 +5725,7 @@ const char *HAMLIB_API rig_get_vfo_list(RIG *rig)
RETURNFUNC(NULL);
}
RETURNFUNC(RIG_OK);
RETURNFUNC(NULL);
}
/**

Wyświetl plik

@ -61,7 +61,9 @@
#include <hamlib/rotator.h>
#include "serial.h"
#include "parallel.h"
#ifdef HAVE_LIBUSB_H
#include "usb_port.h"
#endif
#include "network.h"
#include "rot_conf.h"
#include "token.h"
@ -416,6 +418,7 @@ int HAMLIB_API rot_open(ROT *rot)
rs->rotport.fd = status;
break;
#ifdef HAVE_LIBUSB_H
case RIG_PORT_USB:
status = usb_port_open(&rs->rotport);
@ -425,6 +428,7 @@ int HAMLIB_API rot_open(ROT *rot)
}
break;
#endif
case RIG_PORT_NONE:
case RIG_PORT_RPC:
@ -526,9 +530,11 @@ int HAMLIB_API rot_close(ROT *rot)
par_close(&rs->rotport);
break;
#ifdef HAVE_LIBUSB_H
case RIG_PORT_USB:
usb_port_close(&rs->rotport);
break;
#endif
case RIG_PORT_NETWORK:
case RIG_PORT_UDP_NETWORK: