FreeCalypso > hg > fc-usbser-tools
view cp2102/cp210x_defs.h @ 68:5cbde3c80c24
fteeprom-{erase,prog}: detach logic: change to detach by default
As it turns out, detaching all ttyUSB interfaces of a multichannel device
does not require outside knowledge of how many channels there are, as in
our previous -d option design that is being removed here - instead we can
read the bNumInterfaces constant from the USB device's config descriptor
and thus know how many interfaces there are in total. Based on this
discovery, change the design of fteeprom-{erase,prog} as follows:
* remove -d option;
* flip the default to where we detach all interfaces by default;
* add -n option to NOT detach any interfaces.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 13 Sep 2023 06:37:03 +0000 |
| parents | d4d3531d342a |
| children |
line wrap: on
line source
/* * Definitions for talking to CP2102 and perhaps other CP210x chips, * taken from Python-based cp210x-program-1.0 tool from 2014, * translated from Python to C. */ #define CP210x_CONFIG 0xFF #define REG_VENDOR_ID 0x3701 #define REG_PRODUCT_ID 0x3702 #define REG_PRODUCT_STRING 0x3703 #define REG_SERIAL_NUMBER 0x3704 #define REG_CFG_ATTRIBUTES 0x3705 #define REG_MAX_POWER 0x3706 #define REG_VERSION 0x3707 #define REG_UNKNOWN 0x3708 #define REG_EEPROM 0x3709 #define REG_LOCK_VALUE 0x370A #define REG_PART_NUMBER 0x370B #define SIZE_EEPROM 0x0400 #define SIZE_PRODUCT_STRING 255 #define SIZE_SERIAL_NUMBER 128 #define SIZE_BAUDRATES 32 #define SIZE_BAUDRATE_CFG 10 #define SIZE_BAUDRATE_TABLE (SIZE_BAUDRATES * SIZE_BAUDRATE_CFG) #define SIZE_VENDOR_STRING 50 #define EEPROM_START_ADDR 0x3600 /* a little bit adapted from libftdi */ #define DEVICE_OUT_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT) #define DEVICE_IN_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN) #define USB_READ_TIMEOUT 5000 #define USB_WRITE_TIMEOUT 5000
