Merge branch 'master' into patch-1

This commit is contained in:
Serge Vakulenko 2019-09-18 22:12:09 -07:00 committed by GitHub
commit 942dd9cd65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 2825 additions and 226 deletions

218
LICENSE
View File

@ -1,201 +1,29 @@
Apache License BSD 3-Clause License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION Copyright (C) 2018-2019, Serge Vakulenko KK6ABQ
All rights reserved.
1. Definitions. Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
"License" shall mean the terms and conditions for use, reproduction, 1. Redistributions of source code must retain the above copyright notice, this
and distribution as defined by Sections 1 through 9 of this document. list of conditions and the following disclaimer.
"Licensor" shall mean the copyright owner or entity authorized by 2. Redistributions in binary form must reproduce the above copyright notice,
the copyright owner that is granting the License. this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
"Legal Entity" shall mean the union of the acting entity and all 3. Neither the name of the copyright holder nor the names of its
other entities that control, are controlled by, or are under common contributors may be used to endorse or promote products derived from
control with that entity. For the purposes of this definition, this software without specific prior written permission.
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
exercising permissions granted by this License. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
"Source" form shall mean the preferred form for making modifications, DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
including but not limited to software source code, documentation FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
source, and configuration files. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
"Object" form shall mean any form resulting from mechanical CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
transformation or translation of a Source form, including but OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
not limited to compiled object code, generated documentation, OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -3,25 +3,34 @@ CC ?= gcc
VERSION = $(shell git describe --tags --abbrev=0) VERSION = $(shell git describe --tags --abbrev=0)
GITCOUNT = $(shell git rev-list HEAD --count) GITCOUNT = $(shell git rev-list HEAD --count)
UNAME = $(shell uname) UNAME = $(shell uname)
CFLAGS ?= -g -O -Wall -Werror
CFLAGS += -DVERSION='"$(VERSION).$(GITCOUNT)"'
LDFLAGS ?= -g
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o gd77.o hid.o serial.o d868uv.o OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o \
LIBS = -lusb-1.0 gd77.o hid.o serial.o d868uv.o dm1801.o
CFLAGS ?= -g -O -Wall -Werror
CFLAGS += -DVERSION='"$(VERSION).$(GITCOUNT)"' \
$(shell pkg-config --cflags libusb-1.0)
LDFLAGS ?= -g
LIBS = $(shell pkg-config --libs --static libusb-1.0)
#
# Make sure pkg-config is installed.
#
ifeq ($(shell pkg-config --version),)
$(error Fatal error: pkg-config is not installed)
endif
# #
# Linux # Linux
# #
# To install required libraries, use: # To install required libraries, use:
# sudo apt install libusb-1.0-0-dev libudev-dev # sudo apt-get install pkg-config libusb-1.0-0-dev libudev-dev
# #
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
OBJS += hid-libusb.o OBJS += hid-libusb.o
LIBS += -ludev
# Link libusb statically, when possible
LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a
ifeq ($(wildcard $(LIBUSB)),$(LIBUSB)) ifeq ($(wildcard $(LIBUSB)),$(LIBUSB))
# Link libusb statically, when possible
LIBS = $(LIBUSB) -lpthread -ludev LIBS = $(LIBUSB) -lpthread -ludev
endif endif
endif endif
@ -29,6 +38,9 @@ endif
# #
# Mac OS X # Mac OS X
# #
# To install required libraries, use:
# brew install pkg-config libusb
#
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
OBJS += hid-macos.o OBJS += hid-macos.o
LIBS += -framework IOKit -framework CoreFoundation LIBS += -framework IOKit -framework CoreFoundation
@ -45,10 +57,6 @@ clean:
install: dmrconfig install: dmrconfig
install -c -s dmrconfig /usr/local/bin/dmrconfig install -c -s dmrconfig /usr/local/bin/dmrconfig
dmrconfig.linux: dmrconfig
cp -p $< $@
strip $@
### ###
d868uv.o: d868uv.c radio.h util.h d868uv-map.h d868uv.o: d868uv.c radio.h util.h d868uv-map.h
dfu-libusb.o: dfu-libusb.c util.h dfu-libusb.o: dfu-libusb.c util.h

View File

@ -5,7 +5,8 @@ GITCOUNT = $(shell git rev-list HEAD --count)
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"' CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"'
LDFLAGS = -g -s LDFLAGS = -g -s
OBJS = main.o util.o radio.o dfu-windows.o uv380.o md380.o rd5r.o gd77.o hid.o hid-windows.o serial.o d868uv.o OBJS = main.o util.o radio.o dfu-windows.o uv380.o md380.o rd5r.o \
gd77.o hid.o hid-windows.o serial.o d868uv.o dm1801.o
LIBS = -lhid -lsetupapi LIBS = -lhid -lsetupapi
# Compiling Windows binary from Linux # Compiling Windows binary from Linux

