diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-07-05 13:53:24 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-07-05 13:53:24 +0200 |
commit | e94080b52dd1b205b107c30d9535feb9fdc4ff7f (patch) | |
tree | 7234edcc7d5ee84f0309619efd1152555664c57f | |
parent | 0bb1ce7aedfe482148e51201722f13d200679ea7 (diff) | |
download | external_libsamsung-ipc-e94080b52dd1b205b107c30d9535feb9fdc4ff7f.zip external_libsamsung-ipc-e94080b52dd1b205b107c30d9535feb9fdc4ff7f.tar.gz external_libsamsung-ipc-e94080b52dd1b205b107c30d9535feb9fdc4ff7f.tar.bz2 |
XMM6260: Always use ipc log handler, also reduced log output
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | samsung-ipc/Makefile.am | 2 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/fwloader_i9100.c | 198 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/fwloader_i9250.c | 212 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/io_helpers.c | 13 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/log.c | 45 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/log.h | 56 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/modemctl_common.c | 4 | ||||
-rw-r--r-- | samsung-ipc/device/xmm6260/modemctl_common.h | 1 |
9 files changed, 202 insertions, 330 deletions
@@ -61,7 +61,6 @@ samsung-ipc_files := \ samsung-ipc/device/xmm6260/fwloader_i9100.c \ samsung-ipc/device/xmm6260/fwloader_i9250.c \ samsung-ipc/device/xmm6260/io_helpers.c \ - samsung-ipc/device/xmm6260/log.c \ samsung-ipc/device/xmm6260/modemctl_common.c \ samsung-ipc/device/xmm6260/xmm6260_ipc.c diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am index 86a85ba..af15e61 100644 --- a/samsung-ipc/Makefile.am +++ b/samsung-ipc/Makefile.am @@ -41,8 +41,6 @@ libsamsung_ipc_la_SOURCES = \ device/xmm6260/fwloader_i9250.c \ device/xmm6260/io_helpers.c \ device/xmm6260/io_helpers.h \ - device/xmm6260/log.c \ - device/xmm6260/log.h \ device/xmm6260/modem_prj.h \ device/xmm6260/modemctl_common.c \ device/xmm6260/modemctl_common.h \ diff --git a/samsung-ipc/device/xmm6260/fwloader_i9100.c b/samsung-ipc/device/xmm6260/fwloader_i9100.c index 1d9e79d..0c6d80d 100644 --- a/samsung-ipc/device/xmm6260/fwloader_i9100.c +++ b/samsung-ipc/device/xmm6260/fwloader_i9100.c @@ -89,7 +89,7 @@ static int i9100_send_image(struct ipc_client *client, int ret = -1; if (type >= io_data->radio_parts_count) { - _e("bad image type %x", type); + ipc_client_log(client, "Error: bad image type %x", type); goto fail; } @@ -100,13 +100,13 @@ static int i9100_send_image(struct ipc_client *client, size_t end = length + start; //dump some image bytes - _d("image start"); + ipc_client_log(client, "image start"); // hexdump(io_data->radio_data + start, length); while (start < end) { ret = write(io_data->boot_fd, io_data->radio_data + start, end - start); if (ret < 0) { - _d("failed to write image chunk"); + ipc_client_log(client, "failed to write image chunk"); goto fail; } start += ret; @@ -115,11 +115,11 @@ static int i9100_send_image(struct ipc_client *client, unsigned char crc = calculateCRC(io_data->radio_data, offset, length); if ((ret = write(io_data->boot_fd, &crc, 1)) < 1) { - _d("failed to write CRC"); + ipc_client_log(client, "failed to write CRC"); goto fail; } else { - _d("wrote CRC %x", crc); + ipc_client_log(client, "wrote CRC %x", crc); } return 0; @@ -140,12 +140,12 @@ static int i9100_send_psi(struct ipc_client *client, struct modemctl_io_data *io int ret = -1; if ((ret = write(io_data->boot_fd, &hdr, sizeof(hdr))) != sizeof(hdr)) { - _d("%s: failed to write header, ret %d", __func__, ret); + ipc_client_log(client, "%s: failed to write header, ret %d", __func__, ret); goto fail; } if ((ret = i9100_send_image(client, io_data, PSI)) < 0) { - _e("failed to send PSI image"); + ipc_client_log(client, "Error: failed to send PSI image"); goto fail; } @@ -153,28 +153,27 @@ static int i9100_send_psi(struct ipc_client *client, struct modemctl_io_data *io for (i = 0; i < 22; i++) { char ack; if (expect_read(io_data->boot_fd, &ack, 1) < 1) { - _d("failed to read ACK byte %d", i); + ipc_client_log(client, "failed to read ACK byte %d", i); goto fail; } - _d("%02x ", ack); } if ((ret = expect_data(io_data->boot_fd, "\x1", 1)) < 0) { - _d("failed to wait for first ACK"); + ipc_client_log(client, "failed to wait for first ACK"); goto fail; } if ((ret = expect_data(io_data->boot_fd, "\x1", 1)) < 0) { - _d("failed to wait for second ACK"); + ipc_client_log(client, "failed to wait for second ACK"); goto fail; } if ((ret = expect_data(io_data->boot_fd, PSI_ACK_MAGIC, 2)) < 0) { - _e("failed to receive PSI ACK"); + ipc_client_log(client, "Error: failed to receive PSI ACK"); goto fail; } else { - _d("received PSI ACK"); + ipc_client_log(client, "received PSI ACK"); } return 0; @@ -190,22 +189,22 @@ static int i9100_send_ebl(struct ipc_client *client, struct modemctl_io_data *io unsigned length = i9100_radio_parts[EBL].length; if ((ret = write(fd, &length, sizeof(length))) < 0) { - _e("failed to write EBL length"); + ipc_client_log(client, "Error: failed to write EBL length"); goto fail; } if ((ret = expect_data(fd, EBL_HDR_ACK_MAGIC, 2)) < 0) { - _e("failed to wait for EBL header ACK"); + ipc_client_log(client, "Error: failed to wait for EBL header ACK"); goto fail; } if ((ret = i9100_send_image(client, io_data, EBL)) < 0) { - _e("failed to send EBL image"); + ipc_client_log(client, "Error: failed to send EBL image"); goto fail; } if ((ret = expect_data(fd, EBL_IMG_ACK_MAGIC, 2)) < 0) { - _e("failed to wait for EBL image ACK"); + ipc_client_log(client, "Error: failed to wait for EBL image ACK"); goto fail; } @@ -222,7 +221,7 @@ static int i9100_boot_cmd(struct ipc_client *client, int ret = 0; char *cmd_data = 0; if (cmd >= ARRAY_SIZE(i9100_boot_cmd_desc)) { - _e("bad command %x\n", cmd); + ipc_client_log(client, "Error: bad command %x\n", cmd); goto done_or_fail; } @@ -246,7 +245,7 @@ static int i9100_boot_cmd(struct ipc_client *client, cmd_data = (char*)malloc(buf_size); if (!cmd_data) { - _e("failed to allocate command buffer"); + ipc_client_log(client, "Error: failed to allocate command buffer"); ret = -ENOMEM; goto done_or_fail; } @@ -254,22 +253,17 @@ static int i9100_boot_cmd(struct ipc_client *client, memcpy(cmd_data, &header, sizeof(header)); memcpy(cmd_data + sizeof(header), data, data_size); - _d("bootloader cmd packet"); - hexdump(cmd_data, buf_size); - if ((ret = write(io_data->boot_fd, cmd_data, buf_size)) < 0) { - _e("failed to write command to socket"); + ipc_client_log(client, "Error: failed to write command to socket"); goto done_or_fail; } if ((unsigned)ret != buf_size) { - _e("written %d bytes of %d", ret, buf_size); + ipc_client_log(client, "Error: written %d bytes of %d", ret, buf_size); ret = -EINVAL; goto done_or_fail; } - _d("sent command %x magic=%x", header.cmd, header.check); - if (!i9100_boot_cmd_desc[cmd].need_ack) { ret = 0; goto done_or_fail; @@ -279,35 +273,32 @@ static int i9100_boot_cmd(struct ipc_client *client, .check = 0, }; if ((ret = expect_read(io_data->boot_fd, &ack, sizeof(ack))) < 0) { - _e("failed to receive ack for cmd %x", header.cmd); + ipc_client_log(client, "Error: failed to receive ack for cmd %x", header.cmd); goto done_or_fail; } if (ret != sizeof(ack)) { - _e("received %x bytes of %x for ack", ret, sizeof(ack)); + ipc_client_log(client, "Error: received %x bytes of %x for ack", ret, sizeof(ack)); ret = -EINVAL; goto done_or_fail; } - hexdump(&ack, sizeof(ack)); - if (ack.cmd != header.cmd) { - _e("ack cmd %x does not match request %x", ack.cmd, header.cmd); + ipc_client_log(client, "Error: ack cmd %x does not match request %x", ack.cmd, header.cmd); ret = -EINVAL; goto done_or_fail; } if ((ret = expect_read(io_data->boot_fd, cmd_data, cmd_size)) < 0) { - _e("failed to receive reply data"); + ipc_client_log(client, "Error: failed to receive reply data"); goto done_or_fail; } if ((unsigned)ret != cmd_size) { - _e("received %x bytes of %x for reply data", ret, cmd_size); + ipc_client_log(client, "Error: received %x bytes of %x for reply data", ret, cmd_size); ret = -EINVAL; goto done_or_fail; } - hexdump(cmd_data, cmd_size); done_or_fail: @@ -325,21 +316,20 @@ static int i9100_boot_info_ack(struct ipc_client *client, struct i9100_boot_info info; if ((ret = expect_read(io_data->boot_fd, &info, sizeof(info))) != sizeof(info)) { - _e("failed to receive Boot Info ret=%d", ret); + ipc_client_log(client, "Error: failed to receive Boot Info ret=%d", ret); ret = -1; goto fail; } else { - _d("received Boot Info"); - hexdump(&info, sizeof(info)); + ipc_client_log(client, "received Boot Info"); } if ((ret = i9100_boot_cmd(client, io_data, SetPortConf, &info, sizeof(info))) < 0) { - _e("failed to send SetPortConf command"); + ipc_client_log(client, "Error: failed to send SetPortConf command"); goto fail; } else { - _d("sent SetPortConf command"); + ipc_client_log(client, "sent SetPortConf command"); } return 0; @@ -357,11 +347,11 @@ static int i9100_send_image_data(struct ipc_client *client, char *data_p = (char *) data; if ((ret = i9100_boot_cmd(client, io_data, ReqFlashSetAddress, &addr, 4)) < 0) { - _e("failed to send ReqFlashSetAddress"); + ipc_client_log(client, "Error: failed to send ReqFlashSetAddress"); goto fail; } else { - _d("sent ReqFlashSetAddress"); + ipc_client_log(client, "sent ReqFlashSetAddress"); } while (count < data_len) { @@ -370,7 +360,7 @@ static int i9100_send_image_data(struct ipc_client *client, ret = i9100_boot_cmd(client, io_data, ReqFlashWriteBlock, data_p, chunk); if (ret < 0) { - _e("failed to send data chunk"); + ipc_client_log(client, "Error: failed to send data chunk"); goto fail; } @@ -408,19 +398,19 @@ static int i9100_send_secure_images(struct ipc_client *client, void *nv_data = NULL; if ((ret = i9100_boot_cmd(client, io_data, ReqSecStart, sec_img, sec_len)) < 0) { - _e("failed to write ReqSecStart"); + ipc_client_log(client, "Error: failed to write ReqSecStart"); goto fail; } else { - _d("sent ReqSecStart"); + ipc_client_log(client, "sent ReqSecStart"); } if ((ret = i9100_send_image_addr(client, io_data, FW_LOAD_ADDR, FIRMWARE)) < 0) { - _e("failed to send FIRMWARE image"); + ipc_client_log(client, "Error: failed to send FIRMWARE image"); goto fail; } else { - _d("sent FIRMWARE image"); + ipc_client_log(client, "sent FIRMWARE image"); } nv_data_check(client); @@ -428,16 +418,16 @@ static int i9100_send_secure_images(struct ipc_client *client, nv_data = ipc_file_read(client, nv_data_path(client), 2 << 20, 1024); if (nv_data == NULL) { - _e("failed to read NVDATA image"); + ipc_client_log(client, "Error: failed to read NVDATA image"); goto fail; } if ((ret = i9100_send_image_data(client, io_data, NVDATA_LOAD_ADDR, nv_data, 2 << 20)) < 0) { - _e("failed to send NVDATA image"); + ipc_client_log(client, "Error: failed to send NVDATA image"); goto fail; } else { - _d("sent NVDATA image"); + ipc_client_log(client, "sent NVDATA image"); } free(nv_data); @@ -445,21 +435,21 @@ static int i9100_send_secure_images(struct ipc_client *client, if ((ret = i9100_boot_cmd(client, io_data, ReqSecEnd, BL_END_MAGIC, BL_END_MAGIC_LEN)) < 0) { - _e("failed to write ReqSecEnd"); + ipc_client_log(client, "Error: failed to write ReqSecEnd"); goto fail; } else { - _d("sent ReqSecEnd"); + ipc_client_log(client, "sent ReqSecEnd"); } ret = i9100_boot_cmd(client, io_data, ReqForceHwReset, BL_RESET_MAGIC, BL_RESET_MAGIC_LEN); if (ret < 0) { - _e("failed to write ReqForceHwReset"); + ipc_client_log(client, "Error: failed to write ReqForceHwReset"); goto fail; } else { - _d("sent ReqForceHwReset"); + ipc_client_log(client, "sent ReqForceHwReset"); } fail: @@ -476,26 +466,26 @@ fail: static int i9100_ehci_setpower(struct ipc_client *client, bool enabled) { int ret = -1; - _d("%s: enabled=%d", __func__, enabled); + ipc_client_log(client, "%s: enabled=%d", __func__, enabled); int ehci_fd = open(I9100_EHCI_PATH, O_RDWR); if (ehci_fd < 0) { - _e("failed to open EHCI fd"); + ipc_client_log(client, "Error: failed to open EHCI fd"); ret = -ENODEV; goto fail; } else { - _d("opened EHCI %s: fd=%d", I9100_EHCI_PATH, ehci_fd); + ipc_client_log(client, "opened EHCI %s: fd=%d", I9100_EHCI_PATH, ehci_fd); } ret = write(ehci_fd, enabled ? "1" : "0", 1); //must write exactly one byte if (ret <= 0) { - _e("failed to set EHCI power"); + ipc_client_log(client, "Error: failed to set EHCI power"); } else { - _d("set EHCI power"); + ipc_client_log(client, "set EHCI power"); } fail: @@ -513,11 +503,11 @@ static int i9100_reboot_modem(struct ipc_client *client, //wait for link to become ready before redetection if (!hard) { if ((ret = modemctl_wait_link_ready(client, io_data)) < 0) { - _e("failed to wait for link to get ready for redetection"); + ipc_client_log(client, "Error: failed to wait for link to get ready for redetection"); goto fail; } else { - _d("link ready for redetection"); + ipc_client_log(client, "link ready for redetection"); } } @@ -526,36 +516,36 @@ static int i9100_reboot_modem(struct ipc_client *client, */ if (hard) { if ((ret = modemctl_modem_power(client, io_data, false)) < 0) { - _e("failed to disable xmm6260 power"); + ipc_client_log(client, "Error: failed to disable xmm6260 power"); goto fail; } else { - _d("disabled xmm6260 power"); + ipc_client_log(client, "disabled xmm6260 power"); } } if ((ret = modemctl_link_set_enabled(client, io_data, false)) < 0) { - _e("failed to disable I9100 HSIC link"); + ipc_client_log(client, "Error: failed to disable I9100 HSIC link"); goto fail; } else { - _d("disabled I9100 HSIC link"); + ipc_client_log(client, "disabled I9100 HSIC link"); } if ((ret = i9100_ehci_setpower(client, false)) < 0) { - _e("failed to disable I9100 EHCI"); + ipc_client_log(client, "Error: failed to disable I9100 EHCI"); goto fail; } else { - _d("disabled I9100 EHCI"); + ipc_client_log(client, "disabled I9100 EHCI"); } if ((ret = modemctl_link_set_active(client, io_data, false)) < 0) { - _e("failed to deactivate I9100 HSIC link"); + ipc_client_log(client, "Error: failed to deactivate I9100 HSIC link"); goto fail; } else { - _d("deactivated I9100 HSIC link"); + ipc_client_log(client, "deactivated I9100 HSIC link"); } /* @@ -563,45 +553,45 @@ static int i9100_reboot_modem(struct ipc_client *client, */ if ((ret = modemctl_link_set_enabled(client, io_data, true)) < 0) { - _e("failed to enable I9100 HSIC link"); + ipc_client_log(client, "Error: failed to enable I9100 HSIC link"); goto fail; } else { - _d("enabled I9100 HSIC link"); + ipc_client_log(client, "enabled I9100 HSIC link"); } if ((ret = i9100_ehci_setpower(client, true)) < 0) { - _e("failed to enable I9100 EHCI"); + ipc_client_log(client, "Error: failed to enable I9100 EHCI"); goto fail; } else { - _d("enabled I9100 EHCI"); + ipc_client_log(client, "enabled I9100 EHCI"); } if ((ret = modemctl_link_set_active(client, io_data, true)) < 0) { - _e("failed to activate I9100 HSIC link"); + ipc_client_log(client, "Error: failed to activate I9100 HSIC link"); goto fail; } else { - _d("activated I9100 HSIC link"); + ipc_client_log(client, "activated I9100 HSIC link"); } if (hard) { if ((ret = modemctl_modem_power(client, io_data, true)) < 0) { - _e("failed to enable xmm6260 power"); + ipc_client_log(client, "Error: failed to enable xmm6260 power"); goto fail; } else { - _d("enabled xmm6260 power"); + ipc_client_log(client, "enabled xmm6260 power"); } } if ((ret = modemctl_wait_link_ready(client, io_data)) < 0) { - _e("failed to wait for link to get ready"); + ipc_client_log(client, "Error: failed to wait for link to get ready"); goto fail; } else { - _d("link ready"); + ipc_client_log(client, "link ready"); } fail: @@ -618,116 +608,116 @@ int i9100_boot_modem(struct ipc_client *client) { io_data.radio_fd = open(RADIO_IMAGE, O_RDONLY); if (io_data.radio_fd < 0) { - _e("failed to open radio firmware"); + ipc_client_log(client, "Error: failed to open radio firmware"); goto fail; } else { - _d("opened radio image %s, fd=%d", RADIO_IMAGE, io_data.radio_fd); + ipc_client_log(client, "opened radio image %s, fd=%d", RADIO_IMAGE, io_data.radio_fd); } if (fstat(io_data.radio_fd, &io_data.radio_stat) < 0) { - _e("failed to stat radio image, error %s", strerror(errno)); + ipc_client_log(client, "Error: failed to stat radio image, error %s", strerror(errno)); goto fail; } io_data.radio_data = mmap(0, RADIO_MAP_SIZE, PROT_READ, MAP_SHARED, io_data.radio_fd, 0); if (io_data.radio_data == MAP_FAILED) { - _e("failed to mmap radio image, error %s", strerror(errno)); + ipc_client_log(client, "Error: failed to mmap radio image, error %s", strerror(errno)); goto fail; } io_data.boot_fd = open(BOOT_DEV, O_RDWR | O_NOCTTY | O_NONBLOCK); if (io_data.boot_fd < 0) { - _e("failed to open boot device"); + ipc_client_log(client, "Error: failed to open boot device"); goto fail; } else { - _d("opened boot device %s, fd=%d", BOOT_DEV, io_data.boot_fd); + ipc_client_log(client, "opened boot device %s, fd=%d", BOOT_DEV, io_data.boot_fd); } io_data.link_fd = open(LINK_PM, O_RDWR); if (io_data.link_fd < 0) { - _e("failed to open link device"); + ipc_client_log(client, "Error: failed to open link device"); goto fail; } else { - _d("opened link device %s, fd=%d", LINK_PM, io_data.link_fd); + ipc_client_log(client, "opened link device %s, fd=%d", LINK_PM, io_data.link_fd); } if (i9100_reboot_modem(client, &io_data, true)) { - _e("failed to hard reset modem"); + ipc_client_log(client, "Error: failed to hard reset modem"); goto fail; } else { - _d("modem hard reset done"); + ipc_client_log(client, "modem hard reset done"); } /* * Now, actually load the firmware */ if (write(io_data.boot_fd, "ATAT", 4) != 4) { - _e("failed to write ATAT to boot socket"); + ipc_client_log(client, "Error: failed to write ATAT to boot socket"); goto fail; } else { - _d("written ATAT to boot socket, waiting for ACK"); + ipc_client_log(client, "written ATAT to boot socket, waiting for ACK"); } char buf[2]; if (expect_read(io_data.boot_fd, buf, 1) < 0) { - _e("failed to receive bootloader ACK"); + ipc_client_log(client, "Error: failed to receive bootloader ACK"); goto fail; } if (expect_read(io_data.boot_fd, buf + 1, 1) < 0) { - _e("failed to receive chip IP ACK"); + ipc_client_log(client, "Error: failed to receive chip IP ACK"); goto fail; } - _i("receive ID: [%02x %02x]", buf[0], buf[1]); + ipc_client_log(client, "receive ID: [%02x %02x]", buf[0], buf[1]); if ((ret = i9100_send_psi(client, &io_data)) < 0) { - _e("failed to upload PSI"); + ipc_client_log(client, "Error: failed to upload PSI"); goto fail; } else { - _d("PSI download complete"); + ipc_client_log(client, "PSI download complete"); } if ((ret = i9100_send_ebl(client, &io_data)) < 0) { - _e("failed to upload EBL"); + ipc_client_log(client, "Error: failed to upload EBL"); goto fail; } else { - _d("EBL download complete"); + ipc_client_log(client, "EBL download complete"); } if ((ret = i9100_boot_info_ack(client, &io_data)) < 0) { - _e("failed to receive Boot Info"); + ipc_client_log(client, "Error: failed to receive Boot Info"); goto fail; } else { - _d("Boot Info ACK done"); + ipc_client_log(client, "Boot Info ACK done"); } if ((ret = i9100_send_secure_images(client, &io_data)) < 0) { - _e("failed to upload Secure Image"); + ipc_client_log(client, "Error: failed to upload Secure Image"); goto fail; } else { - _d("Secure Image download complete"); + ipc_client_log(client, "Secure Image download complete"); } usleep(POST_BOOT_TIMEOUT_US); if ((ret = i9100_reboot_modem(client, &io_data, false))) { - _e("failed to soft reset modem"); + ipc_client_log(client, "Error: failed to soft reset modem"); goto fail; } else { - _d("modem soft reset done"); + ipc_client_log(client, "modem soft reset done"); } - _i("online"); + ipc_client_log(client, "Modem is online!"); ret = 0; fail: diff --git a/samsung-ipc/device/xmm6260/fwloader_i9250.c b/samsung-ipc/device/xmm6260/fwloader_i9250.c index 1d4c5c0..3ea973f 100644 --- a/samsung-ipc/device/xmm6260/fwloader_i9250.c +++ b/samsung-ipc/device/xmm6260/fwloader_i9250.c @@ -82,7 +82,7 @@ static int i9250_send_image(struct ipc_client *client, int ret = -1; if (type >= ARRAY_SIZE(i9250_radio_parts)) { - _e("bad image type %x", type); + ipc_client_log(client, "Error: bad image type %x", type); goto fail; } @@ -95,8 +95,7 @@ static int i9250_send_image(struct ipc_client *client, unsigned char crc = calculateCRC(io_data->radio_data, offset, length); //dump some image bytes - _d("image start"); - hexdump(io_data->radio_data + start, length); + ipc_client_log(client, "image start"); size_t chunk_size = 0xdfc; @@ -105,31 +104,31 @@ static int i9250_send_image(struct ipc_client *client, size_t curr_chunk = chunk_size < remaining ? chunk_size : remaining; ret = write(io_data->boot_fd, io_data->radio_data + start, curr_chunk); if (ret < 0) { - _e("failed to write image chunk"); + ipc_client_log(client, "Error: failed to write image chunk"); goto fail; } start += ret; } - _d("sent image type=%d", type); + ipc_client_log(client, "sent image type=%d", type); if (type == EBL) { if ((ret = write(io_data->boot_fd, &crc, 1)) < 1) { - _e("failed to write EBL CRC"); + ipc_client_log(client, "Error: failed to write EBL CRC"); goto fail; } else { - _d("wrote EBL CRC %02x", crc); + ipc_client_log(client, "wrote EBL CRC %02x", crc); } goto done; } uint32_t crc32 = (crc << 24) | 0xffffff; if ((ret = write(io_data->boot_fd, &crc32, 4)) != 4) { - _e("failed to write CRC"); + ipc_client_log(client, "Error: failed to write CRC"); goto fail; } else { - _d("wrote CRC %x", crc); + ipc_client_log(client, "wrote CRC %x", crc); } done: @@ -145,12 +144,12 @@ static int i9250_send_psi(struct ipc_client *client, int ret = -1; if ((ret = write(io_data->boot_fd, I9250_PSI_START_MAGIC, 4)) < 0) { - _d("%s: failed to write header, ret %d", __func__, ret); + ipc_client_log(client, "%s: failed to write header, ret %d", __func__, ret); goto fail; } if ((ret = i9250_send_image(client, io_data, PSI)) < 0) { - _e("failed to send PSI image"); + ipc_client_log(client, "Error: failed to send PSI image"); goto fail; } @@ -165,11 +164,11 @@ static int i9250_send_psi(struct ipc_client *client, for (i = 0; i < ARRAY_SIZE(expected_acks); i++) { ret = expect_data(io_data->boot_fd, expected_acks[i], 4); if (ret < 0) { - _d("failed to wait for ack %d", i); + ipc_client_log(client, "failed to wait for ack %d", i); goto fail; } } - _d("received PSI ACK"); + ipc_client_log(client, "received PSI ACK"); return 0; @@ -185,50 +184,50 @@ static int i9250_send_ebl(struct ipc_client *client, unsigned length = i9250_radio_parts[EBL].length; if ((ret = write(fd, "\x04\x00\x00\x00", 4)) != 4) { - _e("failed to write length of EBL length ('4') "); + ipc_client_log(client, "Error: failed to write length of EBL length ('4') "); goto fail; } if ((ret = write(fd, &length, sizeof(length))) != sizeof(length)) { - _e("failed to write EBL length"); + ipc_client_log(client, "Error: failed to write EBL length"); goto fail; } if ((ret = expect_data(fd, I9250_GENERAL_ACK, 4)) < 0) { - _e("failed to wait for EBL length ACK"); + ipc_client_log(client, "Error: failed to wait for EBL length ACK"); goto fail; } if ((ret = expect_data(fd, I9250_EBL_HDR_ACK_MAGIC, 4)) < 0) { - _e("failed to wait for EBL header ACK"); + ipc_client_log(client, "Error: failed to wait for EBL header ACK"); goto fail; } length++; if ((ret = write(fd, &length, sizeof(length))) != sizeof(length)) { - _e("failed to write EBL length + 1"); + ipc_client_log(client, "Error: failed to write EBL length + 1"); goto fail; } if ((ret = i9250_send_image(client, io_data, EBL)) < 0) { - _e("failed to send EBL image"); + ipc_client_log(client, "Error: failed to send EBL image"); goto fail; } else { - _d("sent EBL image, waiting for ACK"); + ipc_client_log(client, "sent EBL image, waiting for ACK"); } if ((ret = expect_data(fd, I9250_GENERAL_ACK, 4)) < 0) { - _e("failed to wait for EBL image general ACK"); + ipc_client_log(client, "Error: failed to wait for EBL image general ACK"); goto fail; } if ((ret = expect_data(fd, I9250_EBL_IMG_ACK_MAGIC, 4)) < 0) { - _e("failed to wait for EBL image ACK"); + ipc_client_log(client, "Error: failed to wait for EBL image ACK"); goto fail; } else { - _d("got EBL ACK"); + ipc_client_log(client, "got EBL ACK"); } return 0; @@ -244,7 +243,7 @@ static int i9250_boot_cmd(struct ipc_client *client, int ret = 0; char *cmd_data = 0; if (cmd >= ARRAY_SIZE(i9250_boot_cmd_desc)) { - _e("bad command %x\n", cmd); + ipc_client_log(client, "Error: bad command %x\n", cmd); goto done_or_fail; } @@ -266,11 +265,11 @@ static int i9250_boot_cmd(struct ipc_client *client, } size_t cmd_buffer_size = data_size + sizeof(header) + tail_size; - _d("data_size %d [%d] checksum 0x%x", data_size, cmd_buffer_size, checksum); + ipc_client_log(client, "data_size %d [%d] checksum 0x%x", data_size, cmd_buffer_size, checksum); cmd_data = (char*)malloc(cmd_buffer_size); if (!cmd_data) { - _e("failed to allocate command buffer"); + ipc_client_log(client, "Error: failed to allocate command buffer"); ret = -ENOMEM; goto done_or_fail; } @@ -279,30 +278,25 @@ static int i9250_boot_cmd(struct ipc_client *client, memcpy(cmd_data + sizeof(header), data, data_size); memcpy(cmd_data + sizeof(header) + data_size, &tail, tail_size); - _d("bootloader cmd packet"); - hexdump(cmd_data, cmd_buffer_size); - hexdump(cmd_data + cmd_buffer_size - 16, 16); - if ((ret = write(io_data->boot_fd, cmd_data, cmd_buffer_size)) < 0) { - _e("failed to write command to socket"); + ipc_client_log(client, "Error: failed to write command to socket"); goto done_or_fail; } if ((unsigned)ret < cmd_buffer_size) { - _e("written %d bytes of %d", ret, cmd_buffer_size); + ipc_client_log(client, "Error: written %d bytes of %d", ret, cmd_buffer_size); ret = -EINVAL; goto done_or_fail; } - _d("sent command %x", header.cmd); if (i9250_boot_cmd_desc[cmd].no_ack) { - _i("not waiting for ACK"); + ipc_client_log(client, "not waiting for ACK"); goto done_or_fail; } uint32_t ack_length; if ((ret = expect_read(io_data->boot_fd, &ack_length, 4)) < 0) { - _e("failed to receive ack header length"); + ipc_client_log(client, "Error: failed to receive ack header length"); goto done_or_fail; } @@ -311,7 +305,7 @@ static int i9250_boot_cmd(struct ipc_client *client, cmd_data = NULL; cmd_data = malloc(ack_length + 4); if (!cmd_data) { - _e("failed to allocate the buffer for ack data"); + ipc_client_log(client, "Error: failed to allocate the buffer for ack data"); goto done_or_fail; } } @@ -319,21 +313,20 @@ static int i9250_boot_cmd(struct ipc_client *client, memcpy(cmd_data, &ack_length, 4); for (i = 0; i < (ack_length + 3) / 4; i++) { if ((ret = expect_read(io_data->boot_fd, cmd_data + ((i + 1) << 2), 4)) < 0) { - _e("failed to receive ack chunk"); + ipc_client_log(client, "Error: failed to receive ack chunk"); goto done_or_fail; } } - _d("received ack"); - hexdump(cmd_data, ack_length + 4); + ipc_client_log(client, "received ack"); struct i9250_boot_cmd_header *ack_hdr = (struct i9250_boot_cmd_header*)cmd_data; struct i9250_boot_tail_header *ack_tail = (struct i9250_boot_tail_header*) (cmd_data + ack_length + 4 - sizeof(struct i9250_boot_tail_header)); - _d("ack code 0x%x checksum 0x%x", ack_hdr->cmd, ack_tail->checksum); + ipc_client_log(client, "ack code 0x%x checksum 0x%x", ack_hdr->cmd, ack_tail->checksum); if (ack_hdr->cmd != header.cmd) { - _e("request and ack command codes do not match"); + ipc_client_log(client, "Error: request and ack command codes do not match"); ret = -1; goto done_or_fail; } @@ -358,15 +351,15 @@ static int i9250_boot_info_ack(struct ipc_client *client, if ((ret = expect_read(io_data->boot_fd, &boot_info_length, 4)) < 0) { - _e("failed to receive boot info length"); + ipc_client_log(client, "Error: failed to receive boot info length"); goto fail; } - _d("Boot Info length=0x%x", boot_info_length); + ipc_client_log(client, "Boot Info length=0x%x", boot_info_length); boot_info = (char*)malloc(boot_info_length); if (!boot_info) { - _e("failed to allocate memory for boot info"); + ipc_client_log(client, "Error: failed to allocate memory for boot info"); goto fail; } @@ -378,21 +371,20 @@ static int i9250_boot_info_ack(struct ipc_client *client, for (i = 0; i < boot_chunk_count; i++) { ret = expect_read(io_data->boot_fd, boot_info + (i * boot_chunk), boot_chunk); if (ret < 0) { - _e("failed to receive Boot Info chunk %i ret=%d", i, ret); + ipc_client_log(client, "Error: failed to receive Boot Info chunk %i ret=%d", i, ret); goto fail; } } - _d("received Boot Info"); - hexdump(boot_info, boot_info_length); + ipc_client_log(client, "received Boot Info"); ret = i9250_boot_cmd(client, io_data, SetPortConf, boot_info, boot_info_length); if (ret < 0) { - _e("failed to send SetPortConf command"); + ipc_client_log(client, "Error: failed to send SetPortConf command"); goto fail; } else { - _d("sent SetPortConf command"); + ipc_client_log(client, "sent SetPortConf command"); } ret = 0; @@ -414,11 +406,11 @@ static int i9250_send_image_data(struct ipc_client *client, char *data_p = (char *) data; if ((ret = i9250_boot_cmd(client, io_data, ReqFlashSetAddress, &addr, 4)) < 0) { - _e("failed to send ReqFlashSetAddress"); + ipc_client_log(client, "Error: failed to send ReqFlashSetAddress"); goto fail; } else { - _d("sent ReqFlashSetAddress"); + ipc_client_log(client, "sent ReqFlashSetAddress"); } while (count < data_len) { @@ -427,7 +419,7 @@ static int i9250_send_image_data(struct ipc_client *client, ret = i9250_boot_cmd(client, io_data, ReqFlashWriteBlock, data_p, chunk); if (ret < 0) { - _e("failed to send data chunk"); + ipc_client_log(client, "Error: failed to send data chunk"); goto fail; } @@ -464,23 +456,23 @@ static int i9250_send_mps_data(struct ipc_client *client, mps_fd = open(I9250_MPS_IMAGE_PATH, O_RDONLY); if (mps_fd < 0) { - _e("failed to open MPS data"); + ipc_client_log(client, "Error: failed to open MPS data"); } else { read(mps_fd, mps_data, I9250_MPS_LENGTH); } if ((ret = i9250_boot_cmd(client, io_data, ReqFlashSetAddress, &addr, 4)) < 0) { - _e("failed to send ReqFlashSetAddress"); + ipc_client_log(client, "Error: failed to send ReqFlashSetAddress"); goto fail; } else { - _d("sent ReqFlashSetAddress"); + ipc_client_log(client, "sent ReqFlashSetAddress"); } if ((ret = i9250_boot_cmd(client, io_data, ReqFlashWriteBlock, mps_data, I9250_MPS_LENGTH)) < 0) { - _e("failed to write MPS data to modem"); + ipc_client_log(client, "Error: failed to write MPS data to modem"); goto fail; } @@ -504,19 +496,19 @@ static int i9250_send_image_addrs(struct ipc_client *client, void *nv_data = NULL; if ((ret = i9250_boot_cmd(client, io_data, ReqSecStart, sec_img, sec_len)) < 0) { - _e("failed to write ReqSecStart"); + ipc_client_log(client, "Error: failed to write ReqSecStart"); goto fail; } else { - _d("sent ReqSecStart"); + ipc_client_log(client, "sent ReqSecStart"); } if ((ret = i9250_send_image_addr(client, io_data, FW_LOAD_ADDR, FIRMWARE)) < 0) { - _e("failed to send FIRMWARE image"); + ipc_client_log(client, "Error: failed to send FIRMWARE image"); goto fail; } else { - _d("sent FIRMWARE image"); + ipc_client_log(client, "sent FIRMWARE image"); } nv_data_check(client); @@ -524,46 +516,46 @@ static int i9250_send_image_addrs(struct ipc_client *client, nv_data = ipc_file_read(client, nv_data_path(client), 2 << 20, 1024); if (nv_data == NULL) { - _e("failed to read NVDATA image"); + ipc_client_log(client, "Error: failed to read NVDATA image"); goto fail; } if ((ret = i9250_send_image_data(client, io_data, NVDATA_LOAD_ADDR, nv_data, 2 << 20)) < 0) { - _e("failed to send NVDATA image"); + ipc_client_log(client, "Error: failed to send NVDATA image"); goto fail; } else { - _d("sent NVDATA image"); + ipc_client_log(client, "sent NVDATA image"); } free(nv_data); if ((ret = i9250_send_mps_data(client, io_data)) < 0) { - _e("failed to send MPS data"); + ipc_client_log(client, "Error: failed to send MPS data"); goto fail; } else { - _d("sent MPS data"); + ipc_client_log(client, "sent MPS data"); } if ((ret = i9250_boot_cmd(client, io_data, ReqSecEnd, BL_END_MAGIC, BL_END_MAGIC_LEN)) < 0) { - _e("failed to write ReqSecEnd"); + ipc_client_log(client, "Error: failed to write ReqSecEnd"); goto fail; } else { - _d("sent ReqSecEnd"); + ipc_client_log(client, "sent ReqSecEnd"); } ret = i9250_boot_cmd(client, io_data, ReqForceHwReset, BL_RESET_MAGIC, BL_RESET_MAGIC_LEN); if (ret < 0) { - _e("failed to write ReqForceHwReset"); + ipc_client_log(client, "Error: failed to write ReqForceHwReset"); goto fail; } else { - _d("sent ReqForceHwReset"); + ipc_client_log(client, "sent ReqForceHwReset"); } fail: @@ -583,38 +575,38 @@ static int i9250_reboot_modem(struct ipc_client *client, * Disable the hardware to ensure consistent state */ if ((ret = modemctl_modem_power(client, io_data, false)) < 0) { - _e("failed to disable modem power"); + ipc_client_log(client, "Error: failed to disable modem power"); goto fail; } else { - _d("disabled modem power"); + ipc_client_log(client, "disabled modem power"); } if ((ret = modemctl_modem_boot_power(client, io_data, false)) < 0) { - _e("failed to disable modem boot power"); + ipc_client_log(client, "Error: failed to disable modem boot power"); goto fail; } else { - _d("disabled modem boot power"); + ipc_client_log(client, "disabled modem boot power"); } /* * Now, initialize the hardware */ if ((ret = modemctl_modem_boot_power(client, io_data, true)) < 0) { - _e("failed to enable modem boot power"); + ipc_client_log(client, "Error: failed to enable modem boot power"); goto fail; } else { - _d("enabled modem boot power"); + ipc_client_log(client, "enabled modem boot power"); } if ((ret = modemctl_modem_power(client, io_data, true)) < 0) { - _e("failed to enable modem power"); + ipc_client_log(client, "Error: failed to enable modem power"); goto fail; } else { - _d("enabled modem power"); + ipc_client_log(client, "enabled modem power"); } fail: @@ -629,40 +621,40 @@ int i9250_boot_modem(struct ipc_client *client) io_data.radio_fd = open(I9250_RADIO_IMAGE, O_RDONLY); if (io_data.radio_fd < 0) { - _e("failed to open radio firmware"); + ipc_client_log(client, "Error: failed to open radio firmware"); goto fail; } else { - _d("opened radio image %s, fd=%d", I9250_RADIO_IMAGE, io_data.radio_fd); + ipc_client_log(client, "opened radio image %s, fd=%d", I9250_RADIO_IMAGE, io_data.radio_fd); } if (fstat(io_data.radio_fd, &io_data.radio_stat) < 0) { - _e("failed to stat radio image, error %s", strerror(errno)); + ipc_client_log(client, "Error: failed to stat radio image, error %s", strerror(errno)); goto fail; } io_data.radio_data = mmap(0, RADIO_MAP_SIZE, PROT_READ, MAP_SHARED, io_data.radio_fd, 0); if (io_data.radio_data == MAP_FAILED) { - _e("failed to mmap radio image, error %s", strerror(errno)); + ipc_client_log(client, "Error: failed to mmap radio image, error %s", strerror(errno)); goto fail; } io_data.boot_fd = open(BOOT_DEV, O_RDWR | O_NOCTTY | O_NONBLOCK); if (io_data.boot_fd < 0) { - _e("failed to open boot device"); + ipc_client_log(client, "Error: failed to open boot device"); goto fail; } else { - _d("opened boot device %s, fd=%d", BOOT_DEV, io_data.boot_fd); + ipc_client_log(client, "opened boot device %s, fd=%d", BOOT_DEV, io_data.boot_fd); } if (i9250_reboot_modem(client, &io_data, true) < 0) { - _e("failed to hard reset modem"); + ipc_client_log(client, "Error: failed to hard reset modem"); goto fail; } else { - _d("modem hard reset done"); + ipc_client_log(client, "modem hard reset done"); } /* @@ -671,36 +663,36 @@ int i9250_boot_modem(struct ipc_client *client) int i; for (i = 0; i < 2; i++) { if (write(io_data.boot_fd, "ATAT", 4) != 4) { - _e("failed to write ATAT to boot socket"); + ipc_client_log(client, "Error: failed to write ATAT to boot socket"); goto fail; } else { - _d("written ATAT to boot socket, waiting for ACK"); + ipc_client_log(client, "written ATAT to boot socket, waiting for ACK"); } if (expect(io_data.boot_fd, 100) < 0) { - _d("failed to select before next ACK, ignoring"); + ipc_client_log(client, "failed to select before next ACK, ignoring"); } } //FIXME: make sure it does not timeout or add the retry in the ril library if ((ret = expect(io_data.boot_fd, 100)) < 0) { - _e("failed to wait for bootloader ready state"); + ipc_client_log(client, "Error: failed to wait for bootloader ready state"); goto fail; } else { - _d("ready for PSI upload"); + ipc_client_log(client, "ready for PSI upload"); } ret = -ETIMEDOUT; for (i = 0; i < I9250_BOOT_REPLY_MAX; i++) { uint32_t id_buf; if ((ret = expect_read(io_data.boot_fd, (void*)&id_buf, 4)) != 4) { - _e("failed receiving bootloader reply"); + ipc_client_log(client, "Error: failed receiving bootloader reply"); goto fail; } - _d("got bootloader reply %08x", id_buf); + ipc_client_log(client, "got bootloader reply %08x", id_buf); if (id_buf == I9250_BOOT_LAST_MARKER) { ret = 0; break; @@ -708,81 +700,81 @@ int i9250_boot_modem(struct ipc_client *client) } if (ret < 0) { - _e("bootloader id marker not received"); + ipc_client_log(client, "Error: bootloader id marker not received"); goto fail; } else { - _d("got bootloader id marker"); + ipc_client_log(client, "got bootloader id marker"); } if ((ret = i9250_send_psi(client, &io_data)) < 0) { - _e("failed to upload PSI"); + ipc_client_log(client, "Error: failed to upload PSI"); goto fail; } else { - _d("PSI download complete"); + ipc_client_log(client, "PSI download complete"); } close(io_data.boot_fd); io_data.boot_fd = open(I9250_SECOND_BOOT_DEV, O_RDWR | O_NOCTTY | O_NONBLOCK); if (io_data.boot_fd < 0) { - _e("failed to open " I9250_SECOND_BOOT_DEV " control device"); + ipc_client_log(client, "Error: failed to open " I9250_SECOND_BOOT_DEV " control device"); goto fail; } else { - _d("opened second boot device %s, fd=%d", I9250_SECOND_BOOT_DEV, io_data.boot_fd); + ipc_client_log(client, "opened second boot device %s, fd=%d", I9250_SECOND_BOOT_DEV, io_data.boot_fd); } //RpsiCmdLoadAndExecute if ((ret = write(io_data.boot_fd, I9250_PSI_CMD_EXEC, 4)) < 0) { - _e("failed writing cmd_load_exe_EBL"); + ipc_client_log(client, "Error: failed writing cmd_load_exe_EBL"); goto fail; } if ((ret = write(io_data.boot_fd, I9250_PSI_EXEC_DATA, 8)) < 0) { - _e("failed writing 8 bytes to boot1"); + ipc_client_log(client, "Error: failed writing 8 bytes to boot1"); goto fail; } if ((ret = expect_data(io_data.boot_fd, I9250_GENERAL_ACK, 4)) < 0) { - _e("failed to receive cmd_load_exe_EBL ack"); + ipc_client_log(client, "Error: failed to receive cmd_load_exe_EBL ack"); goto fail; } if ((ret = expect_data(io_data.boot_fd, I9250_PSI_READY_ACK, 4)) < 0) { - _e("failed to receive PSI ready ack"); + ipc_client_log(client, "Error: failed to receive PSI ready ack"); goto fail; } if ((ret = i9250_send_ebl(client, &io_data)) < 0) { - _e("failed to upload EBL"); + ipc_client_log(client, "Error: failed to upload EBL"); goto fail; } else { - _d("EBL download complete"); + ipc_client_log(client, "EBL download complete"); } if ((ret = i9250_boot_info_ack(client, &io_data)) < 0) { - _e("failed to receive Boot Info"); + ipc_client_log(client, "Error: failed to receive Boot Info"); goto fail; } else { - _d("Boot Info ACK done"); + ipc_client_log(client, "Boot Info ACK done"); } if ((ret = i9250_send_image_addrs(client, &io_data)) < 0) { - _e("failed to upload Secure Image"); + ipc_client_log(client, "Error: failed to upload Secure Image"); goto fail; } else { - _d("Secure Image download complete"); + ipc_client_log(client, "Secure Image download complete"); } if ((ret = modemctl_wait_modem_online(client, &io_data))) { - _e("failed to wait for modem to become online"); + ipc_client_log(client, "Error: failed to wait for modem to become online"); goto fail; } - _i("modem online"); + ipc_client_log(client, "Modem is online!"); ret = 0; fail: diff --git a/samsung-ipc/device/xmm6260/io_helpers.c b/samsung-ipc/device/xmm6260/io_helpers.c index 6a6c1b8..0a38266 100644 --- a/samsung-ipc/device/xmm6260/io_helpers.c +++ b/samsung-ipc/device/xmm6260/io_helpers.c @@ -23,7 +23,6 @@ */ #include "io_helpers.h" -#include "log.h" #define DEFAULT_TIMEOUT 50 @@ -42,12 +41,12 @@ int expect(int fd, unsigned timeout) { ret = select(fd + 1, &read_set, 0, 0, &tv); if (ret < 0) { - _e("failed to select the fd %d ret=%d: %s", fd, ret, strerror(errno)); + // _e("failed to select the fd %d ret=%d: %s", fd, ret, strerror(errno)); goto fail; } if (ret < 1 || !FD_ISSET(fd, &read_set)) { - _d("fd %d not in fd set", fd); + // _d("fd %d not in fd set", fd); goto fail; } @@ -58,12 +57,9 @@ fail: int expect_read(int fd, void *buf, size_t size) { int ret; if ((ret = expect(fd, DEFAULT_TIMEOUT)) < 1) { - _e("failed to select the fd %d", fd); + // _e("failed to select the fd %d", fd); return ret; } - else { - _d("selected %d fds for fd=%d", ret, fd); - } return read(fd, buf, size); } @@ -73,11 +69,10 @@ int expect_data(int fd, void *data, size_t size) { char buf[size]; if ((ret = expect_read(fd, buf, size)) != size) { ret = -1; - _e("failed to receive data"); + // _e("failed to receive data"); return ret; } ret = memcmp(buf, data, size); - hexdump(buf, size); return ret; } diff --git a/samsung-ipc/device/xmm6260/log.c b/samsung-ipc/device/xmm6260/log.c deleted file mode 100644 index e7f3feb..0000000 --- a/samsung-ipc/device/xmm6260/log.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * log.c: Log debug macros for the Firmware Loader - * This file is part of: - * - * Firmware loader for Samsung I9100 and I9250 - * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com> - * - * based on the incomplete C++ implementation which is - * Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "log.h" - -void hexdump(void* data, size_t size) { - if (size < 1) { - return; - } - char *_data = (char*)data; - char __hd_buf[DUMP_SIZE * 3 + 1]; - - size_t len = size < DUMP_SIZE ? size : DUMP_SIZE; - memset(__hd_buf, 0, sizeof(__hd_buf)); - int i; - for (i = 0; i < len; i++) { - snprintf(__hd_buf + i * 3, 4, "%02x ", _data[i]); - } - - __hd_buf[sizeof(__hd_buf) - 1] = '\0'; - _d("%s", __hd_buf); -} - -// vim:ts=4:sw=4:expandtab diff --git a/samsung-ipc/device/xmm6260/log.h b/samsung-ipc/device/xmm6260/log.h deleted file mode 100644 index 3f0a065..0000000 --- a/samsung-ipc/device/xmm6260/log.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * log.h: Log debug macros for the Firmware Loader - * This file is part of: - * - * Firmware loader for Samsung I9100 and I9250 - * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com> - * - * based on the incomplete C++ implementation which is - * Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __LOG_H__ -#define __LOG_H__ - -#include "common.h" - -#ifndef SILENT - #define LOG_TAG "xmm6260-sec" - #define _p(fmt, x...) \ - do {\ - printf("[" LOG_TAG "]: " fmt " at %s:%s:%d\n", \ - ##x, __FILE__, __func__, __LINE__); \ - } while (0) -#else - #define _p(fmt, x...) do {} while (0) -#endif - -#ifdef DEBUG - #define _d(fmt, x...) _p("D/" fmt, ##x) -#else - #define _d(fmt, x...) do {} while (0) -#endif - -#define _e(fmt, x...) _p("E/" fmt, ##x) -#define _i(fmt, x...) _p("I/" fmt, ##x) - -#define DUMP_SIZE 16 - -void hexdump(void* data, size_t size); - -#endif //__LOG_H__ - -// vim:ts=4:sw=4:expandtab diff --git a/samsung-ipc/device/xmm6260/modemctl_common.c b/samsung-ipc/device/xmm6260/modemctl_common.c index 8c37bce..489f9fe 100644 --- a/samsung-ipc/device/xmm6260/modemctl_common.c +++ b/samsung-ipc/device/xmm6260/modemctl_common.c @@ -35,7 +35,7 @@ int modemctl_link_set_active(struct ipc_client *client, ret = ioctl(io_data->link_fd, ioctl_code, &status); if (ret < 0) { - _d("failed to set link active to %d", enabled); + ipc_client_log(client, "failed to set link active to %d", enabled); goto fail; } @@ -54,7 +54,7 @@ int modemctl_link_set_enabled(struct ipc_client *client, ret = ioctl(io_data->link_fd, ioctl_code, &status); if (ret < 0) { - _d("failed to set link state to %d", enabled); + ipc_client_log(client, "failed to set link state to %d", enabled); goto fail; } diff --git a/samsung-ipc/device/xmm6260/modemctl_common.h b/samsung-ipc/device/xmm6260/modemctl_common.h index f0646df..87c9555 100644 --- a/samsung-ipc/device/xmm6260/modemctl_common.h +++ b/samsung-ipc/device/xmm6260/modemctl_common.h @@ -25,7 +25,6 @@ #include <radio.h> #include "common.h" -#include "log.h" #include "io_helpers.h" //Samsung IOCTLs |