configure_chip.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. : '
  3. ------------------------------------------------------------------------------
  4. Script Purpose:
  5. This script is designed to automatically configure the CH9329 USB-to-serial
  6. device to operate at a baudrate of 115200. It is intended for users who need
  7. to update the communication speed from the default or previously set value.
  8. You only need to do it ONCE after you have soldered the CH9329 chip to your
  9. board.
  10. Usage Instructions:
  11. 1. Ensure both the host and remote sides of the CH9329 device are connected
  12. to their respective USB ports. (The host side connects to your PC, which
  13. should show up as /dev/ttyUSB0 or similar. The remote side connects to
  14. your target device, usually another headless computer, which should show
  15. up as a USB HID device with keyboard and mouse capabilities.)
  16. 2. Power on the device before running this script.
  17. Important Notes:
  18. - The CH9329 device typically defaults to a baudrate of 9600. However, if it
  19. has been configured previously, it may be set to a different baudrate.
  20. - Incorrect configuration or misuse of this script may damage the device or
  21. render it unusable. Proceed with caution and ensure you understand the
  22. implications of changing device settings.
  23. WARNING:
  24. Use this script at your own risk. Double-check all connections and settings
  25. before execution to avoid potential hardware damage.
  26. ------------------------------------------------------------------------------
  27. '
  28. # Ask for baudrate with default 9600
  29. read -p "Enter baudrate [9600]: " baudrate
  30. baudrate=${baudrate:-9600}
  31. # Ask for USB KVM device path with default /dev/ttyUSB0
  32. read -p "Enter USB KVM device path [/dev/ttyUSB0]: " usbkvm
  33. usbkvm=${usbkvm:-/dev/ttyUSB0}
  34. # Run the command
  35. sudo ./remdeskd -mode=cfgchip -baudrate="$baudrate" -usbkvm="$usbkvm"