mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
BTECH UV PRO - Added experimental support for pair and unpair.
This commit is contained in:
@@ -1,82 +0,0 @@
|
|||||||
# BTECH UV Pro Bluetooth TNC Notes
|
|
||||||
|
|
||||||
## Linux Packet Configuration
|
|
||||||
|
|
||||||
Edit `/etc/ax25/axports` has root and add the following line.
|
|
||||||
|
|
||||||
```
|
|
||||||
PKT1200 KT7RUN 1200 255 2 145.710
|
|
||||||
```
|
|
||||||
|
|
||||||
## Radio Configuration
|
|
||||||
|
|
||||||
* KISS TNC > Enable KISS TNC = checked
|
|
||||||
|
|
||||||
## Pair Radio and Computer
|
|
||||||
|
|
||||||
1. On the radio, start the pairing process by navigating to
|
|
||||||
Menu > Pairing.
|
|
||||||
|
|
||||||
2.
|
|
||||||
|
|
||||||
3. On the computer, run `bluetoothctl`
|
|
||||||
|
|
||||||
```
|
|
||||||
> power on
|
|
||||||
> scan on
|
|
||||||
> pair 38:D2:00:00:ED:C8
|
|
||||||
> trust 38:D2:00:00:ED:C8
|
|
||||||
> quit
|
|
||||||
```
|
|
||||||
|
|
||||||
## If you're already paired
|
|
||||||
|
|
||||||
1. Kill any instances of rfcomm if they are running
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo killall rfcomm
|
|
||||||
```
|
|
||||||
|
|
||||||
2.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo rfcomm connect /dev/rfcomm0 38:D2:00:00:ED:C8
|
|
||||||
Connected /dev/rfcomm0 to 38:D2:00:00:ED:C8 on channel 1
|
|
||||||
Press CTRL-C for hangup
|
|
||||||
```
|
|
||||||
|
|
||||||
3. In another window, check that you are connected.
|
|
||||||
|
|
||||||
```
|
|
||||||
bluetoothctl info 38:D2:00:00:ED:C8 | grep Connected | awk '{print $2}'
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Kill any instances of kissattach if they are running.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo killall kissattach
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Attach to the desired AX.25 port.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo kissattach /dev/rfcomm0 PKT1200
|
|
||||||
AX.25 port PKT1200 bound to device ax0
|
|
||||||
```
|
|
||||||
|
|
||||||
6. Connect to the BBS
|
|
||||||
|
|
||||||
```
|
|
||||||
axcall PKT1200 TTPBBS
|
|
||||||
```
|
|
||||||
|
|
||||||
Listen to incoming and outgoing packets and capture the time
|
|
||||||
stamps for the traffic.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo axlisten -a -t
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
1. systemctl status bluetooth
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 16 March 2024
|
# Date : 16 March 2024
|
||||||
# Updated : 9 October 2024
|
# Updated : 2 January 2025
|
||||||
# Purpose : Log message to standard out and log file
|
# Purpose : Log message to standard out and log file
|
||||||
|
|
||||||
ET_TEMP_DIR=/tmp/et
|
ET_TEMP_DIR=/tmp/et
|
||||||
@@ -27,5 +27,5 @@ fi
|
|||||||
|
|
||||||
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"`
|
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"`
|
||||||
|
|
||||||
echo $@
|
echo -e $@
|
||||||
echo "$TIMESTAMP $@" >> ${ET_LOG_FILE}
|
echo "$TIMESTAMP $@" >> ${ET_LOG_FILE}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ while IFS= read -r radio; do
|
|||||||
MODEL=$(cat $radio | jq -r .model)
|
MODEL=$(cat $radio | jq -r .model)
|
||||||
|
|
||||||
options+=("$ID" "$VENDOR $MODEL")
|
options+=("$ID" "$VENDOR $MODEL")
|
||||||
done < <(find $ET_HOME/conf/radios.d -type f | sort)
|
done < <(find $ET_HOME/conf/radios.d -type f | grep -v "bt.json" | sort)
|
||||||
|
|
||||||
SELECTED_RADIO=$(dialog --clear --menu "Select a radio:" 21 60 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
SELECTED_RADIO=$(dialog --clear --menu "Select a radio:" 21 60 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||||
exit_status=$?
|
exit_status=$?
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
#
|
#
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 1 January 2025
|
# Date : 1 January 2025
|
||||||
|
# Updated : 2 January 2025
|
||||||
# Purpose : Utility for accessing the Bluetooth TNC on the BTECH
|
# Purpose : Utility for accessing the Bluetooth TNC on the BTECH
|
||||||
# UV Pro.
|
# UV PRO.
|
||||||
|
|
||||||
# TODO: read from file
|
|
||||||
CONF_FILE="${HOME}/.config/emcomm-tools/btech-uv-pro.json"
|
|
||||||
MAC="38:D2:00:00:ED:C8"
|
|
||||||
|
|
||||||
|
ACTIVE_RADIO="${ET_HOME}/conf/radios.d/btech-uvpro.bt.json"
|
||||||
|
DEVICE_NAME="UV-PRO"
|
||||||
BT_DEVICE="/dev/rfcomm0"
|
BT_DEVICE="/dev/rfcomm0"
|
||||||
AX25_PORT="pkt1200"
|
AX25_PORT="pkt1200"
|
||||||
AX25_CONF_FILE="/etc/ax25/axports"
|
AX25_CONF_FILE="/etc/ax25/axports"
|
||||||
|
|
||||||
RED='\x1B[1;31m'
|
ESC="\x1B"
|
||||||
BLUE='\x1B[1;34m'
|
RED="${ESC}[1;31m"
|
||||||
CYAN='\x1B[1;36m'
|
BLUE="${ESC}[1;34m"
|
||||||
GREEN='\x1B[1;32m'
|
GREEN="${ESC}[1;32m"
|
||||||
YELLOW='\x1B[1;33m'
|
WHITE="${ESC}[97m"
|
||||||
NC='\x1B[0m'
|
YELLOW="${ESC}[1;33m"
|
||||||
|
NC="${ESC}[0m"
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
echo "Usage: $(basename $0) <command>"
|
echo "Usage: $(basename $0) <command>"
|
||||||
@@ -32,6 +32,39 @@ if [ $# -ne 1 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
error_message() {
|
||||||
|
echo -e "${RED}"
|
||||||
|
et-log $*
|
||||||
|
echo -e "${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
info_message() {
|
||||||
|
echo -e "${BLUE}"
|
||||||
|
et-log $*
|
||||||
|
echo -e "${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
success_message() {
|
||||||
|
echo -e "${GREEN}"
|
||||||
|
et-log $*
|
||||||
|
echo -e "${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_if_no_active_radio () {
|
||||||
|
if [ ! -e ${ACTIVE_RADIO} ]; then
|
||||||
|
error_message "${ACTIVE_RADIO} file not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mac_or_exit () {
|
||||||
|
MAC=$(cat ${ACTIVE_RADIO} | jq -e -r .bluetooth.mac)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
error_message "No MAC address found in ${ACTIVE_RADIO}."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
update_ax25_conf() {
|
update_ax25_conf() {
|
||||||
|
|
||||||
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
|
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
|
||||||
@@ -60,7 +93,7 @@ stop_all_services() {
|
|||||||
|
|
||||||
PS_OUT=$(ps -ef | grep [k]issattach)
|
PS_OUT=$(ps -ef | grep [k]issattach)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "${BLUE}Killing kissattach process(es)...${NC}"
|
info_message "Killing kissattach process(es)..."$
|
||||||
sudo killall kissattach
|
sudo killall kissattach
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -68,14 +101,80 @@ stop_all_services() {
|
|||||||
|
|
||||||
PS_OUT=$(ps -ef | grep [r]fcomm)
|
PS_OUT=$(ps -ef | grep [r]fcomm)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "${BLUE}Killing rfcomm process(es)...${NC}"
|
info_message "Killing rfcomm process(es)..."
|
||||||
sudo killall rfcomm
|
sudo killall rfcomm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit_if_no_active_radio
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
pair)
|
||||||
|
|
||||||
|
MAC=$(cat ${ACTIVE_RADIO} | jq -e -r .bluetooth.mac)
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
PAIR_STATUS=$(bluetoothctl info "${MAC}" | grep "Paired:" | awk '{print $2}')
|
||||||
|
if [ "${PAIR_STATUS}" == "yes" ]; then
|
||||||
|
error_message "Device with MAC=${MAC} is already paired."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${YELLOW}"
|
||||||
|
echo -e "1. Turn on the BTECH UV PRO"
|
||||||
|
echo -e "2. Goto Menu > Pairing and press OK"
|
||||||
|
read -p "3. Press [ENTER] when done."
|
||||||
|
|
||||||
|
echo -e "${BLUE}Searching for ${DEVICE_NAME}...${NC}"
|
||||||
|
|
||||||
|
HCI_OUT=$(hcitool scan | grep "${DEVICE_NAME}")
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
error_message "Can't find ${DEVICE_NAME}. Make sure that the radio is on and in pairing mode."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAC=$(echo ${HCI_OUT} | awk '{print $1}')
|
||||||
|
|
||||||
|
# Update configuration file
|
||||||
|
sed -i "s|.*mac.*| \"mac\": \"${MAC}\"|g" ${ACTIVE_RADIO}
|
||||||
|
|
||||||
|
echo -e "Now, run the ${YELLOW}bluetooth${NC} command in another terminal.\n"
|
||||||
|
|
||||||
|
echo -e "${BLUE}[bluetooth]# ${YELLOW}power on${NC}"
|
||||||
|
echo -e "${BLUE}[bluetooth]# ${YELLOW}scan on${NC}\n"
|
||||||
|
echo -e "Wait until ${DEVICE_NAME} appears.\n"
|
||||||
|
echo -e "${BLUE}[bluetooth]# ${YELLOW}trust ${MAC}${NC}"
|
||||||
|
echo -e "${BLUE}[bluetooth]# ${YELLOW}pair ${MAC}${NC}"
|
||||||
|
echo -e "${BLUE}[${DEVICE_NAME}]# ${YELLOW}quit${NC}"
|
||||||
|
|
||||||
|
;;
|
||||||
|
unpair)
|
||||||
|
MAC=$(cat ${ACTIVE_RADIO} | jq -e -r .bluetooth.mac)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
error_message "No MAC found in radio configuration file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PAIR_STATUS=$(bluetoothctl info "${MAC}")
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
error_message "No ${MAC} device found. Can't unpair."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
info_message "Unpairing ${DEVICE_NAME}..."
|
||||||
|
bluetoothctl untrust ${MAC}
|
||||||
|
bluetoothctl remove ${MAC}
|
||||||
|
|
||||||
|
echo -e "${YELLOW}"
|
||||||
|
echo -e "You may also want to remove this device from your UV PRO"
|
||||||
|
echo -e "under Menu > General Settings> Connection > Paired Devices."
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
;;
|
||||||
connect)
|
connect)
|
||||||
|
get_mac_or_exit
|
||||||
|
|
||||||
echo -e "${YELLOW}"
|
echo -e "${YELLOW}"
|
||||||
echo -e "1. Turn on the BTECH UV PRO"
|
echo -e "1. Turn on the BTECH UV PRO"
|
||||||
echo -e "2. Menu > General Settings > KISS TNC = checked"
|
echo -e "2. Menu > General Settings > KISS TNC = checked"
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"id": "btech-uvpro",
|
||||||
|
"vendor": "BTECH",
|
||||||
|
"model": "UV PRO (BT)",
|
||||||
|
"bluetooth": {
|
||||||
|
"mac": ""
|
||||||
|
},
|
||||||
|
"notes": [
|
||||||
|
"Menu > General Settings > KISS TNC > Enable KISS TNC = checked"
|
||||||
|
],
|
||||||
|
"fieldNotes": [
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user