Browse Source

gsm0710muxd-hack: make it build

master
Oliver Smith 4 months ago
parent
commit
5bac8e3008
  1. 57
      src/gsm0710muxd-hack/src/gsm0710muxd.c
  2. 27
      src/gsm0710muxd-hack/src/gsm0710muxd.h

57
src/gsm0710muxd-hack/src/gsm0710muxd.c

@ -56,10 +56,7 @@
#include "gsm0710muxd.h"
#include <linux/capability.h>
#include <linux/prctl.h>
#include <private/android_filesystem_config.h>
#include "hardware/ccci_intf.h"
#include <DfoDefines.h>
#include <sys/prctl.h>
/******************************************************************************/
@ -265,20 +262,6 @@ static speed_t baud_bits[] = {
/******************************************************************************/
#ifdef MUX_ANDROID
/* Android's log level are in opposite order of syslog.h */
int android_log_lvl_convert[8] = { ANDROID_LOG_SILENT, /*8*/
ANDROID_LOG_SILENT, /*7*/
ANDROID_LOG_FATAL, /*6*/
ANDROID_LOG_ERROR, /*5*/
ANDROID_LOG_WARN, /*4*/
ANDROID_LOG_INFO, /*3*/
ANDROID_LOG_INFO, /*2*/
ANDROID_LOG_DEBUG }; /*1*/
#endif /*MUX_ANDROID*/
/******************************************************************************/
static const Channel_Config ch_cfg[] =
{
{ 0, 512, NULL },
@ -1196,8 +1179,10 @@ static GSM0710_Buffer *gsm0710_buffer_init()
buf->writep = buf->data;
buf->endp = buf->data + GSM0710_BUFFER_SIZE;
/* FIXME
buf->bufferready_signal.value = 0;
buf->newdataready_signal.value = 0;
*/
}
return buf;
}
@ -2687,22 +2672,7 @@ int open_serial_device(Serial *serial)
serial->is_socket = 0;
if (!strcmp(serial->devicename, "/dev/socket/qemud")) {
/* Qemu-specific control socket */
SYSCHECK(serial->fd = socket_local_client("qemud", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM));
if (serial->fd >= 0) {
char answer[2];
if (write(serial->fd, "gsm", 3) != 3 ||
read(serial->fd, answer, 2) != 2 ||
memcmp(answer, "OK", 2) != 0)
{
close(serial->fd);
LOGMUX(LOG_DEBUG, "open_serial_device close(serial->fd);");
serial->fd = -1;
LOGMUX(LOG_ERR, "serial closed!");
}
}
LOGMUX(LOG_INFO, "Opened qemud socket");
serial->is_socket = 1;
/* FIXME: disabled */
} else {
/* Comment by LS: The O_NOCTTY flag tells UNIX that this program doesn't want to be the "controlling terminal" for that port */
/* If you don't specify this then any input (such as keyboard abort signals and so forth) will affect your process */
@ -2712,9 +2682,7 @@ int open_serial_device(Serial *serial)
if (serial->fd < 0) {
/* There is no such device! Try to handle it as socket */
SYSCHECK(serial->fd = socket_local_client(serial->devicename, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM));
LOGMUX(LOG_INFO, "Opened socket");
serial->is_socket = 1;
/* FIXME: disabled */
} else {
LOGMUX(LOG_INFO, "Opened serial port,serial->fd=%d",serial->fd);
int fdflags;
@ -3366,7 +3334,7 @@ int main(int argc, char *argv[])
{
LOGMUX(LOG_ERR, "Enter");
int opt, rc = -1;
char dev_node[32] = {0};
const char *dev_node = "/dev/ttyC0";
char prop_value[PROPERTY_VALUE_MAX] = { 0 };
property_get("mux.debuglog.enable", prop_value, NULL);
@ -3374,19 +3342,6 @@ int main(int argc, char *argv[])
LOGMUX(LOG_INFO, "Enable full log");
syslog_level = LOG_DEBUG;
}
if (MTK_ENABLE_MD1) {
snprintf(dev_node, 32, "%s", ccci_get_node_name(USR_MUXD_DATA, MD_SYS1));
LOGMUX(LOG_ERR, "ccci_get_node_name=%s", dev_node);
} else if (MTK_ENABLE_MD2) {
snprintf(dev_node, 32, "%s", ccci_get_node_name(USR_MUXD_DATA, MD_SYS2));
LOGMUX(LOG_ERR, "ccci_get_node_name=%s", dev_node);
} else if (MTK_ENABLE_MD5) {
snprintf(dev_node, 32, "%s", ccci_get_node_name(USR_MUXD_DATA, MD_SYS5));
LOGMUX(LOG_ERR, "ccci_get_node_name=%s", dev_node);
} else {
snprintf(dev_node, 32, "%s", "/dev/ttyUSB1");
LOGMUX(LOG_ERR, "ccci_get_node_name unknown, default tablet=%s", dev_node);
}
serial.devicename = dev_node;
while ((opt = getopt(argc, argv, "dov:s:t:p:f:n:h?m:b:P:")) > 0) {

27
src/gsm0710muxd-hack/src/gsm0710muxd.h

@ -2,6 +2,21 @@
#ifndef __GSM0710MUXD_H
#define __GSM0710MUXD_H
#include <assert.h>
#include <sys/socket.h>
/* Needed to make Mediatek's fork build */
#define MUX_ANDROID
#define AID_RADIO 1001
#define ANDROID_SOCKET_NAMESPACE_RESERVED 1
#define ANDROID_SOCKET_NAMESPACE_FILESYSTEM 2
#define property_set
#define property_get
#define PROPERTY_VALUE_MAX 1
/******************************************************************************/
#ifdef MTK_GEMINI
@ -140,8 +155,6 @@
#define LOG_TAG "MUXDMD2"
#endif
#include <utils/Log.h> //all Android LOG macros are defined here.
//just dummy defines since were not including syslog.h.
#define LOG_EMERG 0
#define LOG_ALERT 1
@ -154,13 +167,13 @@
#ifdef MTK_RIL_MD1
#define LOGMUX(lvl,f,...) do{if(lvl<=syslog_level){\
LOG_PRI(android_log_lvl_convert[lvl], LOG_TAG, \
"[gsm0710muxd] %d:%s(): " f, __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
fprintf(stderr, \
"[gsm0710muxd] %d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
}while(0)
#else
#define LOGMUX(lvl,f,...) do{if(lvl<=syslog_level){\
LOG_PRI(android_log_lvl_convert[lvl], LOG_TAG, \
"[gsm0710muxdmd2] %d:%s(): " f, __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
fprintf(stderr, \
"[gsm0710muxdmd2] %d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
}while(0)
#endif
@ -208,7 +221,7 @@
#define Gsm0710Muxd_Assert(index) \
{ \
LOGMUX(LOG_ERR, "ASSERT : ERROR_CODE=%d", index); \
LOG_ALWAYS_FATAL("ASSERT!!!!"); \
assert(0); \
}
#else
static int g_set_force_assert_flag = 0;

Loading…
Cancel
Save