View File

@ -9,6 +9,7 @@ Supported radios:
* TYT MD-9600 * TYT MD-9600
* Baofeng DM-1701, Retevis RT84 * Baofeng DM-1701, Retevis RT84
* Baofeng RD-5R, TD-5R * Baofeng RD-5R, TD-5R
* Baofeng DM-1801
* Radioddity GD-77 * Radioddity GD-77
* Anytone AT-D868UV * Anytone AT-D868UV
* Anytone AT-D878UV * Anytone AT-D878UV
@ -59,7 +60,7 @@ Create a file /etc/udev/rules.d/99-dmr.rules with the following contents:
# TYT MD-UV380 # TYT MD-UV380
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="666"
# Baofeng RD-5R, TD-5R # Baofeng RD-5R, TD-5R, DM-1801
SUBSYSTEM=="usb", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="666" SUBSYSTEM=="usb", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="666"
# Anytone AT-D868UV: ignore this device in Modem Manager # Anytone AT-D868UV: ignore this device in Modem Manager

View File

@ -1595,6 +1595,12 @@ static void setup_channel(radio_device_t *radio, int i, int mode, char *name,
} }
} }
if (ch->rx_ctcss == 0 && ch->rx_dcs == 0) {
ch->squelch_mode = SQ_CARRIER;
} else {
ch->squelch_mode = SQ_TONE;
}
if (txtone > 0) { // Transmit DCS if (txtone > 0) { // Transmit DCS
ch->tx_dcs = 1; ch->tx_dcs = 1;
ch->dcs_transmit = txtone - 1; ch->dcs_transmit = txtone - 1;
@ -2857,8 +2863,9 @@ static void d868uv_write_csv(radio_device_t *radio, FILE *csv)
// Add map record. // Add map record.
if (sz.count >= NCALLSIGNS) { if (sz.count >= NCALLSIGNS) {
fprintf(stderr, "Too many contacts!\n"); fprintf(stderr, "WARNING: Too many callsigns!\n");
return; fprintf(stderr, "Skipping the rest.\n");
break;
} }
callsign_map_t *m = &map[sz.count]; callsign_map_t *m = &map[sz.count];
sz.count++; sz.count++;

View File

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "util.h" #include "util.h"
// //

2346
dm1801.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,369 @@
#
# Generic DMR configuration for South Bay Area.
#
Radio: Baofeng DM-1801
# Table of analog channels.
# 1) Channel number: 1-1024
# 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Low
# 6) Scan list: - or index
# 7) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 8) Receive only: -, +
# 9) Admit criteria: -, Free, Tone
# 10) Squelch level: Normal, Tight
# 11) Guard tone for receive, or '-' to disable
# 12) Guard tone for transmit, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25
#
Analog Name Receive Transmit Power Scan TOT RO Admit Squelch RxTone TxTone Width
# VHF Band 144-148
201 Palo_Alto_N6NFI 145.230 -0.6 High 1 180 - Free Normal - 100.0 25
202 Milpitas_W6MLP 145.430 -0.6 High 1 180 - Free Normal - 85.4 25
203 Saratoga_K6SA 146.655 -0.6 High 1 180 - Free Normal - 114.8 25
204 Newark_N6MM 146.670 -0.6 High 1 180 - Free Normal - 110.9 25
205 Mill_Vally_K6GWE 146.700 -0.6 High 1 180 - Free Normal - 179.9 25
206 San_Jose_K6INC 146.820 -0.6 High 1 180 - Free Normal - 123.0 25
207 Orinda_K6LNK 146.850 -0.6 High 1 180 - Free Normal - 103.5 25
208 Pleasanton_W6SRR 147.045 +0.6 High 1 180 - Free Normal - 94.8 25
209 Concord_W6CX 147.060 +0.6 High 1 180 - Free Normal - 100.0 25
210 Napa_W6CO 147.180 +0.6 High 1 180 - Free Normal - 91.5 25
211 Morgan_Hil_K7DAA 147.330 +0.6 High 1 180 - Free Normal - 103.5 25
212 Los_Gatos_AB6LI 147.945 -0.6 High 1 180 - Free Normal - 156.7 25
# UHF Band 440-446
301 San_Jose_W6YOP 440.275 +5 High 1 180 - Free Normal - 127.3 25
302 Woodside_N6ZX 440.450 +5 High 1 180 - Free Normal - 107.2 25
303 Campbell_NO1PC 441.025 +5 High 1 180 - Free Normal - 110.9 25
304 Los_Gatos_K6UB 441.700 +5 High 1 180 - Free Normal - 127.3 25
305 San_Jose_WB6ZVW 442.500 +5 High 1 180 - Free Normal - 100.0 25
306 San_Jose_WR6ABD 442.900 +5 High 1 180 - Free Normal - 162.2 25
307 Morgan_Hil_K7DAA 442.975 +5 High 1 180 - Free Normal - 100.0 25
308 Orinda_N6QOP 443.050 +5 High 1 180 - Free Normal - 114.8 25
309 San_Jose_K6LNK 443.075 +5 High 1 180 - Free Normal - 123.0 25
310 Palo_Alto_WW6BAY 443.225 +5 High 1 180 - Free Normal - 100.0 25
311 San_Jose_KE6STH 443.575 +5 High 1 180 - Free Normal - 110.9 25
312 Oakland_WW6BAY 443.975 +5 High 1 180 - Free Normal - 100.0 25
313 San_Jose_K6GOD 444.725 +5 High 1 180 - Free Normal - 162.2 25
314 Los_Gatos_WB6KHP 444.975 +5 High 1 180 - Free Normal - 127.3 25
# Simplex frequencies
401 S_446.0 446.000 +0 High 2 180 - Free Normal - - 25
402 S_446.5 446.500 +0 High 2 180 - Free Normal - - 25
403 S_441.0 441.000 +0 High 2 180 - Free Normal - - 25
404 S_146.52 146.520 +0 High 2 180 - Free Normal - - 25
405 S_146.46 146.460 +0 High 2 180 - Free Normal - - 25
406 S_147.42 147.420 +0 High 2 180 - Free Normal - - 25
407 WX_1 162.450 +0 Low - 180 + Free Normal - - 25
408 WX_5 162.550 +0 Low - 180 + Free Normal - - 25
# Table of digital channels.
# 1) Channel number: 1-1024
# 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Low
# 6) Scan list: - or index in Scanlist table
# 7) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 8) Receive only: -, +
# 9) Admit criteria: -, Free, Color
# 10) Color code: 0, 1, 2, 3... 15
# 11) Time slot: 1 or 2
# 12) Receive group list: - or index in Grouplist table
# 13) Contact for transmit: - or index in Contacts table
#
Digital Name Receive Transmit Power Scan TOT RO Admit Color Slot RxGL TxContact
# (1) W6TCP, Milpitas, NorCal
1 Mi_RX_All 440.125 +5 Low - 180 + Color 3 1 1 - # Receive only
2 Mi_World 440.125 +5 High - 180 - Color 3 1 11 91 # 91 Worldwide
3 Mi_North_America 440.125 +5 High - 180 - Color 3 1 12 93 # 93 North America
4 Mi_TAC_310 440.125 +5 High - 180 - Color 3 1 13 10 # 310 TAC 310
5 Mi_TAC_311 440.125 +5 High - 180 - Color 3 1 14 11 # 311 TAC 311
6 Mi_USA_Nation 440.125 +5 High - 180 - Color 3 1 15 100 # 3100 USA Nationwide
7 Mi_California 440.125 +5 High - 180 - Color 3 1 16 106 # 3106 California
8 Mi_NorCal 440.125 +5 High - 180 - Color 3 2 19 68 # 31068 NorCal
9 Mi_Bay-Net 440.125 +5 High - 180 - Color 3 1 20 75 # 31075 Bay-Net
10 Mi_Anarchy 440.125 +5 High - 180 - Color 3 2 23 66 # 31666 DMR of Anarchy
11 Mi_NC_5150 440.125 +5 High - 180 - Color 3 2 24 95 # 95150 NorCal 5150
12 Mi_Parrot 440.125 +5 High - 180 - Color 3 1 - 90 # 9990 Parrot
# (2) N6AMG, San Bruno, Baycom
21 Br_RX_All 440.500 +5 Low - 180 + Color 1 1 1 - # Receive only
22 Br_World 440.500 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
23 Br_North_America 440.500 +5 High - 180 - Color 1 1 12 93 # 93 North America
24 Br_TAC_310 440.500 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
25 Br_TAC_311 440.500 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
26 Br_USA_Nation 440.500 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
27 Br_California 440.500 +5 High - 180 - Color 1 1 16 106 # 3106 California
28 Br_NC_AllStr 440.500 +5 High - 180 - Color 1 1 18 65 # 31065 NorCal AllStar
29 Br_NorCal 440.500 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
30 Br_Bay-Net 440.500 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
31 Br_USA_Area6 440.500 +5 High - 180 - Color 1 1 22 96 # 31096 USA Area 6
32 Br_Anarchy 440.500 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
33 Br_NC_5150 440.500 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
34 Br_Baycom 440.500 +5 High - 180 - Color 1 2 25 97 # 97150 Baycom
35 Br_Parrot 440.500 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (3) WB6ECE, Boulder Creek, Baycom
41 Bo_RX_All 440.5875 +5 Low - 180 + Color 2 1 1 - # Receive only
42 Bo_World 440.5875 +5 High - 180 - Color 2 1 11 91 # 91 Worldwide
43 Bo_North_America 440.5875 +5 High - 180 - Color 2 1 12 93 # 93 North America
44 Bo_TAC_310 440.5875 +5 High - 180 - Color 2 1 13 10 # 310 TAC 310
45 Bo_TAC_311 440.5875 +5 High - 180 - Color 2 1 14 11 # 311 TAC 311
46 Bo_USA_Nation 440.5875 +5 High - 180 - Color 2 1 15 100 # 3100 USA Nationwide
47 Bo_California 440.5875 +5 High - 180 - Color 2 1 16 106 # 3106 California
48 Bo_Santa_Clara 440.5875 +5 High - 180 - Color 2 1 17 64 # 31064 Santa Clara County
49 Bo_NC_AllStr 440.5875 +5 High - 180 - Color 2 1 18 65 # 31065 NorCal AllStar
50 Bo_NorCal 440.5875 +5 High - 180 - Color 2 2 19 68 # 31068 NorCal
51 Bo_Bay-Net 440.5875 +5 High - 180 - Color 2 1 20 75 # 31075 Bay-Net
52 Bo_USA_Area6 440.5875 +5 High - 180 - Color 2 1 22 96 # 31096 USA Area 6
53 Bo_Anarchy 440.5875 +5 High - 180 - Color 2 2 23 66 # 31666 DMR of Anarchy
54 Bo_NC_5150 440.5875 +5 High - 180 - Color 2 2 24 95 # 95150 NorCal 5150
55 Bo_Baycom 440.5875 +5 High - 180 - Color 2 2 25 97 # 97150 Baycom
56 Bo_Parrot 440.5875 +5 High - 180 - Color 2 1 - 90 # 9990 Parrot
# (4) K6OTR, Palo Alto, Baycom
61 PA_RX_All 441.850 +5 Low - 180 + Color 1 1 1 - # Receive only
62 PA_World 441.850 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
63 PA_North_America 441.850 +5 High - 180 - Color 1 1 12 93 # 93 North America
64 PA_TAC_310 441.850 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
65 PA_TAC_311 441.850 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
66 USA_Nation 441.850 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
67 PA_California 441.850 +5 High - 180 - Color 1 1 16 106 # 3106 California
68 PA_NC_AllStr 441.850 +5 High - 180 - Color 1 1 18 65 # 31065 NorCal AllStar
69 PA_NorCal 441.850 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
70 PA_Bay-Net 441.850 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
71 PA_USA_Area6 441.850 +5 High - 180 - Color 1 1 22 96 # 31096 USA - Area 6 4646
72 PA_Anarchy 441.850 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
73 PA_NC_5150 441.850 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
74 PA_Baycom 441.850 +5 High - 180 - Color 1 2 25 97 # 97150 Baycom
75 PA_Parrot 441.850 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (5) KK6USZ, Saratoga
81 Sa_RX_All 441.950 +5 Low - 180 + Color 1 1 1 - # Receive only
82 Sa_World 441.950 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
83 Sa_North_America 441.950 +5 High - 180 - Color 1 1 12 93 # 93 North America
84 Sa_TAC_310 441.950 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
85 Sa_TAC_311 441.950 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
86 Sa_USA_Nation 441.950 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
87 Sa_California 441.950 +5 High - 180 - Color 1 1 16 106 # 3106 California
88 Sa_Nebraska 441.950 +5 High - 180 - Color 1 1 26 131 # 3131 Nebraska
89 Sa_Texas 441.950 +5 High - 180 - Color 1 1 27 148 # 3148 Texas
90 Sa_Santa_Clara 441.950 +5 High - 180 - Color 1 2 17 64 # 31064 Santa Clara County
91 Sa_NorCal 441.950 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
92 Sa_Bay-Net 441.950 +5 High - 180 - Color 1 2 20 75 # 31075 Bay-Net
93 Sa_Anarchy 441.950 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
94 Sa_NC_5150 441.950 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
95 Sa_Baycom 441.950 +5 High - 180 - Color 1 2 25 97 # 97150 Baycom
96 Sa_Parrot 441.950 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (6) WA6YCZ, Mt Umunhum, Baycom
101 Um_RX_All 442.5375 +5 Low - 180 + Color 1 1 1 - # Receive only
102 Um_World 442.5375 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
103 Um_North_America 442.5375 +5 High - 180 - Color 1 1 12 93 # 93 North America
104 Um_TAC_310 442.5375 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
105 Um_TAC_311 442.5375 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
106 Um_USA_Nation 442.5375 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
107 Um_California 442.5375 +5 High - 180 - Color 1 1 16 106 # 3106 California
108 Um_Santa_Clara 442.5375 +5 High - 180 - Color 1 1 17 64 # 31064 Santa Clara County
109 Um_NC_AllStr 442.5375 +5 High - 180 - Color 1 1 18 65 # 31065 NorCal AllStar
110 Um_NorCal 442.5375 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
111 Um_Bay-Net 442.5375 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
112 Um_USA_Area6 442.5375 +5 High - 180 - Color 1 1 22 96 # 31096 USA Area 6
113 Um_Anarchy 442.5375 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
114 Um_NC_5150 442.5375 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
115 Um_Baycom 442.5375 +5 High - 180 - Color 1 2 25 97 # 97150 Baycom
116 Um_Parrot 442.5375 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (7) K6LNK, Berkeley, NorCal, Carla
121 Be_RX_All 443.500 +5 Low - 180 + Color 1 1 1 - # Receive only
122 Be_World 443.500 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
123 Be_North_America 443.500 +5 High - 180 - Color 1 1 12 93 # 93 North America
124 Be_TAC_310 443.500 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
125 Be_TAC_311 443.500 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
126 Be_USA_Nation 443.500 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
127 Be_California 443.500 +5 High - 180 - Color 1 1 16 106 # 3106 California
128 Be_NorCal 443.500 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
129 Be_Bay-Net 443.500 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
130 Be_Anarchy 443.500 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
131 Be_NC_5150 443.500 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
132 Be_Parrot 443.500 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (8) K6HLE, Loma Prieta, NorCal, AREA
141 Lo_RX_All 444.025 +5 Low - 180 + Color 1 1 1 - # Receive only
142 Lo_World 444.025 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
143 Lo_North_America 444.025 +5 High - 180 - Color 1 1 12 93 # 93 North America
144 Lo_TAC_310 444.025 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
145 Lo_TAC_311 444.025 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
146 Lo_USA_Nation 444.025 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
147 Lo_California 444.025 +5 High - 180 - Color 1 1 16 106 # 3106 California
148 Lo_NorCal 444.025 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
149 Lo_Bay-Net 444.025 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
150 Lo_USA_Area6 444.025 +5 High - 180 - Color 1 1 22 96 # 31096 USA - Area 6 4646
151 Lo_Anarchy 444.025 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
152 Lo_NC_5150 444.025 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
153 Lo_Parrot 444.025 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (9) WW6BAY, Palo Alto, Bay-Net
161 Bay_RX_All 444.350 +5 Low - 180 + Color 1 1 1 - # Receive only
162 Bay_World 444.350 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
163 Bay_North_Am 444.350 +5 High - 180 - Color 1 1 12 93 # 93 North America
164 Bay_TAC_310 444.350 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
165 Bay_TAC_311 444.350 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
166 Bay_USA_Nation 444.350 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
167 Bay_Santa_Clara 444.350 +5 High - 180 - Color 1 1 17 64 # 31064 Santa Clara County
168 Bay_NorCal 444.350 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
169 Bay_Bay-Net 444.350 +5 High - 180 - Color 1 2 20 75 # 31075 Bay-Net
170 Bay_Anarchy 444.350 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
171 Bay_NC_5150 444.350 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
172 Bay_Parrot 444.350 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (10) W6OTX, Alum Rock, NorCal, PAARA
181 Al_RX_All 444.475 +5 Low - 180 + Color 1 1 1 - # Receive only
182 Al_World 444.475 +5 High - 180 - Color 1 1 11 91 # 91 Worldwide
183 Al_North_Am 444.475 +5 High - 180 - Color 1 1 12 93 # 93 North America
184 Al_TAC_310 444.475 +5 High - 180 - Color 1 1 13 10 # 310 TAC 310
185 Al_TAC_311 444.475 +5 High - 180 - Color 1 1 14 11 # 311 TAC 311
186 Al_USA_Nation 444.475 +5 High - 180 - Color 1 1 15 100 # 3100 USA Nationwide
187 Al_California 444.475 +5 High - 180 - Color 1 1 16 106 # 3106 California
188 Al_NorCal 444.475 +5 High - 180 - Color 1 2 19 68 # 31068 NorCal
189 Al_Bay-Net 444.475 +5 High - 180 - Color 1 1 20 75 # 31075 Bay-Net
190 Al_Anarchy 444.475 +5 High - 180 - Color 1 2 23 66 # 31666 DMR of Anarchy
191 Al_NC_5150 444.475 +5 High - 180 - Color 1 2 24 95 # 95150 NorCal 5150
192 Al_Parrot 444.475 +5 High - 180 - Color 1 1 - 90 # 9990 Parrot
# (11) DMR simplex
701 441.0 441.000 +0 High 3 555 - - 1 1 9 99
702 446.5 446.500 +0 High 3 555 - - 1 1 9 99
703 446.075 446.075 +0 High 3 555 - - 1 1 9 99
704 433.45 433.450 +0 High 3 555 - - 1 1 9 99
705 145.79 145.790 +0 High 3 555 - - 1 1 9 99
706 145.51 145.510 +0 High 3 555 - - 1 1 9 99
# Table of channel zones.
# 1) Zone number: 1-250
# 2) Name: up to 16 characters, use '_' instead of space
# 3) List of channels: numbers and ranges (N-M) separated by comma
#
Zone Name Channels
1 Milpitas 1-12 # 440.125 W6TCP
2 San_Bruno 21-35 # 440.500 N6AMG
3 Boulder_Creek 41-56 # 440.5875 WB6ECE
4 Palo_Alto 61-75 # 441.850 K6OTR
5 Saratoga 81-96 # 441.950 KK6USZ
6 Mt_Umunhum 101-116 # 442.5375 WA6YCZ
7 Berkeley 121-132 # 443.500 K6LNK
8 Loma_Prieta 141-153 # 444.025 K6HLE
9 Baynet_Palo_Alto 161-172 # 444.350 WW6BAY
10 Alum_Rock 181-192 # 444.475 W6OTX
11 DMR_Simplex 701-706 # DMR Simplex: UHF, VHF
12 VHF 201-212 # 144-148 VHF Band
13 UHF 301-314 # 440-446 UHF Band
14 FM_Simplex 401-408 # FM Simplex: VHF, UHF
# Table of scan lists.
# 1) Scan list number: 1-250
# 2) Name: up to 16 characters, use '_' instead of space
# 3) Priority channel 1 (50% of scans): -, Sel or index
# 4) Priority channel 2 (25% of scans): -, Sel or index
# 5) Designated transmit channel: Last, Sel or index
# 6) List of channels: numbers and ranges (N-M) separated by comma
#
Scanlist Name PCh1 PCh2 TxCh Channels
1 Analog - - Last 201-212,301-314
2 FM_Simplex - - Last 401-406
3 DMR_Simplex - - Last 701-706
# Table of group lists.
# 1) Group list number: 1-40
# 2) Name: up to 16 characters, use '_' instead of space
# 3) List of contacts: numbers and ranges (N-M) separated by comma
#
Grouplist Name Contacts
1 All_Groups 91 # 91 Worldwide
1 All_Groups 93 # 93 North America
1 All_Groups 10 # 310 TAC 310
1 All_Groups 11 # 311 TAC 311
1 All_Groups 100 # 3100 USA Nationwide
1 All_Groups 106 # 3106 California
1 All_Groups 64 # 31064 Santa Clara County
1 All_Groups 65 # 31065 NorCal AllStar
1 All_Groups 68 # 31068 NorCal
1 All_Groups 75 # 31075 Bay-Net
1 All_Groups 78 # 31078 XLX013D PAPA
1 All_Groups 96 # 31096 USA - Area 6 4646
1 All_Groups 66 # 31666 DMR of Anarchy
1 All_Groups 95 # 95150 NorCal 5150
1 All_Groups 97 # 97150 Baycom
9 Simplex 99 # 99 Simplex
11 Worldwide 91 # 91 Worldwide
12 North_America 93 # 93 North America
13 TAC_310 10 # 310 TAC 310
14 TAC_311 11 # 311 TAC 311
15 USA_Nationwide 100 # 3100 USA Nationwide
16 California 106 # 3106 California
17 Santa_Clara_Cnty 64 # 31064 Santa Clara County
18 NorCal_AllStar 65 # 31065 NorCal AllStar
19 NorCal 68 # 31068 NorCal
20 Bay-Net 75 # 31075 Bay-Net
21 XLX013D_PAPA 78 # 31078 XLX013D PAPA
22 USA_Area_6 96 # 31096 USA - Area 6 4646
23 DMR_of_Anarchy 66 # 31666 DMR of Anarchy
24 NorCal_5150 95 # 95150 NorCal 5150
25 Baycom 97 # 97150 Baycom
26 Nebraska 131 # 3131 Nebraska
27 Texas 148 # 3148 Texas
# Table of contacts.
# 1) Contact number: 1-256
# 2) Name: up to 16 characters, use '_' instead of space
# 3) Call type: Group, Private, All
# 4) Call ID: 1...16777215
# 5) Call receive tone: -, +
#
Contact Name Type ID RxTone
# From all Bay Area repeaters
91 Worldwide Group 91 -
93 North_America Group 93 -
99 Simplex Group 99 -
10 TAC_310 Group 310 -
11 TAC_311 Group 311 -
100 USA_Nationwide Group 3100 -
106 California Group 3106 -
131 Nebraska Group 3131 -
148 Texas Group 3148 -
64 Santa_Clara_Cnty Group 31064 -
65 NorCal_AllStar Group 31065 -
68 NorCal Group 31068 -
72 KPARN Group 31072 -
75 Bay-Net Group 31075 -
78 XLX013D_PAPA Group 31078 -
96 USA_Area_6 Group 31096 -
28 SNARS Group 31328 -
29 SNARS_2 Group 31329 -
66 DMR_of_Anarchy Group 31666 -
95 NorCal_5150 Group 95150 -
97 Baycom Group 97150 -
# Private
90 Parrot Private 9990 -
42 Sergey_KK6ABQ Private 3114542 + # Sergey Vakulenko
# Table of text messages.
# 1) Message number: 1-32
# 2) Text: up to 144 characters
#
Message Text
1 Hi there!
2 QSY Norcal 31068, pls
3 QSY California 3106, pls
4 Be Right Back
5 My email is CALLSIGN@arrl.net
6 73 . . .

View File

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "util.h" #include "util.h"
static libusb_context *ctx = NULL; // libusb context static libusb_context *ctx = NULL; // libusb context

View File

@ -35,7 +35,7 @@
#include <stdint.h> #include <stdint.h>
#include "util.h" #include "util.h"
HANDLE dev = INVALID_HANDLE_VALUE;; // HID device HANDLE dev = INVALID_HANDLE_VALUE; // HID device
static unsigned char receive_buf[42]; // receive buffer static unsigned char receive_buf[42]; // receive buffer
// //

View File

@ -46,6 +46,7 @@ static struct {
{ "2017", &radio_md2017 }, // TYT MD-2017, Retevis RT82 { "2017", &radio_md2017 }, // TYT MD-2017, Retevis RT82
{ "MD9600", &radio_md9600 }, // TYT MD-9600 { "MD9600", &radio_md9600 }, // TYT MD-9600
{ "BF-5R", &radio_rd5r }, // Baofeng RD-5R, TD-5R { "BF-5R", &radio_rd5r }, // Baofeng RD-5R, TD-5R
{ "1801", &radio_dm1801 }, // Baofeng DM-1801
{ "DM-1701", &radio_rt84 }, // Baofeng DM-1701, Retevis RT84 { "DM-1701", &radio_rt84 }, // Baofeng DM-1701, Retevis RT84
{ "MD-760P", &radio_gd77 }, // Radioddity GD-77, version 3.1.1 and later { "MD-760P", &radio_gd77 }, // Radioddity GD-77, version 3.1.1 and later
{ "D868UVE", &radio_d868uv }, // Anytone AT-D868UV { "D868UVE", &radio_d868uv }, // Anytone AT-D868UV
@ -95,7 +96,7 @@ void radio_connect()
// Try TYT MD family. // Try TYT MD family.
ident = dfu_init(0x0483, 0xdf11); ident = dfu_init(0x0483, 0xdf11);
if (! ident) { if (! ident) {
// Try RD-5R and GD-77. // Try RD-5R, DM-1801 and GD-77.
if (hid_init(0x15a2, 0x0073) >= 0) if (hid_init(0x15a2, 0x0073) >= 0)
ident = hid_identify(); ident = hid_identify();
} }
@ -227,11 +228,12 @@ void radio_read_image(const char *filename)
fprintf(stderr, "%s: Cannot read header.\n", filename); fprintf(stderr, "%s: Cannot read header.\n", filename);
exit(-1); exit(-1);
} }
fseek(img, 0, SEEK_SET);
if (memcmp(ident, "BF-5R", 5) == 0) { if (memcmp(ident, "BF-5R", 5) == 0) {
device = &radio_rd5r; device = &radio_rd5r;
} else if (memcmp(ident, "MD-760P", 7) == 0) { } else if (memcmp(ident, "MD-760P", 7) == 0) {
device = &radio_gd77; device = &radio_gd77;
} else if (memcmp(ident, "1801", 4) == 0) {
device = &radio_dm1801;
} else if (memcmp(ident, "MD-760", 6) == 0) { } else if (memcmp(ident, "MD-760", 6) == 0) {
fprintf(stderr, "Old Radioddity GD-77 v2.6 image not supported!\n"); fprintf(stderr, "Old Radioddity GD-77 v2.6 image not supported!\n");
exit(-1); exit(-1);
@ -240,6 +242,7 @@ void radio_read_image(const char *filename)
filename, ident); filename, ident);
exit(-1); exit(-1);
} }
fseek(img, 0, SEEK_SET);
break; break;
default: default:
fprintf(stderr, "%s: Unrecognized file size %u bytes.\n", fprintf(stderr, "%s: Unrecognized file size %u bytes.\n",

View File

@ -125,6 +125,7 @@ extern radio_device_t radio_dp880; // Zastone DP880
extern radio_device_t radio_rt27d; // Radtel RT-27D extern radio_device_t radio_rt27d; // Radtel RT-27D
extern radio_device_t radio_rd5r; // Baofeng RD-5R extern radio_device_t radio_rd5r; // Baofeng RD-5R
extern radio_device_t radio_gd77; // Radioddity GD-77, version 3.1.1 and later extern radio_device_t radio_gd77; // Radioddity GD-77, version 3.1.1 and later
extern radio_device_t radio_dm1801; // Baofeng DM-1801
extern radio_device_t radio_d868uv; // Anytone AT-D868UV extern radio_device_t radio_d868uv; // Anytone AT-D868UV
extern radio_device_t radio_d878uv; // Anytone AT-D878UV extern radio_device_t radio_d878uv; // Anytone AT-D878UV
extern radio_device_t radio_dmr6x2; // BTECH DMR-6x2 extern radio_device_t radio_dmr6x2; // BTECH DMR-6x2

32
util.c
View File

@ -745,6 +745,7 @@ void print_tone(FILE *out, unsigned data)
// Return negative on error. // Return negative on error.
// //
static int csv_skip_field1; static int csv_skip_field1;
static int csv_join_fields34;
int csv_init(FILE *csv) int csv_init(FILE *csv)
{ {
@ -768,6 +769,16 @@ int csv_init(FILE *csv)
// Correct format: // Correct format:
// Radio ID,Callsign,Name,City,State,Country,Remarks // Radio ID,Callsign,Name,City,State,Country,Remarks
csv_skip_field1 = 0; csv_skip_field1 = 0;
csv_join_fields34 = 0;
return 0;
}
if (strcasecmp(field1, "RADIO_ID") == 0 &&
strcasecmp(field2, "CALLSIGN") == 0 &&
strcasecmp(field3, "FIRST_NAME") == 0) {
// Correct format:
// RADIO_ID,CALLSIGN,FIRST_NAME,LAST_NAME,CITY,STATE,COUNTRY,REMARKS
csv_skip_field1 = 0;
csv_join_fields34 = 1;
return 0; return 0;
} }
if (strcasecmp(field2, "Radio ID") == 0 && if (strcasecmp(field2, "Radio ID") == 0 &&
@ -775,10 +786,11 @@ int csv_init(FILE *csv)
// Correct format: // Correct format:
// "No.","Radio ID","Callsign","Name","City","State","Country","Remarks" // "No.","Radio ID","Callsign","Name","City","State","Country","Remarks"
csv_skip_field1 = 1; csv_skip_field1 = 1;
csv_join_fields34 = 0;
return 0; return 0;
} }
//TODO fprintf(stderr, "Unexpected CSV file format!\n");
return -1; return -1;
} }
@ -817,9 +829,27 @@ again:
*state = strchr(*city, ','); if (! *state) return 0; *(*state)++ = 0; *state = strchr(*city, ','); if (! *state) return 0; *(*state)++ = 0;
*country = strchr(*state, ','); if (! *country) return 0; *(*country)++ = 0; *country = strchr(*state, ','); if (! *country) return 0; *(*country)++ = 0;
*remarks = strchr(*country, ','); if (! *remarks) return 0; *(*remarks)++ = 0; *remarks = strchr(*country, ','); if (! *remarks) return 0; *(*remarks)++ = 0;
if ((p = strchr(*remarks, ',')) != 0)
*p++ = 0;
if (csv_join_fields34) {
char *name2 = *city;
*city = *state;
*state = *country;
*country = *remarks;
*remarks = p;
if ((p = strchr(*remarks, ',')) != 0) if ((p = strchr(*remarks, ',')) != 0)
*p = 0; *p = 0;
if (*name2) {
static char fullname[256];
strcpy(fullname, *name);
strcat(fullname, " ");
strcat(fullname, name2);
*name = fullname;
}
}
*radioid = trim_spaces(trim_quotes(*radioid), 100); *radioid = trim_spaces(trim_quotes(*radioid), 100);
*callsign = trim_spaces(trim_quotes(*callsign), 100); *callsign = trim_spaces(trim_quotes(*callsign), 100);
*name = trim_spaces(trim_quotes(*name), 100); *name = trim_spaces(trim_quotes(*name), 100);

View File

@ -2454,6 +2454,11 @@ static void uv380_write_csv(radio_device_t *radio, FILE *csv)
} }
cs = GET_CALLSIGN(mem, nrecords); cs = GET_CALLSIGN(mem, nrecords);
if ((uint8_t*) (cs + 1) > &mem[nbytes]) {
fprintf(stderr, "WARNING: Too many callsigns!\n");
fprintf(stderr, "Skipping the rest.\n");
break;
}
nrecords++; nrecords++;
// Fill callsign structure. // Fill callsign structure.