Spontaneous numlock
#71
Hmm, hacking away.  I thought the update process spewed out the number of the chip, I should have captured the output.  The writes are done I think in usb_keyboard.c in a function called write_kb_fw().  So I gutted it to disable the write for testing.
Code:
int write_kb_fw(const unsigned char *data, int data_length) {
// dummy function
  return 0;
}

int write_kb_fw0(const unsigned char *data, int data_length)  // renamed
{
  unsigned char hex_file[MAX_BINLEN];
  unsigned char read_hex_file[MAX_BINLEN];
  int hex_file_length;
  int rc;
  int try;

  hex_file_length = read_hexdata(data, data_length, hex_file);
  if (hex_file_length <= 0) {
    printf(">>> Failed to read: %d\n", data_length);
    return -1;
  }

  switch_to_boot_mode();

  printf("
[*] Opening in boot mode\n");
  for (try = 0; try < 20; try++) {
    rc = open_boot_mode();
    if (rc >= 0) {
      break;
    }
    usleep(100*1000);
  }

  if (try == 20) {
    printf(">>> Failed to open in boot mode\n");
    goto finish;
  }

  unsigned char reportData[6] = {
    0x5, 0x45, 0x45, 0x45, 0x45, 0x45
  };

  // flash erase
  printf("
[*]Erasing flash\n");
  rc = libusb_control_transfer(devh, 0x21, 0x09, 0x0305, 0,
    reportData, sizeof(reportData), 100);
  if (rc < 0) {
    printf("failed to erase flash\n");
    goto finish;
  }

  sleep(2);

  printf("
[*]Writing firmware...\n");
  // write FW
  for (try = 0; try < 5; try++) {
    rc = write_bulk(hex_file, hex_file_length);
    if (rc == 0) {
      break;
    }
  }

  if (try == 5) {
    printf("too many tries\n");
    rc = -1;
    goto finish;
  }

  printf("
[*]Reading back firmware...\n");
  // read FW
  for (try = 0; try < 5; try++) {
    rc = read_bulk(read_hex_file, hex_file_length);
    if (rc == 0) {
      break;
    }
  }

  if (try == 5) {
    printf("too many tries\n");
    rc = -1;
    goto finish;
  }

  printf("
[*]Comparing firmwares...\n");
  if (memcmp(hex_file, read_hex_file, 0x37fb)) {
    printf("FATAL ERROR FW does differ\n");
    for (int i = 0; i < hex_file_length; i++) {
      if (hex_file[i] == read_hex_file[i]) {
        continue;
      }
      printf(">>> 0x%04x] %02x != %02x\n", i, hex_file[i], read_hex_file[i]);
    }
    rc = -1;
    goto finish;
  }

#if 0
  printf("
[*]Writing serial number...\n");
  write_serial_number(1, 0x4100);
  if (rc < 0) {
    goto finish;
  }
#endif

  printf("
[*]Reseting device?\n");
  reset_device();

  printf("
[*]Finished succesfully!\n");
finish:
  close_usb();
  return rc;
}


But that disables too much, now when it runs I only see
Code:
Running STEP-1...

[*]Flashing keyboard updater firmware...
[*]Please reboot now, and run `step-2`.


Somewhere in there it reads some stuff from the flash and writes to the screen, maybe if I disable from "flash erase" to the end?

Well, no, it just shows a bunch of addresses. If there's a chip number it's not in the beginning of step 1. I thought I saw one somewhere in the process.

There's a step to unlock or whatever the USB, if you take that out the keyboard and touchpad are disabled. But I read it, and connected from a phone by ssh to do a screenshot and reboot.
  Reply


Messages In This Thread
Spontaneous numlock - by ab1jx - 04-06-2021, 03:00 PM
RE: Spontaneous numlock - by KC9UDX - 04-06-2021, 04:15 PM
RE: Spontaneous numlock - by ab1jx - 04-06-2021, 04:35 PM
RE: Spontaneous numlock - by dsimic - 04-07-2021, 05:11 PM
RE: Spontaneous numlock - by ab1jx - 04-07-2021, 06:56 PM
RE: Spontaneous numlock - by dsimic - 04-07-2021, 07:27 PM
RE: Spontaneous numlock - by ab1jx - 04-10-2021, 01:29 PM
RE: Spontaneous numlock - by dsimic - 04-10-2021, 01:33 PM
RE: Spontaneous numlock - by ab1jx - 04-10-2021, 02:47 PM
RE: Spontaneous numlock - by dsimic - 04-10-2021, 03:11 PM
RE: Spontaneous numlock - by ab1jx - 04-10-2021, 03:53 PM
RE: Spontaneous numlock - by dsimic - 04-11-2021, 12:31 AM
RE: Spontaneous numlock - by ab1jx - 04-11-2021, 02:00 AM
RE: Spontaneous numlock - by dsimic - 04-11-2021, 02:34 AM
RE: Spontaneous numlock - by ab1jx - 04-11-2021, 06:39 AM
RE: Spontaneous numlock - by dsimic - 04-11-2021, 07:25 AM
RE: Spontaneous numlock - by ab1jx - 04-11-2021, 04:04 PM
RE: Spontaneous numlock - by dsimic - 04-11-2021, 11:10 PM
RE: Spontaneous numlock - by ab1jx - 04-12-2021, 02:00 AM
RE: Spontaneous numlock - by dsimic - 04-12-2021, 02:10 AM
RE: Spontaneous numlock - by ab1jx - 04-12-2021, 06:59 AM
RE: Spontaneous numlock - by dsimic - 04-12-2021, 08:11 AM
RE: Spontaneous numlock - by ab1jx - 04-12-2021, 09:40 AM
RE: Spontaneous numlock - by dsimic - 04-12-2021, 10:08 AM
RE: Spontaneous numlock - by wdt - 04-12-2021, 11:05 AM
RE: Spontaneous numlock - by dsimic - 04-12-2021, 12:10 PM
RE: Spontaneous numlock - by ab1jx - 04-13-2021, 05:25 AM
RE: Spontaneous numlock - by dsimic - 04-14-2021, 10:17 AM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 10:44 AM
RE: Spontaneous numlock - by dsimic - 04-14-2021, 11:04 AM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 12:24 PM
RE: Spontaneous numlock - by dsimic - 04-14-2021, 12:45 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 01:06 PM
RE: Spontaneous numlock - by dsimic - 04-14-2021, 01:24 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 01:53 PM
RE: Spontaneous numlock - by dsimic - 04-14-2021, 01:57 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 02:14 PM
RE: Spontaneous numlock - by KC9UDX - 04-14-2021, 04:09 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 05:40 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 07:55 PM
RE: Spontaneous numlock - by wdt - 04-14-2021, 09:02 PM
RE: Spontaneous numlock - by ab1jx - 04-14-2021, 10:26 PM
RE: Spontaneous numlock - by ab1jx - 04-15-2021, 06:44 AM
RE: Spontaneous numlock - by KC9UDX - 04-15-2021, 09:57 AM
RE: Spontaneous numlock - by ab1jx - 04-15-2021, 10:46 AM
RE: Spontaneous numlock - by ab1jx - 04-15-2021, 05:14 PM
RE: Spontaneous numlock - by KC9UDX - 04-15-2021, 08:19 PM
RE: Spontaneous numlock - by ab1jx - 04-15-2021, 08:46 PM
RE: Spontaneous numlock - by KC9UDX - 04-15-2021, 11:07 PM
RE: Spontaneous numlock - by ab1jx - 04-16-2021, 04:52 AM
RE: Spontaneous numlock - by KC9UDX - 04-16-2021, 07:36 AM
RE: Spontaneous numlock - by ab1jx - 04-16-2021, 08:30 AM
RE: Spontaneous numlock - by ab1jx - 04-16-2021, 07:44 PM
RE: Spontaneous numlock - by KC9UDX - 04-17-2021, 02:26 AM
RE: Spontaneous numlock - by ab1jx - 04-17-2021, 05:50 AM
RE: Spontaneous numlock - by KC9UDX - 04-17-2021, 02:57 PM
RE: Spontaneous numlock - by ab1jx - 04-17-2021, 07:49 PM
RE: Spontaneous numlock - by KC9UDX - 04-18-2021, 04:25 AM
RE: Spontaneous numlock - by ab1jx - 04-18-2021, 06:54 AM
RE: Spontaneous numlock - by KC9UDX - 04-18-2021, 01:15 PM
RE: Spontaneous numlock - by ab1jx - 04-18-2021, 01:59 PM
RE: Spontaneous numlock - by KC9UDX - 04-18-2021, 02:32 PM
RE: Spontaneous numlock - by ab1jx - 04-18-2021, 04:25 PM
RE: Spontaneous numlock - by KC9UDX - 04-18-2021, 05:02 PM
RE: Spontaneous numlock - by ab1jx - 04-18-2021, 05:42 PM
RE: Spontaneous numlock - by KC9UDX - 04-18-2021, 06:19 PM
RE: Spontaneous numlock - by ab1jx - 04-19-2021, 05:24 AM
RE: Spontaneous numlock - by KC9UDX - 04-19-2021, 06:50 AM
RE: Spontaneous numlock - by ab1jx - 04-19-2021, 07:48 AM
RE: Spontaneous numlock - by KC9UDX - 04-19-2021, 08:58 AM
RE: Spontaneous numlock - by ab1jx - 04-19-2021, 10:02 AM
RE: Spontaneous numlock - by ab1jx - 04-19-2021, 11:05 AM
RE: Spontaneous numlock - by KC9UDX - 04-19-2021, 04:35 PM
RE: Spontaneous numlock - by ab1jx - 04-19-2021, 05:24 PM
RE: Spontaneous numlock - by KC9UDX - 04-20-2021, 05:13 AM
RE: Spontaneous numlock - by ab1jx - 04-20-2021, 07:09 AM
RE: Spontaneous numlock - by dsimic - 04-20-2021, 08:22 AM
RE: Spontaneous numlock - by ab1jx - 04-20-2021, 08:59 AM
RE: Spontaneous numlock - by slyecho - 04-20-2021, 01:50 PM
RE: Spontaneous numlock - by ab1jx - 04-20-2021, 03:09 PM
RE: Spontaneous numlock - by dsimic - 04-20-2021, 03:18 PM
RE: Spontaneous numlock - by ab1jx - 04-20-2021, 11:21 PM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 12:15 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 01:08 AM
RE: Spontaneous numlock - by KC9UDX - 04-21-2021, 01:09 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 02:07 AM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 02:55 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 03:43 AM
RE: Spontaneous numlock - by KC9UDX - 04-21-2021, 04:49 AM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 10:43 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 05:34 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 11:48 AM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 11:53 AM
RE: Spontaneous numlock - by ab1jx - 04-21-2021, 02:18 PM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 02:33 PM
RE: Spontaneous numlock - by KC9UDX - 04-21-2021, 04:36 PM
RE: Spontaneous numlock - by dsimic - 04-21-2021, 04:55 PM
RE: Spontaneous numlock - by KC9UDX - 04-22-2021, 12:05 AM
RE: Spontaneous numlock - by dsimic - 04-25-2021, 12:18 PM
RE: Spontaneous numlock - by ab1jx - 04-23-2021, 09:09 PM
RE: Spontaneous numlock - by KC9UDX - 04-24-2021, 05:23 AM
RE: Spontaneous numlock - by ab1jx - 04-24-2021, 07:05 AM
RE: Spontaneous numlock - by ab1jx - 04-24-2021, 06:57 PM
RE: Spontaneous numlock - by KC9UDX - 04-25-2021, 11:59 AM
RE: Spontaneous numlock - by ab1jx - 04-25-2021, 12:55 PM
RE: Spontaneous numlock - by dsimic - 04-25-2021, 01:26 PM
RE: Spontaneous numlock - by KC9UDX - 04-25-2021, 03:09 PM
RE: Spontaneous numlock - by ab1jx - 04-25-2021, 04:38 PM
RE: Spontaneous numlock - by dsimic - 04-25-2021, 05:39 PM
RE: Spontaneous numlock - by ab1jx - 04-25-2021, 07:16 PM
RE: Spontaneous numlock - by dsimic - 04-25-2021, 07:32 PM
RE: Spontaneous numlock - by ab1jx - 04-25-2021, 09:05 PM
RE: Spontaneous numlock - by dsimic - 04-25-2021, 09:22 PM
RE: Spontaneous numlock - by KC9UDX - 04-25-2021, 10:11 PM
RE: Spontaneous numlock - by ab1jx - 04-26-2021, 05:15 AM
RE: Spontaneous numlock - by KC9UDX - 04-26-2021, 05:44 PM
RE: Spontaneous numlock - by ab1jx - 04-26-2021, 08:00 PM
RE: Spontaneous numlock - by dsimic - 04-30-2021, 01:46 AM
RE: Spontaneous numlock - by ab1jx - 04-30-2021, 03:44 AM

Forum Jump:


Users browsing this thread: 11 Guest(s)