Skip to content

Commit

Permalink
Move android project to android/
Browse files Browse the repository at this point in the history
  • Loading branch information
petabyt committed Aug 23, 2024
1 parent 2e3b465 commit ad6cc02
Show file tree
Hide file tree
Showing 122 changed files with 74 additions and 67 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ jobs:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: cd android && bash gradlew build
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "lib/libui"]
path = lib/libui
path = third_party/libui
url = https://github.com/petabyt/libuifw.git
[submodule "lib/lua"]
path = lib/lua
path = third_party/lua
url = https://github.com/lua/lua/
branch = v5.3
[submodule "lib/android-libjpeg-turbo"]
path = lib/android-libjpeg-turbo
path = third_party/android-libjpeg-turbo
url = [email protected]:petabyt/android-libjpeg-turbo.git
[submodule "lib/camlib"]
path = lib/camlib
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/build.gradle → android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
}
externalNativeBuild {
ndkBuild {
path file('../lib/Android.mk')
path file('../../lib/Android.mk')
}
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion settings.gradle → android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ dependencyResolutionManagement {
rootProject.name = "Fudge"
include ':app'
include ':libui'
project(":libui").projectDir = file("lib/libui")
project(":libui").projectDir = file("../third_party/libui")
44 changes: 0 additions & 44 deletions app/src/main/assets/help.md

This file was deleted.

2 changes: 1 addition & 1 deletion desktop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FUDGE = ../lib

OBJ := main.o ui.o jank.o

CAMLIB_CORE := transport.o operations.o packet.o enums.o data.o enum_dump.o lib.o canon.o liveview.o bind.o ml.o conv.o generic.o canon_adv.o
CAMLIB_CORE := transport.o operations.o packet.o enums.o data.o enum_dump.o lib.o canon.o liveview.o bind.o ml.o conv.o generic.o canon_adv.o object.o
ifeq ($(TARGET),l)
CAMLIB_CORE += libusb.o
endif
Expand Down
1 change: 0 additions & 1 deletion docs/help.md

This file was deleted.

44 changes: 44 additions & 0 deletions docs/help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
To be clear, the following is not supported yet:

- Bluetooth
- Liveview
- Geotagging

## Finding the wireless menu
- Look for 'WIRELESS TRANSFER' or 'WIRELESS COMMUNICATION' in 'PLAYBACK MENU'
- On some cameras, the 'Fn' button opens up the WiFi menu by default

## Pairing over WiFi

Older cameras will have these options:
```
VIEW & OBTAIN IMAGES ON (phone)
SEND INDIVIDUAL IMAGES
SEND SELECTED MULTIPLE IMAGES
```

When you press a connection mode, you will get a screen like this:

```
SEARCHING
FUJIFILM-X-A2-5DBC
SELECT Browse Camera
ON (phone) FUJIFILM APP
(OK) CHANGE (BACK) CANCEL
```

If you are connecting for the first time, press `(OK) CHANGE`.

On your device, open WiFi settings and manually connect to the access point (aka hotspot) your camera is exposing. It will
start with FUJIFILM. Once you connect, you might need to confirm the connection in certain versions of Android.

## PC AutoSave

- 'SET-UP' -> 'PC AUTO SAVE SETTING'
- 'CONNECTION SETTING' -> 'PC AUTO SAVE' -> 'PC AUTO SAVE SETTING'

'SIMPLE SETUP'
Press the WPS button on your router for 3 seconds and wait until your camera confirms a connection.

'MANUAL SETUP'
Select your WiFi network and punch in password on the camera.
18 changes: 8 additions & 10 deletions lib/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

CAMLIB := camlib
LUA := lua
LIBUI := $(LOCAL_PATH)/libui/lib
LIBJPEG := $(LOCAL_PATH)/android-libjpeg-turbo
LUA := $(LOCAL_PATH)/../third_party/lua
LIBUI := $(LOCAL_PATH)/../third_party//libui/lib
LIBJPEG := $(LOCAL_PATH)/../third_party//android-libjpeg-turbo

CAMLIB_CORE := $(addprefix $(CAMLIB)/src/,transport.c data.c enum_dump.c enums.c canon.c operations.c packet.c lib.c conv.c generic.c object.c)
CAMLIB_CORE += $(CAMLIB)/lua/lua-cjson/strbuf.c $(CAMLIB)/lua/lua-cjson/lua_cjson.c $(CAMLIB)/lua/lua.c $(CAMLIB)/lua/runtime.c

FUDGE_CORE := main.c backend.c fuji.c fuji_usb.c tester.c net.c scripts.c camlib.c usb.c data.c liveview.c discovery.c exif.c uilua.c
FUDGE_CORE += settings.c

LUA_CORE := $(addprefix $(LUA)/,lbaselib.c lauxlib.c lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c ltests.c)

LOCAL_MODULE := fudge
LOCAL_CFLAGS := -D ANDROID -Wall -Wshadow -Wcast-qual -Wpedantic -Werror=incompatible-pointer-types -Werror=deprecated-declarations -g
LOCAL_SRC_FILES := $(FUDGE_CORE) $(CAMLIB_CORE) $(LUA_CORE)
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(CAMLIB)/src $(LOCAL_PATH)/$(CAMLIB)/lua $(LOCAL_PATH)/$(LUA)
LOCAL_SRC_FILES := $(FUDGE_CORE) $(CAMLIB_CORE)
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(CAMLIB)/src $(LOCAL_PATH)/$(CAMLIB)/lua $(LUA)
LOCAL_LDLIBS += -llog -landroid -lEGL -lGLESv2 -lGLESv1_CM

LOCAL_C_INCLUDES += $(LIBUI)
Expand All @@ -26,9 +23,10 @@ LOCAL_CFLAGS += -DMEM_SRCDST_SUPPORTED

LOCAL_C_INCLUDES += $(LIBJPEG)/libjpeg-turbo-2.0.1 $(LIBJPEG)/include

LOCAL_STATIC_LIBRARIES += libui libjpeg-turbo
LOCAL_STATIC_LIBRARIES += lua libui libjpeg-turbo

include $(BUILD_SHARED_LIBRARY)

# This has to be in the order of LOCAL_STATIC_LIBRARIES.. ugh
include $(LOCAL_PATH)/Lua.mk
include $(LIBJPEG)/Android.mk
include $(LIBUI)/Android.mk
9 changes: 9 additions & 0 deletions lib/Lua.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LUA := $(LOCAL_PATH)/../third_party/lua
LOCAL_MODULE := liblua
LOCAL_CFLAGS := -O2
LOCAL_SRC_FILES := $(addprefix $(LUA)/,lbaselib.c lauxlib.c lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c ltests.c)
LOCAL_C_INCLUDES += $(LUA)

include $(BUILD_STATIC_LIBRARY)
2 changes: 1 addition & 1 deletion lib/camlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ PTP_FUNC(jint, cPtpObjectServiceStep)(JNIEnv *env, jclass clazz) {
PTP_FUNC(void, cPtpObjectServiceAddPriority)(JNIEnv *env, jclass clazz, jint handle) {
set_jni_env_ctx(env, NULL);
// TODO: implement cPtpObjectServiceAddPriority()
}
}
3 changes: 3 additions & 0 deletions lib/fuji.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ int fuji_connect_from_discoverinfo(struct PtpRuntime *r, struct DiscoverInfo *in
plat_dbg("Error connecting to %s:%d\n", info->camera_ip, info->camera_port);
return rc;
}

return 0;
}

// Assumes cmd socket is valid
Expand Down Expand Up @@ -245,6 +247,7 @@ int fuji_d228(void) {
// s += ptp_write_u32(buffer + s, 0x0000);
//
// ptp_set_prop_value_data(r, 0xd228, buffer, s);
return 0;
}

struct MyAddInfo {
Expand Down
2 changes: 1 addition & 1 deletion lib/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const char *app_get_wpa2_password() {
return jni_get_pref_str(env, "wpa_password", "");
}

SETTINGS_FUNC(jobject, getWPA2Password)(JNIEnv *env, jobject thiz, jobject ctx) {
SETTINGS_FUNC(jobject, getWPA2Password)(JNIEnv *env, jclass thiz, jobject ctx) {
set_jni_env_ctx(env, ctx);
return (*env)->NewStringUTF(env, app_get_wpa2_password());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int jni_setup_usb(JNIEnv *env, jobject obj) {
return 0;
}

JNI_FUNC(jint, cUSBConnectNative)(JNIEnv *env, jobject thiz, jobject usb) {
JNI_FUNC(jint, cUSBConnectNative)(JNIEnv *env, jclass thiz, jobject usb) {
set_jni_env(env);

jni_setup_usb(env, usb);
Expand Down
Submodule lua updated from 000000 to 75ea9c

0 comments on commit ad6cc02

Please sign in to comment.