Merge branch 'master' of https://github.com/sergev/dmrconfig
This commit is contained in:
commit
9cd07d3cd2
31
dfu.c
31
dfu.c
@ -126,7 +126,7 @@ static int get_status()
|
|||||||
}
|
}
|
||||||
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_HOST,
|
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_HOST,
|
||||||
REQUEST_GETSTATUS, 0, 0, (unsigned char*)&status, 6, 0);
|
REQUEST_GETSTATUS, 0, 0, (unsigned char*)&status, 6, 0);
|
||||||
if (trace_flag && error == USB_OK) {
|
if (trace_flag && error >= 0) {
|
||||||
printf("--- Recv ");
|
printf("--- Recv ");
|
||||||
print_hex((unsigned char*)&status, 6);
|
print_hex((unsigned char*)&status, 6);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -154,7 +154,7 @@ static int get_state(int *pstate)
|
|||||||
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_HOST,
|
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_HOST,
|
||||||
REQUEST_GETSTATE, 0, 0, &state, 1, 0);
|
REQUEST_GETSTATE, 0, 0, &state, 1, 0);
|
||||||
*pstate = state;
|
*pstate = state;
|
||||||
if (trace_flag && error == USB_OK) {
|
if (trace_flag && error >= 0) {
|
||||||
printf("--- Recv ");
|
printf("--- Recv ");
|
||||||
print_hex(&state, 1);
|
print_hex(&state, 1);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -305,7 +305,7 @@ static const char *identify()
|
|||||||
__func__, error, libusb_strerror(error));
|
__func__, error, libusb_strerror(error));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (trace_flag && error == USB_OK) {
|
if (trace_flag) {
|
||||||
printf("--- Recv ");
|
printf("--- Recv ");
|
||||||
print_hex(data, 64);
|
print_hex(data, 64);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -417,7 +417,7 @@ void dfu_read_block(int bno, uint8_t *data, int nbytes)
|
|||||||
__func__, bno, nbytes, error, libusb_strerror(error));
|
__func__, bno, nbytes, error, libusb_strerror(error));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (trace_flag && error == USB_OK) {
|
if (trace_flag > 1) {
|
||||||
printf("--- Recv ");
|
printf("--- Recv ");
|
||||||
print_hex(data, nbytes);
|
print_hex(data, nbytes);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -432,7 +432,8 @@ void dfu_write_block(int bno, uint8_t *data, int nbytes)
|
|||||||
|
|
||||||
if (trace_flag) {
|
if (trace_flag) {
|
||||||
printf("--- Send DNLOAD [%d] ", nbytes);
|
printf("--- Send DNLOAD [%d] ", nbytes);
|
||||||
print_hex(data, nbytes);
|
if (trace_flag > 1)
|
||||||
|
print_hex(data, nbytes);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_DEVICE,
|
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_DEVICE,
|
||||||
@ -446,3 +447,23 @@ void dfu_write_block(int bno, uint8_t *data, int nbytes)
|
|||||||
get_status();
|
get_status();
|
||||||
wait_dfu_idle();
|
wait_dfu_idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dfu_reboot()
|
||||||
|
{
|
||||||
|
unsigned char cmd[2] = { 0x91, 0x05 };
|
||||||
|
|
||||||
|
if (trace_flag) {
|
||||||
|
printf("--- Send DNLOAD [2] ");
|
||||||
|
print_hex(cmd, 2);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
wait_dfu_idle();
|
||||||
|
int error = libusb_control_transfer(dev, REQUEST_TYPE_TO_DEVICE,
|
||||||
|
REQUEST_DNLOAD, 0, 0, cmd, 2, 0);
|
||||||
|
if (error < 0) {
|
||||||
|
fprintf(stderr, "%s: cannot send command: %d: %s\n",
|
||||||
|
__func__, error, libusb_strerror(error));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
get_status();
|
||||||
|
}
|
||||||
|
4
md380.c
4
md380.c
@ -322,10 +322,10 @@ typedef struct {
|
|||||||
|
|
||||||
static const char *POWER_NAME[] = { "Low", "High" };
|
static const char *POWER_NAME[] = { "Low", "High" };
|
||||||
static const char *SQUELCH_NAME[] = { "Tight", "Normal" };
|
static const char *SQUELCH_NAME[] = { "Tight", "Normal" };
|
||||||
static const char *BANDWIDTH[] = { "12.5", "20", "25" };
|
static const char *BANDWIDTH[] = { "12.5", "20", "25", "25" };
|
||||||
static const char *CONTACT_TYPE[] = { "-", "Group", "Private", "All" };
|
static const char *CONTACT_TYPE[] = { "-", "Group", "Private", "All" };
|
||||||
static const char *ADMIT_NAME[] = { "-", "Free", "Tone", "Color" };
|
static const char *ADMIT_NAME[] = { "-", "Free", "Tone", "Color" };
|
||||||
static const char *INCALL_NAME[] = { "-", "Admit", "???", "???" };
|
static const char *INCALL_NAME[] = { "-", "Admit", "-", "Admit" };
|
||||||
|
|
||||||
#ifdef PRINT_RARE_PARAMS
|
#ifdef PRINT_RARE_PARAMS
|
||||||
static const char *REF_FREQUENCY[] = { "Low", "Med", "High" };
|
static const char *REF_FREQUENCY[] = { "Low", "Med", "High" };
|
||||||
|
6
radio.c
6
radio.c
@ -47,11 +47,9 @@ void radio_disconnect()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Close device.\n");
|
fprintf(stderr, "Close device.\n");
|
||||||
|
|
||||||
// Restore the port mode.
|
// Restore the normal radio mode.
|
||||||
|
dfu_reboot();
|
||||||
dfu_close();
|
dfu_close();
|
||||||
|
|
||||||
// Radio needs a timeout to reset to a normal state.
|
|
||||||
mdelay(2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
1
util.h
1
util.h
@ -63,6 +63,7 @@ void dfu_close(void);
|
|||||||
void dfu_erase(int nbytes);
|
void dfu_erase(int nbytes);
|
||||||
void dfu_read_block(int bno, unsigned char *data, int nbytes);
|
void dfu_read_block(int bno, unsigned char *data, int nbytes);
|
||||||
void dfu_write_block(int bno, unsigned char *data, int nbytes);
|
void dfu_write_block(int bno, unsigned char *data, int nbytes);
|
||||||
|
void dfu_reboot(void);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Delay in milliseconds.
|
// Delay in milliseconds.
|
||||||
|
8
uv380.c
8
uv380.c
@ -338,17 +338,17 @@ typedef struct {
|
|||||||
uint16_t radio_name[16];
|
uint16_t radio_name[16];
|
||||||
} general_settings_t;
|
} general_settings_t;
|
||||||
|
|
||||||
static const char *POWER_NAME[] = { "Low", "???", "Mid", "High" };
|
static const char *POWER_NAME[] = { "Low", "Low", "Mid", "High" };
|
||||||
static const char *BANDWIDTH[] = { "12.5", "20", "25" };
|
static const char *BANDWIDTH[] = { "12.5", "20", "25", "25" };
|
||||||
static const char *CONTACT_TYPE[] = { "-", "Group", "Private", "All" };
|
static const char *CONTACT_TYPE[] = { "-", "Group", "Private", "All" };
|
||||||
static const char *ADMIT_NAME[] = { "-", "Free", "Tone", "Color" };
|
static const char *ADMIT_NAME[] = { "-", "Free", "Tone", "Color" };
|
||||||
static const char *INCALL_NAME[] = { "-", "Admit", "TXInt" };
|
static const char *INCALL_NAME[] = { "-", "Admit", "TXInt", "Admit" };
|
||||||
|
|
||||||
#ifdef PRINT_RARE_PARAMS
|
#ifdef PRINT_RARE_PARAMS
|
||||||
static const char *REF_FREQUENCY[] = { "Low", "Med", "High" };
|
static const char *REF_FREQUENCY[] = { "Low", "Med", "High" };
|
||||||
static const char *PRIVACY_NAME[] = { "-", "Basic", "Enhanced" };
|
static const char *PRIVACY_NAME[] = { "-", "Basic", "Enhanced" };
|
||||||
static const char *SIGNALING_SYSTEM[] = { "-", "DTMF-1", "DTMF-2", "DTMF-3", "DTMF-4" };
|
static const char *SIGNALING_SYSTEM[] = { "-", "DTMF-1", "DTMF-2", "DTMF-3", "DTMF-4" };
|
||||||
static const char *TURNOFF_FREQ[] = { "259.2", "55.2", "???", "-" };
|
static const char *TURNOFF_FREQ[] = { "259.2", "55.2", "-", "-" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user