Skip to content

Instantly share code, notes, and snippets.

@xc-racer99
Last active July 30, 2021 16:04
Show Gist options
  • Save xc-racer99/8c342e47b7d6a2862c657bb262caf55c to your computer and use it in GitHub Desktop.
Save xc-racer99/8c342e47b7d6a2862c657bb262caf55c to your computer and use it in GitHub Desktop.
libsamsung-ipc change for aires to use crespo backend for SGS4G
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
index 1bf9a97..31fa802 100644
--- a/samsung-ipc/devices/crespo/crespo.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -91,6 +91,12 @@ int crespo_boot(struct ipc_client *client)
p += CRESPO_PSI_SIZE;
+ rc = ioctl(modem_ctl_fd, IOCTL_MODEM_WAIT_FOR_SBL);
+ if (rc < 0) {
+ ipc_client_log(client, "Waiting for SBL failed");
+ goto error;
+ }
+
lseek(modem_ctl_fd, 0, SEEK_SET);
rc = xmm616_firmware_send(client, modem_ctl_fd, NULL, (void *) p, CRESPO_MODEM_IMAGE_SIZE - CRESPO_PSI_SIZE);
@@ -109,6 +115,13 @@ int crespo_boot(struct ipc_client *client)
}
ipc_client_log(client, "Sent XMM616 nv_data");
+
+ rc = ioctl(modem_ctl_fd, IOCTL_MODEM_BINARY_LOAD);
+ if (rc < 0) {
+ ipc_client_log(client, "Binary load failed");
+ goto error;
+ }
+
rc = 0;
goto complete;
@@ -445,20 +458,6 @@ int crespo_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout)
int crespo_power_on(__attribute__((unused)) void *data)
{
- int fd;
- int rc;
-
- fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR);
- if (fd < 0)
- return -1;
-
- rc = ioctl(fd, IOCTL_MODEM_START);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
return 0;
}
diff --git a/samsung-ipc/devices/crespo/crespo.h b/samsung-ipc/devices/crespo/crespo.h
index 97dff96..abdf892 100644
--- a/samsung-ipc/devices/crespo/crespo.h
+++ b/samsung-ipc/devices/crespo/crespo.h
@@ -25,7 +25,7 @@
#define CRESPO_MODEM_CTL_NV_DATA_OFFSET 0xD80000
#define CRESPO_BUFFER_LENGTH 0x50000
-#define CRESPO_MODEM_IMAGE_DEVICE "/dev/mtd/mtd5ro"
+#define CRESPO_MODEM_IMAGE_DEVICE "/radio/modem.bin"
#define CRESPO_MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
#define CRESPO_MODEM_CTL_DEVICE "/dev/modem_ctl"
#define CRESPO_MODEM_FMT_DEVICE "/dev/modem_fmt"
diff --git a/samsung-ipc/devices/crespo/crespo_modem_ctl.h b/samsung-ipc/devices/crespo/crespo_modem_ctl.h
index 7c23165..355b5ed 100644
--- a/samsung-ipc/devices/crespo/crespo_modem_ctl.h
+++ b/samsung-ipc/devices/crespo/crespo_modem_ctl.h
@@ -24,6 +24,9 @@
#define IOCTL_MODEM_SEND _IO('o', 0x23)
#define IOCTL_MODEM_RECV _IO('o', 0x24)
+#define IOCTL_MODEM_WAIT_FOR_SBL _IO('o', 0x25)
+#define IOCTL_MODEM_BINARY_LOAD _IO('o', 0x26)
+
struct modem_io {
uint32_t size;
uint32_t id;
diff --git a/samsung-ipc/ipc_devices.c b/samsung-ipc/ipc_devices.c
index ad7d23c..d1016e6 100644
--- a/samsung-ipc/ipc_devices.c
+++ b/samsung-ipc/ipc_devices.c
@@ -47,11 +47,11 @@ struct ipc_device_desc ipc_devices[] = {
.name = "aries",
.board_name = "aries",
.kernel_version = NULL,
- .fmt_ops = &aries_fmt_ops,
- .rfs_ops = &aries_rfs_ops,
- .handlers = &aries_handlers,
- .gprs_specs = &aries_gprs_specs,
- .nv_data_specs = &aries_nv_data_specs,
+ .fmt_ops = &crespo_fmt_ops,
+ .rfs_ops = &crespo_rfs_ops,
+ .handlers = &crespo_handlers,
+ .gprs_specs = &crespo_gprs_specs,
+ .nv_data_specs = &crespo_nv_data_specs,
},
{
.name = "aries",
From ea3a3f7b1248820402f9a135389b5befff9028cf Mon Sep 17 00:00:00 2001
From: Jonathan Bakker <[email protected]>
Date: Mon, 6 Aug 2018 13:10:47 -0700
Subject: [PATCH 1/2] unlegacy: Add ua_telusgalaxys4gmtd
SGH-T959P - first gen Galaxy S device
Change-Id: Id7a9622fca50b39847eef35ba349dfa5968901a2
---
AndroidProducts.mk | 1 +
products/ua_telusgalaxys4gmtd.mk | 32 ++++++++++++++++++++++++++++++++
vendorsetup.sh | 1 +
3 files changed, 34 insertions(+)
create mode 100644 products/ua_telusgalaxys4gmtd.mk
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index a0c060b..b15a7f0 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -16,4 +16,5 @@ PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/products/ua_espresso.mk \
$(LOCAL_DIR)/products/ua_espresso3g.mk \
$(LOCAL_DIR)/products/ua_picasso2.mk \
+ $(LOCAL_DIR)/products/ua_telusgalaxys4gmtd.mk \
$(LOCAL_DIR)/products/ua_tuna.mk
diff --git a/products/ua_telusgalaxys4gmtd.mk b/products/ua_telusgalaxys4gmtd.mk
new file mode 100644
index 0000000..320e049
--- /dev/null
+++ b/products/ua_telusgalaxys4gmtd.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2016 Unlegacy Android
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Inherit Unlegacy Android common configuration
+$(call inherit-product, vendor/unlegacy/configs/common.mk)
+
+# Inherit AOSP device configuration
+$(call inherit-product, device/samsung/telusgalaxys4gmtd/full_telusgalaxys4gmtd.mk)
+
+PRODUCT_DEVICE := telusgalaxys4gmtd
+PRODUCT_NAME := ua_telusgalaxys4gmtd
+PRODUCT_BRAND := samsung
+PRODUCT_MANUFACTURER := samsung
+PRODUCT_MODEL := SGH-T959P
+
+# Device build info and fingerprint
+PRODUCT_BUILD_PROP_OVERRIDES += \
+ PRODUCT_NAME=SGH-T959P \
+ TARGET_DEVICE=SGH-T959P \
+ BUILD_FINGERPRINT="samsung/SGH-T959P/SGH-T959P:2.3.4/GINGERBREAD/PTLKH2:user/release-keys" \
+ PRIVATE_BUILD_DESC="SGH-T959P-user 2.3.4 GINGERBREAD PTLKH2 release-keys"
diff --git a/vendorsetup.sh b/vendorsetup.sh
index 1b18c01..abf5dcb 100644
--- a/vendorsetup.sh
+++ b/vendorsetup.sh
@@ -7,6 +7,7 @@
add_lunch_combo ua_espresso-userdebug
add_lunch_combo ua_espresso3g-userdebug
add_lunch_combo ua_picasso2-userdebug
+add_lunch_combo ua_telusgalaxys4gmtd-userdebug
add_lunch_combo ua_tuna-userdebug
while read -r file; do
--
2.20.1
From d1735abb90bfd4ce39472eeb4d14c1da64915761 Mon Sep 17 00:00:00 2001
From: Jonathan Bakker <[email protected]>
Date: Tue, 8 Jan 2019 13:22:35 -0800
Subject: [PATCH 2/2] Add galaxysmtd
Change-Id: I4d9a634b7dc2d866fadd0b92fc17f6174697a745
---
AndroidProducts.mk | 1 +
products/ua_galaxysmtd.mk | 32 ++++++++++++++++++++++++++++++++
vendorsetup.sh | 3 +++
3 files changed, 36 insertions(+)
create mode 100644 products/ua_galaxysmtd.mk
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index b15a7f0..b3bb6af 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -15,6 +15,7 @@
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/products/ua_espresso.mk \
$(LOCAL_DIR)/products/ua_espresso3g.mk \
+ $(LOCAL_DIR)/products/ua_galaxysmtd.mk \
$(LOCAL_DIR)/products/ua_picasso2.mk \
$(LOCAL_DIR)/products/ua_telusgalaxys4gmtd.mk \
$(LOCAL_DIR)/products/ua_tuna.mk
diff --git a/products/ua_galaxysmtd.mk b/products/ua_galaxysmtd.mk
new file mode 100644
index 0000000..8bae050
--- /dev/null
+++ b/products/ua_galaxysmtd.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2016 Unlegacy Android
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Inherit Unlegacy Android common configuration
+$(call inherit-product, vendor/unlegacy/configs/common.mk)
+
+# Inherit AOSP device configuration
+$(call inherit-product, device/samsung/galaxysmtd/full_galaxysmtd.mk)
+
+PRODUCT_DEVICE := galaxysmtd
+PRODUCT_NAME := ua_galaxysmtd
+PRODUCT_BRAND := samsung
+PRODUCT_MANUFACTURER := samsung
+PRODUCT_MODEL := GT-I9000
+
+#Set build fingerprint / ID / Prduct Name ect.
+PRODUCT_BUILD_PROP_OVERRIDES += \
+ PRODUCT_NAME=GT-I9000 \
+ TARGET_DEVICE=GT-I9000 \
+ BUILD_FINGERPRINT=samsung/GT-I9000/GT-I9000:2.3.5/GINGERBREAD/XXJVT:user/release-keys \
+ PRIVATE_BUILD_DESC="GT-I9000-user 2.3.5 GINGERBREAD XXJVT release-keys"
diff --git a/vendorsetup.sh b/vendorsetup.sh
index abf5dcb..c5b9674 100644
--- a/vendorsetup.sh
+++ b/vendorsetup.sh
@@ -6,10 +6,13 @@
# Unlegacy Android devices combos
add_lunch_combo ua_espresso-userdebug
add_lunch_combo ua_espresso3g-userdebug
+add_lunch_combo ua_galaxysmtd-userdebug
add_lunch_combo ua_picasso2-userdebug
add_lunch_combo ua_telusgalaxys4gmtd-userdebug
add_lunch_combo ua_tuna-userdebug
+export PATH=/home/jon/bin/java-se-7u75-ri/bin:$PATH
+
while read -r file; do
project="$(dirname ${file} | sed 's|vendor/unlegacy/patch/||g')"
bugid="$(grep '^Bug: ' ${file} | sed -E 's|^\s*Bug: ([0-9]+).*$|\1|g')"
--
2.20.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment