mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
Compare commits
1 Commits
release/v3
...
v2.7.0-rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ea3e4ce9b |
@@ -15,7 +15,7 @@ runs:
|
||||
id: import_snapshot
|
||||
shell: bash
|
||||
run: |
|
||||
echo "import_task_id=$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')" >> $GITHUB_OUTPUT
|
||||
echo ::set-output name=import_task_id::$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')
|
||||
|
||||
- name: Wait for import task to complete and get snapshot ID
|
||||
id: get_snapshot_id
|
||||
@@ -26,7 +26,7 @@ runs:
|
||||
IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
|
||||
echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion."
|
||||
done
|
||||
echo "id=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')" >> $GITHUB_OUTPUT
|
||||
echo ::set-output name=id::$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')
|
||||
|
||||
- name: Tag snapshot with image name
|
||||
shell: bash
|
||||
|
||||
13
.github/workflows/build-dev.yml
vendored
13
.github/workflows/build-dev.yml
vendored
@@ -21,15 +21,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [ 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf196', 'cig_wf189', 'cig_wf660a', 'cybertan_eww622-a1', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap111', 'edgecore_ecw5211', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'edgecore_oap102', 'hfcl_ion4','hfcl_ion4xi_wp', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4xi_w', 'hfcl_ion4xi_HMR', 'hfcl_ion4x_w', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'indio_um-310ax-v1', 'indio_um-510axp-v1', 'indio_um-510axm-v1', 'sercomm_ap72tip', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018-v4', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
|
||||
target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'x64_vm' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
# Clean unnecessary files to save disk space
|
||||
- name: clean unncessary files to save space
|
||||
run: |
|
||||
docker rmi `docker images -q`
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
@@ -77,7 +72,7 @@ jobs:
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [ ${{ matrix.target }} == 'x64_vm' ]; then
|
||||
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
|
||||
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
|
||||
fi
|
||||
|
||||
trigger-testing:
|
||||
@@ -98,7 +93,7 @@ jobs:
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use create-ami-from-image composite action
|
||||
uses: ./.github/actions/create-ami-from-image
|
||||
|
||||
8
.github/workflows/x64_vm-build-test.yml
vendored
8
.github/workflows/x64_vm-build-test.yml
vendored
@@ -22,14 +22,14 @@ jobs:
|
||||
target: ['x64_vm']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
run: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
make -j TARGET=${{ matrix.target }} make -j TARGET=${{ matrix.target }}
|
||||
make -j TARGET=${{ matrix.target }}
|
||||
|
||||
- name: Package and upload image for ${{ matrix.target }}
|
||||
id: package_and_upload_image
|
||||
@@ -70,14 +70,14 @@ jobs:
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [[ ${{ matrix.target }} == 'x64_vm' ]]; then
|
||||
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
|
||||
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
|
||||
fi
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: WIFI-7206-add-workflow-to-build-virtual-ap-image
|
||||
|
||||
|
||||
28
LICENSE
28
LICENSE
@@ -1,28 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2024, Telecom Infra Project
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
83
README.md
83
README.md
@@ -1,83 +1,20 @@
|
||||
# OpenWiFi AP NOS
|
||||
# Setting up your build machine
|
||||
|
||||
OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi.
|
||||
Read more at [openwifi.tip.build](https://openwifi.tip.build/).
|
||||
Requires a recent linux installation. Older systems without python 3.7 will have trouble. See this link for details: https://openwrt.org/docs/guide-developer/quickstart-build-images
|
||||
|
||||
## Building
|
||||
Install build packages: sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml.
|
||||
|
||||
### Setting up your build machine
|
||||
|
||||
Building requires a recent Linux installation. Older systems without Python 3.7
|
||||
will have trouble. See this guide for details:
|
||||
https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide
|
||||
|
||||
Install build packages on Debian/Ubuntu (or see above guide for other systems):
|
||||
# Doing a native build on Linux
|
||||
First we need to clone and setup our tree. This will result in an openwrt/.
|
||||
```
|
||||
sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml
|
||||
./setup.py --setup
|
||||
```
|
||||
|
||||
### Doing a native build on Linux
|
||||
|
||||
Use `./build.sh <target>`, or follow the manual steps below:
|
||||
|
||||
1. Clone and set up the tree. This will create an `openwrt/` directory.
|
||||
```shell
|
||||
./setup.py --setup # for subsequent builds, use --rebase instead
|
||||
Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file.
|
||||
```
|
||||
|
||||
2. Select the profile and base package selection. This setup will install the
|
||||
feeds and packages and generate the `.config` file.
|
||||
```shell
|
||||
cd openwrt
|
||||
./scripts/gen_config.py linksys_ea8300
|
||||
```
|
||||
|
||||
3. Build the tree (replace `-j 8` with the number of cores to use).
|
||||
```shell
|
||||
make -j 8 V=s
|
||||
Finally we can build the tree.
|
||||
```
|
||||
make -j X V=s
|
||||
```
|
||||
|
||||
### Build output
|
||||
|
||||
The build results are located in the `openwrt/bin/` directory:
|
||||
|
||||
| Type | Path |
|
||||
| ---------------- | ---------------------------------------------------- |
|
||||
| Firmware images | `openwrt/bin/targets/<target>/<subtarget>/` |
|
||||
| Kernel modules | `openwrt/bin/targets/<target>/<subtarget>/packages/` |
|
||||
| Package binaries | `openwrt/bin/packages/<platform>/<feed>/` |
|
||||
|
||||
## Developer Notes
|
||||
|
||||
### Branching model
|
||||
|
||||
- `main` - Stable dev branch
|
||||
- `next` - Integration branch
|
||||
- `staging-*` - Feature/bug branches
|
||||
- `release/v#.#.#` - Release branches (*major.minor.patch*)
|
||||
|
||||
### Repository structure
|
||||
|
||||
Build files:
|
||||
- `Makefile` - Calls Docker environment per target
|
||||
- `dock-run.sh` - Dockerized build environment
|
||||
- `docker/Dockerfile` - Dockerfile for build image
|
||||
- `build.sh` - Build script
|
||||
- `setup.py` - Clone and set up the tree
|
||||
- `config.yml` - Specifies OpenWrt version and patches to apply
|
||||
|
||||
Directories:
|
||||
- `feeds/` - OpenWiFi feeds
|
||||
- `patches/` - OpenWiFi patches applied during builds
|
||||
- `profiles/` - Per-target kernel configs, packages, and feeds
|
||||
- [wifi-ax](profiles/wifi-ax.yml): Wi-Fi AX packages
|
||||
- [ucentral-ap](profiles/ucentral-ap.yml): uCentral packages
|
||||
- [x64_vm](profiles/x64_vm.yml): x86-64 VM image
|
||||
|
||||
### uCentral packages
|
||||
|
||||
AP-NOS packages implementing the uCentral protocol include the following
|
||||
repositories (refer to the [ucentral](feeds/ucentral/) feed for a full list):
|
||||
- ucentral-client: https://github.com/Telecominfraproject/wlan-ucentral-client
|
||||
- ucentral-schema: https://github.com/Telecominfraproject/wlan-ucentral-schema
|
||||
- ucentral-wifi: https://github.com/blogic/ucentral-wifi
|
||||
|
||||
15
config.yml
15
config.yml
@@ -1,7 +1,16 @@
|
||||
repo: https://github.com/openwrt/openwrt.git
|
||||
branch: openwrt-23.05
|
||||
revision: e92cf0c46ffe3ac7fca936c18577bfb19eb4ce9e
|
||||
branch: openwrt-21.02
|
||||
revision: c67509efd7d0c43eb3f622f06c8a31aa28d22f6e
|
||||
output_dir: ./output
|
||||
|
||||
patch_folders:
|
||||
- patches
|
||||
- patches/backports/
|
||||
- patches/base
|
||||
- patches/wifi
|
||||
- patches/ath79
|
||||
- patches/ramips
|
||||
- patches/ipq40xx
|
||||
- patches/ipq806x
|
||||
- patches/ipq807x
|
||||
- patches/rtkmipsel
|
||||
- patches/rest
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ble_scan
|
||||
PKG_VERSION:=1.0
|
||||
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ble_scan
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=ble_scan
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/ble_scan/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ble_scan $(1)/bin/
|
||||
endef
|
||||
|
||||
define Package/ble_scan/extra_provides
|
||||
echo "libc.so.6";
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ble_scan))
|
||||
@@ -1,47 +0,0 @@
|
||||
#all: ble_scan
|
||||
#ble_scan: ble_scan.o
|
||||
# $(CC) $(LDFLAGS) ble_scan.o -o ble_scan
|
||||
#blescan.o: ble_scan.c
|
||||
# $(CC) $(CFLAGS) -c ble_scan.c
|
||||
#clean:
|
||||
# rm *.o ble_scan
|
||||
|
||||
#
|
||||
#
|
||||
# Author: Teunis van Beelen
|
||||
#
|
||||
# email: teuniz@protonmail.com
|
||||
#
|
||||
#
|
||||
|
||||
#CROSS-COMPILE:=../../../../../qsdk/staging_dir/toolchain-arm/bin/arm-openwrt-linux-
|
||||
#CC:=$(CROSS-COMPILE)gcc
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -O2
|
||||
|
||||
objects = rs232.o
|
||||
|
||||
all: ble_scan
|
||||
|
||||
ble_scan : $(objects) ble_scan.o
|
||||
$(CC) $(CFLAGS) $(objects) ble_scan.o -o ble_scan
|
||||
|
||||
ble_scan.o : ble_scan.c rs232.h
|
||||
$(CC) $(CFLAGS) -c ble_scan.c -o ble_scan.o
|
||||
|
||||
rs232.o : rs232.h rs232.c
|
||||
$(CC) $(CFLAGS) -c rs232.c -o rs232.o
|
||||
|
||||
clean :
|
||||
$(RM) ble_scan $(objects) ble_scan.o
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,387 +0,0 @@
|
||||
|
||||
/**************************************************
|
||||
|
||||
file: ble_scan.c
|
||||
purpose: Send HCI command to do BLE scan
|
||||
|
||||
compile with the command: gcc ble_scan.c rs232.c -Wall -Wextra -o2 -o ble_scan
|
||||
|
||||
**************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "rs232.h"
|
||||
|
||||
#define TX 0
|
||||
#define RX 1
|
||||
#define BUF_SIZE 4095
|
||||
#define FULL_BUF_SIZE BUF_SIZE*4
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#else
|
||||
#endif
|
||||
|
||||
int print_hex(int mode, unsigned char *buf, int size);
|
||||
int rx_pkt_parser(unsigned char *buf, int size);
|
||||
|
||||
|
||||
struct rx_packet_h{
|
||||
unsigned char rxType;
|
||||
unsigned char rxEventCode;
|
||||
unsigned char rxDataLen;
|
||||
unsigned char Event[2];
|
||||
unsigned char Status;
|
||||
};
|
||||
|
||||
struct event_cmd_st_h{
|
||||
unsigned char OpCode[2];
|
||||
unsigned char DataLength;
|
||||
};
|
||||
|
||||
struct event_scn_evnt_rep_h{
|
||||
unsigned char EventId[4];
|
||||
unsigned char AdvRptEventType;
|
||||
unsigned char AddressType;
|
||||
unsigned char Address[6];
|
||||
unsigned char PrimaryPHY;
|
||||
unsigned char SecondaryPHY;
|
||||
unsigned char AdvSid;
|
||||
unsigned char TxPower;
|
||||
unsigned char RSSI;
|
||||
unsigned char DirectAddrType;
|
||||
unsigned char DirectAddr[6];
|
||||
unsigned char PeriodicAdvInt[2];
|
||||
unsigned char DataLength[2];
|
||||
//unsigned char *DataPtr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int cport_nr,bdrate,n;
|
||||
//cport_nr=0, /* /dev/ttyS0 (COM1 on windows) */
|
||||
//bdrate=9600; /* 9600 baud */
|
||||
cport_nr=39, /* (ttyMSM1 : 39) */
|
||||
bdrate=115200; /* 115200 baud */
|
||||
#ifdef DEBUG
|
||||
clock_t t;
|
||||
#endif
|
||||
char mode[]={'8','N','1',0};
|
||||
|
||||
unsigned char buf[BUF_SIZE];
|
||||
unsigned char full_buf[FULL_BUF_SIZE];
|
||||
int full_buf_ptr = 0;
|
||||
unsigned char HCIExt_ResetSystemCmd[] = {0x01, 0x1D, 0xFC, 0x01, 0x00 };
|
||||
int HCIExt_ResetSystemCmd_length = 5;
|
||||
|
||||
unsigned char GAP_DeviceInitCmd[] = {0x01, 0x00, 0xFE, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
int GAP_DeviceInitCmd_length = 12;
|
||||
|
||||
unsigned char GapScan_enableCmd[] = {0x01, 0x51, 0xFE, 0x06, 0x00, 0x00, 0xF4, 0x01, 0x28, 0x00 };
|
||||
int GapScan_enableCmd_length = 10;
|
||||
|
||||
if(RS232_OpenComport(cport_nr, bdrate, mode, 0))
|
||||
{
|
||||
printf("Can not open comport\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
RS232_flushRXTX(cport_nr);
|
||||
|
||||
// send reset command
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(TX, HCIExt_ResetSystemCmd, HCIExt_ResetSystemCmd_length);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t); //60
|
||||
#else
|
||||
/* sleep for 60ms */
|
||||
usleep(60000);
|
||||
#endif
|
||||
|
||||
|
||||
RS232_SendBuf(cport_nr, HCIExt_ResetSystemCmd, HCIExt_ResetSystemCmd_length);
|
||||
/* sleep for 1 Second */
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
#endif
|
||||
usleep(1000000);
|
||||
#ifdef DEBUG
|
||||
t=clock()-t;
|
||||
printf("CLOCKS_PER_SEC=%ld\n",t);
|
||||
#endif
|
||||
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
|
||||
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(RX, buf, n);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t);
|
||||
#else
|
||||
/* sleep for 300ms */
|
||||
usleep(300000);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// send device initial command
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(TX, GAP_DeviceInitCmd, GAP_DeviceInitCmd_length);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t);
|
||||
#else
|
||||
/* sleep for 250 ms */
|
||||
usleep(250000);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
RS232_SendBuf(cport_nr, GAP_DeviceInitCmd, GAP_DeviceInitCmd_length);
|
||||
/* sleep for 0.5 Second */
|
||||
usleep(500000);
|
||||
|
||||
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
|
||||
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(RX, buf, n);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t);
|
||||
#else
|
||||
/* sleep for 500 ms */
|
||||
usleep(500000);
|
||||
#endif
|
||||
|
||||
|
||||
// send scan command
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(TX, GapScan_enableCmd, GapScan_enableCmd_length);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t);
|
||||
#else
|
||||
/* sleep for 30ms */
|
||||
usleep(30000);
|
||||
#endif
|
||||
|
||||
|
||||
RS232_SendBuf(cport_nr, GapScan_enableCmd, GapScan_enableCmd_length);
|
||||
|
||||
//read scan respone
|
||||
while (n > 0)
|
||||
{
|
||||
/* sleep for 400 mS */
|
||||
usleep(400000);
|
||||
|
||||
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
|
||||
#ifdef DEBUG
|
||||
t=clock();
|
||||
print_hex(RX, buf, n);
|
||||
t=clock()-t;
|
||||
printf("t=%ld\n",t);
|
||||
#endif
|
||||
|
||||
if (full_buf_ptr+n>FULL_BUF_SIZE)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("buffer full. break.\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
memcpy(full_buf+full_buf_ptr, buf, n);
|
||||
full_buf_ptr+=n;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("n:%d, full_buf_ptr:%d\n",n, full_buf_ptr);
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
print_hex(RX, full_buf, full_buf_ptr);
|
||||
#endif
|
||||
rx_pkt_parser( full_buf, full_buf_ptr);
|
||||
#ifdef DEBUG
|
||||
printf("n:%d, full_buf_ptr:%d\n",n, full_buf_ptr);
|
||||
#endif
|
||||
RS232_flushRXTX(cport_nr);
|
||||
RS232_CloseComport(cport_nr);
|
||||
return(0);
|
||||
}
|
||||
/**************************************************
|
||||
Print buffer in HEX
|
||||
**************************************************/
|
||||
int print_hex(int mode, unsigned char *buf, int size)
|
||||
{
|
||||
|
||||
int ii,jj;
|
||||
|
||||
if (mode == TX)
|
||||
printf("TX: ");
|
||||
else
|
||||
printf("RX: ");
|
||||
|
||||
for(ii=0,jj=0; ii < size; ii++,jj++)
|
||||
{
|
||||
printf("%02X ",buf[ii]);
|
||||
if (jj==15)
|
||||
{
|
||||
printf("\n");
|
||||
jj = 0;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int rx_pkt_parser(unsigned char *buf, int size)
|
||||
{
|
||||
int pkt_index=0;
|
||||
int pkt_size=0;
|
||||
int temp_event=0;
|
||||
int temp_EventId=0;
|
||||
int total_device_count=0;
|
||||
char szAddress[18];
|
||||
struct rx_packet_h *rx_packet;
|
||||
struct event_scn_evnt_rep_h *event_scn_evnt_rep;
|
||||
#ifdef DEBUG
|
||||
int dump_i=0;
|
||||
unsigned char *pkt_ptr;
|
||||
#endif
|
||||
if(size<=0){printf("size error\n");return -1;}
|
||||
|
||||
printf("BLE scan start:\n");
|
||||
rx_packet = (struct rx_packet_h *)(buf);
|
||||
|
||||
while(pkt_index<size)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("--------------------------------------------------------------------\n");
|
||||
printf("-Type : 0x%02X (%s)\n",rx_packet->rxType,rx_packet->rxType==0x4?"Event":"Unknown");
|
||||
|
||||
if(rx_packet->rxType!=0x4)
|
||||
{
|
||||
printf(" Type unknown, rxType:0x%02X, pkt_index:%d\n",rx_packet->rxType,pkt_index);
|
||||
}
|
||||
|
||||
printf("-EventCode : 0x%02X (%s)\n",rx_packet->rxEventCode,rx_packet->rxEventCode==0xff?"HCI_LE_ExtEvent":"Unknown");
|
||||
if(rx_packet->rxEventCode!=0xff)
|
||||
{
|
||||
printf(" EventCode unknown, rxEventCode:0x%02X, pkt_index:%d\n",rx_packet->rxEventCode,pkt_index);
|
||||
}
|
||||
|
||||
printf("-Data Length : 0x%02X (%d) bytes(s)\n",rx_packet->rxDataLen,rx_packet->rxDataLen);
|
||||
#endif
|
||||
temp_event = (rx_packet->Event[1]<<8)+rx_packet->Event[0] ;
|
||||
#ifdef DEBUG
|
||||
printf(" Event : 0x%02X%02X (%d) ",rx_packet->Event[1],rx_packet->Event[0],temp_event);
|
||||
if(temp_event==0x067F)
|
||||
{
|
||||
printf("(GAP_HCI_ExtentionCommandStatus)\n");
|
||||
}
|
||||
else if(temp_event==0x0600)
|
||||
{
|
||||
printf("(GAP_DeviceInitDone)\n");
|
||||
}
|
||||
else if(temp_event==0x0613)
|
||||
{
|
||||
printf("(GAP_AdvertiserScannerEvent)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" Event unknown, Event:0x%04X, pkt_index:%d\n",temp_event,pkt_index);
|
||||
}
|
||||
|
||||
printf(" Status : 0x%02X (%d) (%s)\n",rx_packet->Status,rx_packet->Status,rx_packet->Status==0?"SUCCESS":"FAIL");
|
||||
#endif
|
||||
|
||||
if(temp_event==0x0613)
|
||||
{
|
||||
event_scn_evnt_rep = (struct event_scn_evnt_rep_h *)(&(rx_packet->Status) + 1);
|
||||
temp_EventId = (event_scn_evnt_rep->EventId[3]<<24) + (event_scn_evnt_rep->EventId[2]<<16) +
|
||||
(event_scn_evnt_rep->EventId[1]<<8) + (event_scn_evnt_rep->EventId[0]) ;
|
||||
#ifdef DEBUG
|
||||
printf(" EventId : 0x%02X%02X%02X%02X (%d) ", event_scn_evnt_rep->EventId[3],
|
||||
event_scn_evnt_rep->EventId[2],
|
||||
event_scn_evnt_rep->EventId[1],
|
||||
event_scn_evnt_rep->EventId[0],temp_EventId);
|
||||
|
||||
if(temp_EventId==0x00010000)
|
||||
{
|
||||
printf("(GAP_EVT_SCAN_ENABLED)\n");
|
||||
}
|
||||
else if(temp_EventId==0x00020000)
|
||||
{
|
||||
printf("(GAP_EVT_SCAN_DISABLED)\n");
|
||||
}
|
||||
else if(temp_EventId==0x00400000)
|
||||
{
|
||||
printf("(GAP_EVT_ADV_REPORT)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" EventId unknown, EventId:0x%08X, pkt_index:%d\n",temp_EventId,pkt_index);
|
||||
}
|
||||
#endif
|
||||
if(temp_EventId==0x00400000)
|
||||
{
|
||||
sprintf(szAddress,"%02X:%02X:%02X:%02X:%02X:%02X", event_scn_evnt_rep->Address[5],
|
||||
event_scn_evnt_rep->Address[4],
|
||||
event_scn_evnt_rep->Address[3],
|
||||
event_scn_evnt_rep->Address[2],
|
||||
event_scn_evnt_rep->Address[1],
|
||||
event_scn_evnt_rep->Address[0]);
|
||||
#ifdef DEBUG
|
||||
printf("%04d", total_device_count);
|
||||
printf(" Address : %s", szAddress);
|
||||
printf(" RSSI : 0x%02X (%d)(%d)",event_scn_evnt_rep->RSSI,event_scn_evnt_rep->RSSI,event_scn_evnt_rep->RSSI-256);
|
||||
#else
|
||||
printf(" Address: %s RSSI: %d", szAddress, event_scn_evnt_rep->RSSI-256);
|
||||
#endif
|
||||
printf("\n");
|
||||
total_device_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pkt_size = 3+rx_packet->rxDataLen;
|
||||
|
||||
#ifdef DEBUG
|
||||
pkt_ptr = (unsigned char *)rx_packet;
|
||||
printf(" <Info > Dump(Rx):");
|
||||
for(dump_i=0; dump_i < pkt_size; dump_i++)
|
||||
{
|
||||
if (dump_i%16==0)
|
||||
{
|
||||
printf("\n");
|
||||
printf("%04x:",dump_i);
|
||||
}
|
||||
printf("%02X ",pkt_ptr[dump_i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
pkt_index+=pkt_size;
|
||||
#ifdef DEBUG
|
||||
printf(" pkt_size:%d, pkt_index:%d\n",pkt_size,pkt_index);
|
||||
#endif
|
||||
rx_packet = (struct rx_packet_h *)(&(rx_packet->rxDataLen) + rx_packet->rxDataLen + 1);
|
||||
|
||||
}
|
||||
printf("Total: %d Device found.\n",total_device_count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,879 +0,0 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
*
|
||||
* Author: Teunis van Beelen
|
||||
*
|
||||
* Copyright (C) 2005 - 2021 Teunis van Beelen
|
||||
*
|
||||
* Email: teuniz@protonmail.com
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Last revision: February 9, 2021 */
|
||||
/* For more info and how to use this library, visit: http://www.teuniz.net/RS-232/ */
|
||||
|
||||
|
||||
#include "rs232.h"
|
||||
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) /* Linux & FreeBSD */
|
||||
|
||||
#define RS232_PORTNR 40
|
||||
|
||||
|
||||
int Cport[RS232_PORTNR],
|
||||
error;
|
||||
|
||||
struct termios new_port_settings,
|
||||
old_port_settings[RS232_PORTNR];
|
||||
|
||||
const char *comports[RS232_PORTNR]={"/dev/ttyS0","/dev/ttyS1","/dev/ttyS2","/dev/ttyS3","/dev/ttyS4","/dev/ttyS5",
|
||||
"/dev/ttyS6","/dev/ttyS7","/dev/ttyS8","/dev/ttyS9","/dev/ttyS10","/dev/ttyS11",
|
||||
"/dev/ttyS12","/dev/ttyS13","/dev/ttyS14","/dev/ttyS15","/dev/ttyUSB0",
|
||||
"/dev/ttyUSB1","/dev/ttyUSB2","/dev/ttyUSB3","/dev/ttyUSB4","/dev/ttyUSB5",
|
||||
"/dev/ttyAMA0","/dev/ttyAMA1","/dev/ttyACM0","/dev/ttyACM1",
|
||||
"/dev/rfcomm0","/dev/rfcomm1","/dev/ircomm0","/dev/ircomm1",
|
||||
"/dev/cuau0","/dev/cuau1","/dev/cuau2","/dev/cuau3",
|
||||
"/dev/cuaU0","/dev/cuaU1","/dev/cuaU2","/dev/cuaU3",
|
||||
"/dev/ttyMSM0","/dev/ttyMSM1"};
|
||||
int RS232_OpenComport(int comport_number, int baudrate, const char *mode, int flowctrl)
|
||||
{
|
||||
int baudr,
|
||||
status;
|
||||
|
||||
if((comport_number>=RS232_PORTNR)||(comport_number<0))
|
||||
{
|
||||
printf("illegal comport number\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
switch(baudrate)
|
||||
{
|
||||
case 50 : baudr = B50;
|
||||
break;
|
||||
case 75 : baudr = B75;
|
||||
break;
|
||||
case 110 : baudr = B110;
|
||||
break;
|
||||
case 134 : baudr = B134;
|
||||
break;
|
||||
case 150 : baudr = B150;
|
||||
break;
|
||||
case 200 : baudr = B200;
|
||||
break;
|
||||
case 300 : baudr = B300;
|
||||
break;
|
||||
case 600 : baudr = B600;
|
||||
break;
|
||||
case 1200 : baudr = B1200;
|
||||
break;
|
||||
case 1800 : baudr = B1800;
|
||||
break;
|
||||
case 2400 : baudr = B2400;
|
||||
break;
|
||||
case 4800 : baudr = B4800;
|
||||
break;
|
||||
case 9600 : baudr = B9600;
|
||||
break;
|
||||
case 19200 : baudr = B19200;
|
||||
break;
|
||||
case 38400 : baudr = B38400;
|
||||
break;
|
||||
case 57600 : baudr = B57600;
|
||||
break;
|
||||
case 115200 : baudr = B115200;
|
||||
break;
|
||||
case 230400 : baudr = B230400;
|
||||
break;
|
||||
case 460800 : baudr = B460800;
|
||||
break;
|
||||
#if defined(__linux__)
|
||||
case 500000 : baudr = B500000;
|
||||
break;
|
||||
case 576000 : baudr = B576000;
|
||||
break;
|
||||
case 921600 : baudr = B921600;
|
||||
break;
|
||||
case 1000000 : baudr = B1000000;
|
||||
break;
|
||||
case 1152000 : baudr = B1152000;
|
||||
break;
|
||||
case 1500000 : baudr = B1500000;
|
||||
break;
|
||||
case 2000000 : baudr = B2000000;
|
||||
break;
|
||||
case 2500000 : baudr = B2500000;
|
||||
break;
|
||||
case 3000000 : baudr = B3000000;
|
||||
break;
|
||||
case 3500000 : baudr = B3500000;
|
||||
break;
|
||||
case 4000000 : baudr = B4000000;
|
||||
break;
|
||||
#endif
|
||||
default : printf("invalid baudrate\n");
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
int cbits=CS8,
|
||||
cpar=0,
|
||||
ipar=IGNPAR,
|
||||
bstop=0;
|
||||
|
||||
if(strlen(mode) != 3)
|
||||
{
|
||||
printf("invalid mode \"%s\"\n", mode);
|
||||
return(1);
|
||||
}
|
||||
|
||||
switch(mode[0])
|
||||
{
|
||||
case '8': cbits = CS8;
|
||||
break;
|
||||
case '7': cbits = CS7;
|
||||
break;
|
||||
case '6': cbits = CS6;
|
||||
break;
|
||||
case '5': cbits = CS5;
|
||||
break;
|
||||
default : printf("invalid number of data-bits '%c'\n", mode[0]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(mode[1])
|
||||
{
|
||||
case 'N':
|
||||
case 'n': cpar = 0;
|
||||
ipar = IGNPAR;
|
||||
break;
|
||||
case 'E':
|
||||
case 'e': cpar = PARENB;
|
||||
ipar = INPCK;
|
||||
break;
|
||||
case 'O':
|
||||
case 'o': cpar = (PARENB | PARODD);
|
||||
ipar = INPCK;
|
||||
break;
|
||||
default : printf("invalid parity '%c'\n", mode[1]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(mode[2])
|
||||
{
|
||||
case '1': bstop = 0;
|
||||
break;
|
||||
case '2': bstop = CSTOPB;
|
||||
break;
|
||||
default : printf("invalid number of stop bits '%c'\n", mode[2]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
http://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html
|
||||
|
||||
http://man7.org/linux/man-pages/man3/termios.3.html
|
||||
*/
|
||||
|
||||
Cport[comport_number] = open(comports[comport_number], O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if(Cport[comport_number]==-1)
|
||||
{
|
||||
perror("unable to open comport ");
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* lock access so that another process can't also use the port */
|
||||
if(flock(Cport[comport_number], LOCK_EX | LOCK_NB) != 0)
|
||||
{
|
||||
close(Cport[comport_number]);
|
||||
perror("Another process has locked the comport.");
|
||||
return(1);
|
||||
}
|
||||
|
||||
error = tcgetattr(Cport[comport_number], old_port_settings + comport_number);
|
||||
if(error==-1)
|
||||
{
|
||||
close(Cport[comport_number]);
|
||||
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
|
||||
perror("unable to read portsettings ");
|
||||
return(1);
|
||||
}
|
||||
memset(&new_port_settings, 0, sizeof(new_port_settings)); /* clear the new struct */
|
||||
|
||||
new_port_settings.c_cflag = cbits | cpar | bstop | CLOCAL | CREAD;
|
||||
if(flowctrl)
|
||||
{
|
||||
new_port_settings.c_cflag |= CRTSCTS;
|
||||
}
|
||||
new_port_settings.c_iflag = ipar;
|
||||
new_port_settings.c_oflag = 0;
|
||||
new_port_settings.c_lflag = 0;
|
||||
new_port_settings.c_cc[VMIN] = 0; /* block untill n bytes are received */
|
||||
new_port_settings.c_cc[VTIME] = 0; /* block untill a timer expires (n * 100 mSec.) */
|
||||
|
||||
cfsetispeed(&new_port_settings, baudr);
|
||||
cfsetospeed(&new_port_settings, baudr);
|
||||
|
||||
error = tcsetattr(Cport[comport_number], TCSANOW, &new_port_settings);
|
||||
if(error==-1)
|
||||
{
|
||||
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
|
||||
close(Cport[comport_number]);
|
||||
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
|
||||
perror("unable to adjust portsettings ");
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* http://man7.org/linux/man-pages/man4/tty_ioctl.4.html */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
|
||||
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
|
||||
perror("unable to get portstatus");
|
||||
return(1);
|
||||
}
|
||||
|
||||
status |= TIOCM_DTR; /* turn on DTR */
|
||||
status |= TIOCM_RTS; /* turn on RTS */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
|
||||
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
|
||||
perror("unable to set portstatus");
|
||||
return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_PollComport(int comport_number, unsigned char *buf, int size)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = read(Cport[comport_number], buf, size);
|
||||
|
||||
if(n < 0)
|
||||
{
|
||||
if(errno == EAGAIN) return 0;
|
||||
}
|
||||
|
||||
return(n);
|
||||
}
|
||||
|
||||
|
||||
int RS232_SendByte(int comport_number, unsigned char byte)
|
||||
{
|
||||
int n = write(Cport[comport_number], &byte, 1);
|
||||
if(n < 0)
|
||||
{
|
||||
if(errno == EAGAIN)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_SendBuf(int comport_number, unsigned char *buf, int size)
|
||||
{
|
||||
int n = write(Cport[comport_number], buf, size);
|
||||
if(n < 0)
|
||||
{
|
||||
if(errno == EAGAIN)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return(n);
|
||||
}
|
||||
|
||||
|
||||
void RS232_CloseComport(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
perror("unable to get portstatus");
|
||||
}
|
||||
|
||||
status &= ~TIOCM_DTR; /* turn off DTR */
|
||||
status &= ~TIOCM_RTS; /* turn off RTS */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
perror("unable to set portstatus");
|
||||
}
|
||||
|
||||
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
|
||||
close(Cport[comport_number]);
|
||||
|
||||
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
|
||||
}
|
||||
|
||||
/*
|
||||
Constant Description
|
||||
TIOCM_LE DSR (data set ready/line enable)
|
||||
TIOCM_DTR DTR (data terminal ready)
|
||||
TIOCM_RTS RTS (request to send)
|
||||
TIOCM_ST Secondary TXD (transmit)
|
||||
TIOCM_SR Secondary RXD (receive)
|
||||
TIOCM_CTS CTS (clear to send)
|
||||
TIOCM_CAR DCD (data carrier detect)
|
||||
TIOCM_CD see TIOCM_CAR
|
||||
TIOCM_RNG RNG (ring)
|
||||
TIOCM_RI see TIOCM_RNG
|
||||
TIOCM_DSR DSR (data set ready)
|
||||
|
||||
http://man7.org/linux/man-pages/man4/tty_ioctl.4.html
|
||||
*/
|
||||
|
||||
int RS232_IsDCDEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
ioctl(Cport[comport_number], TIOCMGET, &status);
|
||||
|
||||
if(status&TIOCM_CAR) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsRINGEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
ioctl(Cport[comport_number], TIOCMGET, &status);
|
||||
|
||||
if(status&TIOCM_RNG) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsCTSEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
ioctl(Cport[comport_number], TIOCMGET, &status);
|
||||
|
||||
if(status&TIOCM_CTS) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsDSREnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
ioctl(Cport[comport_number], TIOCMGET, &status);
|
||||
|
||||
if(status&TIOCM_DSR) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
void RS232_enableDTR(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
perror("unable to get portstatus");
|
||||
}
|
||||
|
||||
status |= TIOCM_DTR; /* turn on DTR */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
perror("unable to set portstatus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RS232_disableDTR(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
perror("unable to get portstatus");
|
||||
}
|
||||
|
||||
status &= ~TIOCM_DTR; /* turn off DTR */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
perror("unable to set portstatus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RS232_enableRTS(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
perror("unable to get portstatus");
|
||||
}
|
||||
|
||||
status |= TIOCM_RTS; /* turn on RTS */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
perror("unable to set portstatus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RS232_disableRTS(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
|
||||
{
|
||||
perror("unable to get portstatus");
|
||||
}
|
||||
|
||||
status &= ~TIOCM_RTS; /* turn off RTS */
|
||||
|
||||
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
|
||||
{
|
||||
perror("unable to set portstatus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RS232_flushRX(int comport_number)
|
||||
{
|
||||
tcflush(Cport[comport_number], TCIFLUSH);
|
||||
}
|
||||
|
||||
|
||||
void RS232_flushTX(int comport_number)
|
||||
{
|
||||
tcflush(Cport[comport_number], TCOFLUSH);
|
||||
}
|
||||
|
||||
|
||||
void RS232_flushRXTX(int comport_number)
|
||||
{
|
||||
tcflush(Cport[comport_number], TCIOFLUSH);
|
||||
}
|
||||
|
||||
|
||||
#else /* windows */
|
||||
|
||||
#define RS232_PORTNR 32
|
||||
|
||||
HANDLE Cport[RS232_PORTNR];
|
||||
|
||||
|
||||
const char *comports[RS232_PORTNR]={"\\\\.\\COM1", "\\\\.\\COM2", "\\\\.\\COM3", "\\\\.\\COM4",
|
||||
"\\\\.\\COM5", "\\\\.\\COM6", "\\\\.\\COM7", "\\\\.\\COM8",
|
||||
"\\\\.\\COM9", "\\\\.\\COM10", "\\\\.\\COM11", "\\\\.\\COM12",
|
||||
"\\\\.\\COM13", "\\\\.\\COM14", "\\\\.\\COM15", "\\\\.\\COM16",
|
||||
"\\\\.\\COM17", "\\\\.\\COM18", "\\\\.\\COM19", "\\\\.\\COM20",
|
||||
"\\\\.\\COM21", "\\\\.\\COM22", "\\\\.\\COM23", "\\\\.\\COM24",
|
||||
"\\\\.\\COM25", "\\\\.\\COM26", "\\\\.\\COM27", "\\\\.\\COM28",
|
||||
"\\\\.\\COM29", "\\\\.\\COM30", "\\\\.\\COM31", "\\\\.\\COM32"};
|
||||
|
||||
char mode_str[128];
|
||||
|
||||
|
||||
int RS232_OpenComport(int comport_number, int baudrate, const char *mode, int flowctrl)
|
||||
{
|
||||
if((comport_number>=RS232_PORTNR)||(comport_number<0))
|
||||
{
|
||||
printf("illegal comport number\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
switch(baudrate)
|
||||
{
|
||||
case 110 : strcpy(mode_str, "baud=110");
|
||||
break;
|
||||
case 300 : strcpy(mode_str, "baud=300");
|
||||
break;
|
||||
case 600 : strcpy(mode_str, "baud=600");
|
||||
break;
|
||||
case 1200 : strcpy(mode_str, "baud=1200");
|
||||
break;
|
||||
case 2400 : strcpy(mode_str, "baud=2400");
|
||||
break;
|
||||
case 4800 : strcpy(mode_str, "baud=4800");
|
||||
break;
|
||||
case 9600 : strcpy(mode_str, "baud=9600");
|
||||
break;
|
||||
case 19200 : strcpy(mode_str, "baud=19200");
|
||||
break;
|
||||
case 38400 : strcpy(mode_str, "baud=38400");
|
||||
break;
|
||||
case 57600 : strcpy(mode_str, "baud=57600");
|
||||
break;
|
||||
case 115200 : strcpy(mode_str, "baud=115200");
|
||||
break;
|
||||
case 128000 : strcpy(mode_str, "baud=128000");
|
||||
break;
|
||||
case 256000 : strcpy(mode_str, "baud=256000");
|
||||
break;
|
||||
case 500000 : strcpy(mode_str, "baud=500000");
|
||||
break;
|
||||
case 921600 : strcpy(mode_str, "baud=921600");
|
||||
break;
|
||||
case 1000000 : strcpy(mode_str, "baud=1000000");
|
||||
break;
|
||||
case 1500000 : strcpy(mode_str, "baud=1500000");
|
||||
break;
|
||||
case 2000000 : strcpy(mode_str, "baud=2000000");
|
||||
break;
|
||||
case 3000000 : strcpy(mode_str, "baud=3000000");
|
||||
break;
|
||||
default : printf("invalid baudrate\n");
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if(strlen(mode) != 3)
|
||||
{
|
||||
printf("invalid mode \"%s\"\n", mode);
|
||||
return(1);
|
||||
}
|
||||
|
||||
switch(mode[0])
|
||||
{
|
||||
case '8': strcat(mode_str, " data=8");
|
||||
break;
|
||||
case '7': strcat(mode_str, " data=7");
|
||||
break;
|
||||
case '6': strcat(mode_str, " data=6");
|
||||
break;
|
||||
case '5': strcat(mode_str, " data=5");
|
||||
break;
|
||||
default : printf("invalid number of data-bits '%c'\n", mode[0]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(mode[1])
|
||||
{
|
||||
case 'N':
|
||||
case 'n': strcat(mode_str, " parity=n");
|
||||
break;
|
||||
case 'E':
|
||||
case 'e': strcat(mode_str, " parity=e");
|
||||
break;
|
||||
case 'O':
|
||||
case 'o': strcat(mode_str, " parity=o");
|
||||
break;
|
||||
default : printf("invalid parity '%c'\n", mode[1]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(mode[2])
|
||||
{
|
||||
case '1': strcat(mode_str, " stop=1");
|
||||
break;
|
||||
case '2': strcat(mode_str, " stop=2");
|
||||
break;
|
||||
default : printf("invalid number of stop bits '%c'\n", mode[2]);
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if(flowctrl)
|
||||
{
|
||||
strcat(mode_str, " xon=off to=off odsr=off dtr=on rts=off");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(mode_str, " xon=off to=off odsr=off dtr=on rts=on");
|
||||
}
|
||||
|
||||
/*
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363145%28v=vs.85%29.aspx
|
||||
|
||||
http://technet.microsoft.com/en-us/library/cc732236.aspx
|
||||
|
||||
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_dcb
|
||||
*/
|
||||
|
||||
Cport[comport_number] = CreateFileA(comports[comport_number],
|
||||
GENERIC_READ|GENERIC_WRITE,
|
||||
0, /* no share */
|
||||
NULL, /* no security */
|
||||
OPEN_EXISTING,
|
||||
0, /* no threads */
|
||||
NULL); /* no templates */
|
||||
|
||||
if(Cport[comport_number]==INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("unable to open comport\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
DCB port_settings;
|
||||
memset(&port_settings, 0, sizeof(port_settings)); /* clear the new struct */
|
||||
port_settings.DCBlength = sizeof(port_settings);
|
||||
|
||||
if(!BuildCommDCBA(mode_str, &port_settings))
|
||||
{
|
||||
printf("unable to set comport dcb settings\n");
|
||||
CloseHandle(Cport[comport_number]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
if(flowctrl)
|
||||
{
|
||||
port_settings.fOutxCtsFlow = TRUE;
|
||||
port_settings.fRtsControl = RTS_CONTROL_HANDSHAKE;
|
||||
}
|
||||
|
||||
if(!SetCommState(Cport[comport_number], &port_settings))
|
||||
{
|
||||
printf("unable to set comport cfg settings\n");
|
||||
CloseHandle(Cport[comport_number]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
COMMTIMEOUTS Cptimeouts;
|
||||
|
||||
Cptimeouts.ReadIntervalTimeout = MAXDWORD;
|
||||
Cptimeouts.ReadTotalTimeoutMultiplier = 0;
|
||||
Cptimeouts.ReadTotalTimeoutConstant = 0;
|
||||
Cptimeouts.WriteTotalTimeoutMultiplier = 0;
|
||||
Cptimeouts.WriteTotalTimeoutConstant = 0;
|
||||
|
||||
if(!SetCommTimeouts(Cport[comport_number], &Cptimeouts))
|
||||
{
|
||||
printf("unable to set comport time-out settings\n");
|
||||
CloseHandle(Cport[comport_number]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_PollComport(int comport_number, unsigned char *buf, int size)
|
||||
{
|
||||
int n;
|
||||
|
||||
/* added the void pointer cast, otherwise gcc will complain about */
|
||||
/* "warning: dereferencing type-punned pointer will break strict aliasing rules" */
|
||||
|
||||
if(!ReadFile(Cport[comport_number], buf, size, (LPDWORD)((void *)&n), NULL))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return(n);
|
||||
}
|
||||
|
||||
|
||||
int RS232_SendByte(int comport_number, unsigned char byte)
|
||||
{
|
||||
int n;
|
||||
|
||||
if(!WriteFile(Cport[comport_number], &byte, 1, (LPDWORD)((void *)&n), NULL))
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
if(n<0) return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_SendBuf(int comport_number, unsigned char *buf, int size)
|
||||
{
|
||||
int n;
|
||||
|
||||
if(WriteFile(Cport[comport_number], buf, size, (LPDWORD)((void *)&n), NULL))
|
||||
{
|
||||
return(n);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
void RS232_CloseComport(int comport_number)
|
||||
{
|
||||
CloseHandle(Cport[comport_number]);
|
||||
}
|
||||
|
||||
/*
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363258%28v=vs.85%29.aspx
|
||||
*/
|
||||
|
||||
int RS232_IsDCDEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
|
||||
|
||||
if(status&MS_RLSD_ON) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsRINGEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
|
||||
|
||||
if(status&MS_RING_ON) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsCTSEnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
|
||||
|
||||
if(status&MS_CTS_ON) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
int RS232_IsDSREnabled(int comport_number)
|
||||
{
|
||||
int status;
|
||||
|
||||
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
|
||||
|
||||
if(status&MS_DSR_ON) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
|
||||
void RS232_enableDTR(int comport_number)
|
||||
{
|
||||
EscapeCommFunction(Cport[comport_number], SETDTR);
|
||||
}
|
||||
|
||||
|
||||
void RS232_disableDTR(int comport_number)
|
||||
{
|
||||
EscapeCommFunction(Cport[comport_number], CLRDTR);
|
||||
}
|
||||
|
||||
|
||||
void RS232_enableRTS(int comport_number)
|
||||
{
|
||||
EscapeCommFunction(Cport[comport_number], SETRTS);
|
||||
}
|
||||
|
||||
|
||||
void RS232_disableRTS(int comport_number)
|
||||
{
|
||||
EscapeCommFunction(Cport[comport_number], CLRRTS);
|
||||
}
|
||||
|
||||
/*
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363428%28v=vs.85%29.aspx
|
||||
*/
|
||||
|
||||
void RS232_flushRX(int comport_number)
|
||||
{
|
||||
PurgeComm(Cport[comport_number], PURGE_RXCLEAR | PURGE_RXABORT);
|
||||
}
|
||||
|
||||
|
||||
void RS232_flushTX(int comport_number)
|
||||
{
|
||||
PurgeComm(Cport[comport_number], PURGE_TXCLEAR | PURGE_TXABORT);
|
||||
}
|
||||
|
||||
|
||||
void RS232_flushRXTX(int comport_number)
|
||||
{
|
||||
PurgeComm(Cport[comport_number], PURGE_RXCLEAR | PURGE_RXABORT);
|
||||
PurgeComm(Cport[comport_number], PURGE_TXCLEAR | PURGE_TXABORT);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void RS232_cputs(int comport_number, const char *text) /* sends a string to serial port */
|
||||
{
|
||||
while(*text != 0) RS232_SendByte(comport_number, *(text++));
|
||||
}
|
||||
|
||||
|
||||
/* return index in comports matching to device name or -1 if not found */
|
||||
int RS232_GetPortnr(const char *devname)
|
||||
{
|
||||
int i;
|
||||
|
||||
char str[32];
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) /* Linux & FreeBSD */
|
||||
strcpy(str, "/dev/");
|
||||
#else /* windows */
|
||||
strcpy(str, "\\\\.\\");
|
||||
#endif
|
||||
strncat(str, devname, 16);
|
||||
str[31] = 0;
|
||||
|
||||
for(i=0; i<RS232_PORTNR; i++)
|
||||
{
|
||||
if(!strcmp(comports[i], str))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; /* device not found */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
*
|
||||
* Author: Teunis van Beelen
|
||||
*
|
||||
* Copyright (C) 2005 - 2021 Teunis van Beelen
|
||||
*
|
||||
* Email: teuniz@protonmail.com
|
||||
*
|
||||
***************************************************************************
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
/* For more info and how to use this library, visit: http://www.teuniz.net/RS-232/ */
|
||||
|
||||
|
||||
#ifndef rs232_INCLUDED
|
||||
#define rs232_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <sys/file.h>
|
||||
#include <errno.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#endif
|
||||
|
||||
int RS232_OpenComport(int, int, const char *, int);
|
||||
int RS232_PollComport(int, unsigned char *, int);
|
||||
int RS232_SendByte(int, unsigned char);
|
||||
int RS232_SendBuf(int, unsigned char *, int);
|
||||
void RS232_CloseComport(int);
|
||||
void RS232_cputs(int, const char *);
|
||||
int RS232_IsDCDEnabled(int);
|
||||
int RS232_IsRINGEnabled(int);
|
||||
int RS232_IsCTSEnabled(int);
|
||||
int RS232_IsDSREnabled(int);
|
||||
void RS232_enableDTR(int);
|
||||
void RS232_disableDTR(int);
|
||||
void RS232_enableRTS(int);
|
||||
void RS232_disableRTS(int);
|
||||
void RS232_flushRX(int);
|
||||
void RS232_flushTX(int);
|
||||
void RS232_flushRXTX(int);
|
||||
int RS232_GetPortnr(const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,12 +25,21 @@ define Build/Prepare
|
||||
endef
|
||||
|
||||
define Package/cc2652/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/cc2562
|
||||
$(INSTALL_BIN) ./files/firmware/* $(1)/lib/firmware/cc2562
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/tisbl.init $(1)/etc/init.d/tisbl
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/tifirmware
|
||||
$(INSTALL_BIN) ./files/firmware/* $(1)/etc/tifirmware/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tisbl $(1)/usr/bin/
|
||||
$(INSTALL_BIN) ./files/*.sh $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/tisbl.config $(1)/etc/config/tisbl
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/tisbl.defaults $(1)/etc/uci-defaults
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cc2652))
|
||||
|
||||
124
feeds/bluetooth-cc2652/cc2652/files/ble-scan-rx-parser.sh
Executable file
124
feeds/bluetooth-cc2652/cc2652/files/ble-scan-rx-parser.sh
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/lua
|
||||
--[[
|
||||
ByteCnt: 1 1 1 2 1 4
|
||||
---- --------- ---------- ----- ------ -------
|
||||
FieldName:Type EventCode DataLength Event Status EventId
|
||||
--]]
|
||||
|
||||
--Type
|
||||
Command = 0x01
|
||||
Event = 0x04
|
||||
|
||||
--OpCode
|
||||
GapScan_enable = 0xFE51
|
||||
|
||||
--EventCode
|
||||
HCI_LE_ExtEvent = 0xff
|
||||
|
||||
--Status
|
||||
SUCCESS = 0x00
|
||||
|
||||
--Event
|
||||
GAP_HCI_ExtentionCommandStatus = 0x067F
|
||||
GAP_AdvertiserScannerEvent = 0x0613
|
||||
|
||||
--EventId
|
||||
GAP_EVT_ADV_REPORT = 0x00400000
|
||||
GAP_EVT_SCAN_ENABLED = 0x00010000
|
||||
|
||||
local write = io.write
|
||||
function print(...)
|
||||
local n = select("#",...)
|
||||
for i = 1,n do
|
||||
local v = tostring(select(i,...))
|
||||
write(v)
|
||||
if i~=n then write'\t' end
|
||||
end
|
||||
-- write'\n'
|
||||
end
|
||||
|
||||
function printf(str, ...)
|
||||
return print(str:format(...))
|
||||
end
|
||||
|
||||
function lshift(x, by)
|
||||
return x * 2 ^ by
|
||||
end
|
||||
|
||||
function GetUint8(Payload, position)
|
||||
return string.byte(Payload, position)
|
||||
end
|
||||
|
||||
function GetUint32(Payload, position)
|
||||
return (lshift(string.byte(Payload, position+3),24) + lshift(string.byte(Payload, position+2),16) + lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
|
||||
end
|
||||
|
||||
function GetUint16(Payload, position)
|
||||
return (lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
|
||||
end
|
||||
|
||||
function hexdump(Payload,separator)
|
||||
for i=1,Payload:len(), 1 do
|
||||
io.write(string.format("%02X", Payload:byte(i)))
|
||||
if (i< Payload:len()) then
|
||||
io.write(separator)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ibeacon_hdr=string.char(0x1A,0xFF,0x4C,0x00,0x02,0x15)
|
||||
|
||||
function DumpAdvertiserData(Payload)
|
||||
--[[
|
||||
Len(1byte)+Type(1byte)+Data(Len bytes)
|
||||
--]]
|
||||
while( Payload:len() > 0 ) do
|
||||
local Len = GetUint8(Payload,1)
|
||||
if (GetUint8(Payload,2) == 0xff) then -- manufacturer data
|
||||
print(" MFR=")
|
||||
hexdump(Payload:sub(1,Len+1),'')
|
||||
if (Payload:sub(1,6) == ibeacon_hdr) then
|
||||
print(" [ibeacon]")
|
||||
end
|
||||
end
|
||||
Payload = string.sub(Payload,Len+2,-1)
|
||||
end
|
||||
end
|
||||
|
||||
function DumpAdvertiserScannerEvent(Payload)
|
||||
local Status = GetUint8(Payload,3)
|
||||
local EventId = GetUint32(Payload,4)
|
||||
if((EventId==GAP_EVT_ADV_REPORT) and (Status==SUCCESS))
|
||||
then
|
||||
local MAC = string.sub(Payload,10,15)
|
||||
local TxPower = GetUint8(Payload,19)
|
||||
local RSSI = GetUint8(Payload,20)
|
||||
printf("MAC=%02X%02X%02X%02X%02X%02X RSI=%d PWR=%d",string.byte(MAC,6),string.byte(MAC,5),string.byte(MAC,4),
|
||||
string.byte(MAC,3),string.byte(MAC,2),string.byte(MAC,1),RSSI,TxPower)
|
||||
local DataLength = GetUint16(Payload,30)
|
||||
DumpAdvertiserData(string.sub(Payload,32,-1))
|
||||
print("\n")
|
||||
end
|
||||
end
|
||||
|
||||
function hci_event_paser()
|
||||
while true do
|
||||
local Header = io.read(3)
|
||||
if not Header then break end
|
||||
local EventType = GetUint8(Header,1)
|
||||
local EventCode = GetUint8(Header,2)
|
||||
local DataLength = GetUint8(Header,3)
|
||||
|
||||
local Data = io.read(DataLength)
|
||||
local Event = GetUint16(Data,1)
|
||||
-- print(EventType,EventCode,DataLength,Event)
|
||||
if not Data then break end
|
||||
if(Event==GAP_AdvertiserScannerEvent)
|
||||
then
|
||||
DumpAdvertiserScannerEvent(Data)
|
||||
-- hexdump(ibeacon_hdr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hci_event_paser()
|
||||
8
feeds/bluetooth-cc2652/cc2652/files/blescan.sh
Executable file
8
feeds/bluetooth-cc2652/cc2652/files/blescan.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x08\x00\x00\x00\x00\x00\x00\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x02" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x03" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x04" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x05" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x51\xFE\x06\x00\x00\xF4\x01\x28\x00" | tee /tmp/blescan.data | ble-scan-rx-parser.sh
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /sys/class/gpio/ble_enable/value ]; then
|
||||
echo 1 > /sys/class/gpio/ble_enable/value
|
||||
fi
|
||||
echo 0 > /sys/class/gpio/ble_backdoor/value
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
echo 0 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/ble_backdoor/value
|
||||
tisbl /dev/ttyMSM1 115200 2652 /lib/firmware/cc2562/simple_broadcaster_bd9.bin
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /sys/class/gpio/ble_enable/value ]; then
|
||||
echo 1 > /sys/class/gpio/ble_enable/value
|
||||
fi
|
||||
echo 0 > /sys/class/gpio/ble_backdoor/value
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
echo 0 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/ble_backdoor/value
|
||||
tisbl /dev/ttyMSM1 115200 2652 /lib/firmware/cc2562/ble5_host_test_bd9.bin
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /sys/class/gpio/ble_enable/value ]; then
|
||||
echo 1 > /sys/class/gpio/ble_enable/value
|
||||
fi
|
||||
echo 1 > /sys/class/gpio/ble_backdoor/value
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/ble_reset/value
|
||||
sleep 1
|
||||
11
feeds/bluetooth-cc2652/cc2652/files/hexdump.sh
Executable file
11
feeds/bluetooth-cc2652/cc2652/files/hexdump.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/lua
|
||||
local block = 16
|
||||
while true do
|
||||
local bytes = io.read(block)
|
||||
if not bytes then break end
|
||||
for b in string.gfind(bytes, ".") do
|
||||
io.write(string.format("%02X ", string.byte(b)))
|
||||
end
|
||||
io.write(string.rep(" ", block - string.len(bytes) + 1))
|
||||
io.write(string.gsub(bytes, "%c", "."), "\n")
|
||||
end
|
||||
@@ -1,28 +1,20 @@
|
||||
#!/bin/sh
|
||||
function iBeconScan() {
|
||||
if [ "$#" -eq 4 ]; then
|
||||
UUID=$1
|
||||
MAJOR=$2
|
||||
MINOR=$3
|
||||
POWER=$4
|
||||
else
|
||||
UUID="\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61"
|
||||
MAJOR="\x01\x23"
|
||||
MINOR="\x45\x67"
|
||||
POWER="\xC8"
|
||||
fi
|
||||
# script---------------- UUID---------------------------------------------------------------------- MAJOR----- MINOR----- POWER-
|
||||
#example: ibeacon-broadcaster.sh "\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61" "\x01\x23" "\x45\x67" "\xC8"
|
||||
if [ "$#" -eq 4 ]; then
|
||||
UUID=$1
|
||||
MAJOR=$2
|
||||
MINOR=$3
|
||||
POWER=$4
|
||||
else
|
||||
UUID="\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61"
|
||||
MAJOR="\x01\x23"
|
||||
MINOR="\x45\x67"
|
||||
POWER="\xC8"
|
||||
fi
|
||||
|
||||
cc2562-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
|
||||
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x01\x00\x00\x00\x00\x00\x00\x00" > /dev/null
|
||||
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x3E\xFE\x15\x12\x00\xA0\x00\x00\xA0\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7F\x01\x01\x00" > /dev/null
|
||||
cc2562-wr.sh /dev/ttyMSM1 1 "\x09\x44\xFE\x23\x00\x00\x00\x1E\x00\x02\x01\x1A\x1A\xFF\x4C\x00\x02\x15${UUID}${MAJOR}${MINOR}${POWER}\x00" > /dev/null
|
||||
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x3F\xFE\x04\x00\x00\x00\x00"
|
||||
}
|
||||
|
||||
cc2562-reset.sh
|
||||
|
||||
while true
|
||||
do
|
||||
iBeconScan
|
||||
sleep 1
|
||||
done
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x01\x00\x00\x00\x00\x00\x00\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x3E\xFE\x15\x12\x00\xA0\x00\x00\xA0\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7F\x01\x01\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x09\x44\xFE\x23\x00\x00\x00\x1E\x00\x02\x01\x1A\x1A\xFF\x4C\x00\x02\x15${UUID}${MAJOR}${MINOR}${POWER}\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x3F\xFE\x04\x00\x00\x00\x00" | hexdump.sh
|
||||
5
feeds/bluetooth-cc2652/cc2652/files/ti-hosttest2net.sh
Executable file
5
feeds/bluetooth-cc2652/cc2652/files/ti-hosttest2net.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
killall -9 ser2net
|
||||
tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/ble5_host_test_bd9.bin 79 34
|
||||
echo "7000:telnet:0:/dev/ttyMSM1:115200 8DATABITS NONE 1STOPBIT remctl" > /tmp/ser2net.conf
|
||||
ser2net -c /tmp/ser2net.conf
|
||||
7
feeds/bluetooth-cc2652/cc2652/files/tisbl.config
Executable file
7
feeds/bluetooth-cc2652/cc2652/files/tisbl.config
Executable file
@@ -0,0 +1,7 @@
|
||||
config tisbl 'tisbl'
|
||||
option firmware '/etc/tifirmware/ble5_host_test_bd9.bin'
|
||||
option tty '/dev/ttyMSM1'
|
||||
option tichip '2652'
|
||||
option baudrate '115200'
|
||||
option resetpin '79'
|
||||
option backdoorpin '34'
|
||||
13
feeds/bluetooth-cc2652/cc2652/files/tisbl.defaults
Executable file
13
feeds/bluetooth-cc2652/cc2652/files/tisbl.defaults
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case $board in
|
||||
edgecore,eap104)
|
||||
uci set tisbl.tisbl.backdoorpin=31
|
||||
uci set tisbl.tisbl.resetpin=35
|
||||
;;
|
||||
esac
|
||||
21
feeds/bluetooth-cc2652/cc2652/files/tisbl.init
Executable file
21
feeds/bluetooth-cc2652/cc2652/files/tisbl.init
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
|
||||
#start after dbus (60)
|
||||
START=62
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
firmware="$(uci -q get tisbl.tisbl.firmware)"
|
||||
tty="$(uci -q get tisbl.tisbl.tty)"
|
||||
tichip="$(uci -q get tisbl.tisbl.tichip)"
|
||||
baudrate="$(uci -q get tisbl.tisbl.baudrate)"
|
||||
resetpin="$(uci -q get tisbl.tisbl.resetpin)"
|
||||
backdoorpin="$(uci -q get tisbl.tisbl.backdoorpin)"
|
||||
tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "tisbl"
|
||||
}
|
||||
43
feeds/bluetooth-cc2652/cc2652/files/tisbl.sh
Executable file
43
feeds/bluetooth-cc2652/cc2652/files/tisbl.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
|
||||
# tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/blinky_bd13.bin 79 67
|
||||
|
||||
#assumption: resetpin and backdoorpin are low active
|
||||
tty=$1
|
||||
baudrate=$2
|
||||
tichip=$3
|
||||
firmware=$4
|
||||
resetpin=$5
|
||||
backdoorpin=$6
|
||||
|
||||
ti_reset() #assumption:resetpin is low active
|
||||
{
|
||||
if [ ! -e /sys/class/gpio/gpio${resetpin} ]; then
|
||||
echo ${resetpin} > /sys/class/gpio/export
|
||||
fi
|
||||
echo out > /sys/class/gpio/gpio${resetpin}/direction
|
||||
|
||||
echo 1 > /sys/class/gpio/gpio${resetpin}/value
|
||||
echo 0 > /sys/class/gpio/gpio${resetpin}/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/gpio${resetpin}/value
|
||||
}
|
||||
|
||||
ti_goto_bootloader() #assumption:backdoorpin is low active
|
||||
{
|
||||
if [ ! -e /sys/class/gpio/gpio${backdoorpin} ]; then
|
||||
echo ${backdoorpin} > /sys/class/gpio/export
|
||||
fi
|
||||
echo out > /sys/class/gpio/gpio${backdoorpin}/direction
|
||||
|
||||
echo 0 > /sys/class/gpio/gpio${backdoorpin}/value
|
||||
ti_reset
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/gpio${backdoorpin}/value
|
||||
}
|
||||
|
||||
if [ -e $firmware ]; then
|
||||
ti_goto_bootloader
|
||||
tisbl $tty $baudrate $tichip $firmware #try to upgrade firmware
|
||||
fi
|
||||
|
||||
@@ -5,8 +5,7 @@ START=80
|
||||
boot() {
|
||||
. /lib/functions/system.sh
|
||||
case $(board_name) in
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102)
|
||||
edgecore,eap102)
|
||||
echo 54 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio54/direction
|
||||
echo 0 > /sys/class/gpio/gpio54/value
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=eltt2
|
||||
PKG_VERSION:=1.0
|
||||
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/eltt2
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=eltt2
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/eltt2/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/eltt2 $(1)/bin/
|
||||
endef
|
||||
|
||||
define Package/eltt2/extra_provides
|
||||
echo "libc.so.6";
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,eltt2))
|
||||
@@ -1,27 +0,0 @@
|
||||
Copyright (c) 2014, Infineon Technologies AG
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,15 +0,0 @@
|
||||
# Makefile for Embedded Linux TPM Toolbox 2 (ELTT2)
|
||||
# Copyright (c) Infineon Technologies AG
|
||||
|
||||
#CROSS-COMPILE:=../../../../../qsdk/staging_dir/toolchain-arm/bin/arm-openwrt-linux-
|
||||
#CC:=$(CROSS-COMPILE)gcc
|
||||
CC = gcc
|
||||
CFLAGS=-Wall -Wextra -std=c99 -g
|
||||
|
||||
all: eltt2
|
||||
|
||||
eltt2: eltt2.c eltt2.h
|
||||
$(CC) $(CFLAGS) eltt2.c -o eltt2
|
||||
|
||||
clean:
|
||||
rm -rf eltt2
|
||||
@@ -1,230 +0,0 @@
|
||||
# ELTT2 - Infineon Embedded Linux TPM Toolbox 2 for TPM 2.0
|
||||
|
||||
|
||||
All information in this document is Copyright (c) 2014-2022, Infineon Technologies AG <br>
|
||||
All rights reserved.
|
||||
|
||||
|
||||
# 1. Welcome
|
||||
|
||||
Welcome to Embedded Linux TPM Toolbox 2 (ELTT2). ELTT2 is a single-file executable program intended for testing, performing diagnosis and basic state changes of the Infineon Technologies TPM 2.0.
|
||||
|
||||
|
||||
## 1.1 Prerequisites
|
||||
|
||||
To build and run ELTT2 you need GCC and a Linux system capable of hosting a TPM.
|
||||
|
||||
ELTT2 may run on many other little-endian hardware and software configurations capable of running Linux and hosting a TPM, but this has not been tested.
|
||||
|
||||
ELTT2 does not support machines with a big-endian CPU.
|
||||
|
||||
## 1.2 Getting Started
|
||||
|
||||
A TPM 2.0 evaluation board can be ordered in the [Hitex Webshop](https://www.ehitex.de/evaluation-boards/infineon/2564/iridium-9670-tpm2.0-spi).
|
||||
|
||||
|
||||
<p align="center">
|
||||
<img src="https://cloud.githubusercontent.com/assets/19730245/25651091/77a84744-2fe1-11e7-91bd-a2e39678202d.JPG" width="350"/>
|
||||
</p>
|
||||
|
||||
In order to execute ELTT2, you need to compile it first:
|
||||
1. Switch to the directory with the ELTT2 source code
|
||||
2. Compile the source code by typing the following command:
|
||||
make
|
||||
|
||||
Due to hardware (and thus TPM) access restrictions for normal users, ELTT2 requires root (aka superuser or administrator) privileges. They can be obtained e.g. by using the 'sudo' command on Debian Linux derivates.
|
||||
|
||||
The Infineon [TPM 2.0 Application Note](https://www.infineon.com/dgdl/Infineon-App-Note-SLx9670-TPM2.0_Embedded_RPi_DI_SLx-AN-v01_20-EN.pdf?fileId=5546d46267c74c9a01684b96e69f5d7b) shows how the TPM device driver can be set up (e.g. for Linux Kernel 4.14).
|
||||
|
||||
|
||||
|
||||
# 2. Usage of ELTT2
|
||||
|
||||
## 2.1 Generic Usage
|
||||
|
||||
ELTT2 is operated as follows:
|
||||
|
||||
Call: `./eltt2 <option(s)>`
|
||||
|
||||
For example: `./eltt2 -g` or `./eltt2 -gc`
|
||||
|
||||
For getting an overview of the possible commands, run `./eltt2 -h`
|
||||
|
||||
Some options require the TPM to be in a specific state. This state is shown in brackets ("[]") behind each command line option in the list below:
|
||||
|
||||
\[-\]: none <br>
|
||||
\[\*\]: the TPM platform hierarchy authorization value is not set (i.e., empty buffer) <br>
|
||||
\[l\]: the required PCR bank is allocated <br>
|
||||
\[u\]: started <br>
|
||||
|
||||
To get the TPM into the required state, call ELTT2 with the corresponding commands ("x" for a state means that whether this state is required or not depends on the actual command or the command parameters sent eventually to the TPM).
|
||||
|
||||
Command line option | Explanation | Precondition
|
||||
--- | --- | ---
|
||||
`-a [hash algorithm] <data bytes>` | Hash Sequence SHA-1/256/384 \[default: SHA-1\] | \[u\]
|
||||
`-A <data bytes>` | Hash Sequence SHA-256 | \[u\]
|
||||
`-b <command bytes>` | Enter your own TPM command | \[u\]
|
||||
`-c` | Read Clock | \[u\]
|
||||
`-d <shutdown type>` | Shutdown | \[u\]
|
||||
`-e [hash algorithm] <PCR index> <PCR digest>` | PCR Extend SHA-1/256/384 \[default: SHA-1\] | \[u\], \[l\]
|
||||
`-E <PCR index> <PCR digest>` | PCR Extend SHA-256 | \[u\], \[l\]
|
||||
`-g` | Get fixed capability values | \[u\]
|
||||
`-v` | Get variable capability values | \[u\]
|
||||
`-G <data length>` | Get Random | \[u\]
|
||||
`-h` | Help | \[-\]
|
||||
`-l <hash algorithm>` | PCR Allocate SHA-1/256/384 | \[u\], \[\*\]
|
||||
`-r [hash algorithm] <PCR index>` | PCR Read SHA-1/256/384 \[default: SHA-1\] | \[u\], \[l\]
|
||||
`-R <PCR index>` | PCR Read SHA-256 | \[u\], \[l\]
|
||||
`-s [hash algorithm] <data bytes>` | Hash SHA-1/256/384 \[default: SHA-1\] | \[u\]
|
||||
`-S <data bytes>` | Hash SHA-256 | \[u\]
|
||||
`-t <test type>` | Self Test | \[u\]
|
||||
`-T` | Get Test Result | \[u\]
|
||||
`-u <startup type>` | Startup | \[-\]
|
||||
`-z <PCR index>` | PCR Reset | \[u\]
|
||||
|
||||
|
||||
Additional information:
|
||||
|
||||
`-a`: <br>
|
||||
With the "-a" command you can hash given data with the SHA-1/256/384 hash algorithm. This hash sequence sends 3 commands \[start, update, complete\] to the TPM and allows to hash an arbitrary amount of data. For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
|
||||
`./eltt2 -a 41624364` Hash given data with SHA-1 hash algorithm. <br>
|
||||
or <br>
|
||||
`./eltt2 -a sha1 41624364` Hash given data with SHA-1 hash algorithm. <br>
|
||||
`./eltt2 -a sha256 41624364` Hash given data with SHA-256 hash algorithm. <br>
|
||||
`./eltt2 -a sha384 41624364` Hash given data with SHA-384 hash algorithm. <br>
|
||||
|
||||
`-A`: <br>
|
||||
With the "-A" command you can hash given data with the SHA-256 hash algorithm. This hash sequence sends 3 commands \[start, update, complete\] to the TPM and allows to hash an arbitrary amount of data. For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
|
||||
`./eltt2 -A 41624364`
|
||||
|
||||
`-b`: <br>
|
||||
With the "-b" command you can enter your own TPM command bytes and read the TPM response. For example, use the following command to send a TPM2_Startup with startup type CLEAR to the TPM: <br>
|
||||
`./eltt2 -b 80010000000C000001440000`
|
||||
|
||||
`-c`: <br>
|
||||
With the "-c" command you can read the clock values of the TPM.
|
||||
|
||||
`-d`: <br>
|
||||
With the "-d" command you can issue a TPM shutdown. It has 2 options: <br>
|
||||
`./eltt2 -d` <br>
|
||||
or <br>
|
||||
`./eltt2 -d clear` send a TPM2_Shutdown command with shutdown type CLEAR to the TPM. <br>
|
||||
`./eltt2 -d state` send a TPM2_Shutdown command with shutdown type STATE to the TPM. <br>
|
||||
|
||||
`-e`: <br>
|
||||
With the "-e" command you can extend bytes in the selected PCR with SHA-1/256/384. To do so, you have to enter the index of PCR in hexadecimal that you like to extend and the digest you want to extend the selected PCR with. Note that you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest must have a length of 20/32/48 bytes (will be padded with 0 if necessary). The TPM then builds an SHA-1/256/384 hash over the PCR data in the selected PCR and the digest you provided and writes the result back to the selected PCR. For example, use the following command to extend PCR 23 (0x17) with the byte sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}: <br>
|
||||
`./eltt2 -e 17 41624364` Extend bytes in PCR 23 with SHA-1. <br>
|
||||
or <br>
|
||||
`./eltt2 -e sha1 17 41624364` Extend bytes in PCR 23 with SHA-1. <br>
|
||||
`./eltt2 -e sha256 17 41624364` Extend bytes in PCR 23 with SHA-256. <br>
|
||||
`./eltt2 -e sha384 17 41624364` Extend bytes in PCR 23 with SHA-384. <br>
|
||||
|
||||
`-E`: <br>
|
||||
With the "-E" command you can extend bytes in the selected PCR with SHA-256. To do so, you have to enter the index of PCR in hexadecimal that you like to extend and the digest you want to extend the selected PCR with. Note that you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest must have a length of 32 bytes (will be padded with 0 if necessary). The TPM then builds an SHA-256 hash over the PCR data in the selected PCR and the digest you provided and writes the result back to the selected PCR. For example, use the following command to extend PCR 23 (0x17) with the byte sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}: <br>
|
||||
`./eltt2 -E 17 41624364`
|
||||
|
||||
`-g`: <br>
|
||||
With the "-g" command you can read the TPM's fixed properties.
|
||||
|
||||
`-v`: <br>
|
||||
With the "-v" command you can read the TPM's variable properties.
|
||||
|
||||
`-G`: <br>
|
||||
With the "-G" command you can get a given amount of random bytes. Note that you can only request a maximum amount of 32 random bytes at once. For example, use the following command to get 20 (0x14) random bytes: <br>
|
||||
`./eltt2 -G 14`
|
||||
|
||||
`-l`: <br>
|
||||
With the "-l" command you can allocate the SHA-1/256/384 PCR bank. Take note of two things. Firstly, the command requires a platform authorization value and it is set to an empty buffer; hence the command cannot be used if the TPM platform authorization value is set (e.g., by UEFI). Secondly, when the command is executed successfully a TPM reset has to follow for it to take effect. For example, use the following command to allocate a PCR bank: <br>
|
||||
`./eltt2 -l sha1` Allocate SHA-1 PCR bank. <br>
|
||||
`./eltt2 -l sha256` Allocate SHA-256 PCR bank. <br>
|
||||
`./eltt2 -l sha384` Allocate SHA-384 PCR bank. <br>
|
||||
|
||||
`-r`: <br>
|
||||
With the "-r" command you can read data from a selected SHA-1/256/384 PCR. For example, use the following command to read data from PCR 23 (0x17): <br>
|
||||
`./eltt2 -r 17` Read data from SHA-1 PCR 23. <br>
|
||||
or <br>
|
||||
`./eltt2 -r sha1 17` Read data from SHA-1 PCR 23. <br>
|
||||
`./eltt2 -r sha256 17` Read data from SHA-256 PCR 23. <br>
|
||||
`./eltt2 -r sha384 17` Read data from SHA-384 PCR 23. <br>
|
||||
|
||||
`-R`: <br>
|
||||
With the "-R" command you can read data from a selected SHA-256 PCR. For example, use the following command to read data from PCR 23 (0x17): <br>
|
||||
`./eltt2 -R 17`
|
||||
|
||||
`-s`: <br>
|
||||
With the "-s" command you can hash given data with the SHA-1/256/384 hash algorithm. This command only allows a limited amount of data to be hashed (depending on the TPM's maximum input buffer size). For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
|
||||
`./eltt2 -s 41624364` Hash given data with SHA-1 hash algorithm. <br>
|
||||
or <br>
|
||||
`./eltt2 -s sha1 41624364` Hash given data with SHA-1 hash algorithm. <br>
|
||||
`./eltt2 -s sha256 41624364` Hash given data with SHA-256 hash algorithm. <br>
|
||||
`./eltt2 -s sha384 41624364` Hash given data with SHA-384 hash algorithm. <br>
|
||||
|
||||
`-S`: <br>
|
||||
With the "-S" command you can hash given data with the SHA-256 hash algorithm. This command only allows a limited amount of data to be hashed (depending on the TPM input buffer size). For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
|
||||
`./eltt2 -S 41624364`
|
||||
|
||||
`-t`: <br>
|
||||
With the "-t" command you can issue a TPM selftest. It has 3 options: <br>
|
||||
`./eltt2 -t` <br>
|
||||
or<br>
|
||||
`./eltt2 -t not_full` Perform a partial TPM2_Selftest to test previously untested TPM capabilities. <br>
|
||||
`./eltt2 -t full` Perform a full TPM2_Selftest to test all TPM capabilities. <br>
|
||||
`./eltt2 -t incremental` Perform a test of selected algorithms.
|
||||
|
||||
`-T`: <br>
|
||||
With the "-T" command you can read the results of a previously run selftest.
|
||||
|
||||
`-u`: <br>
|
||||
With the "-u" command you can issue a TPM startup command. It has 2 options: <br>
|
||||
`./eltt2 -u` <br>
|
||||
or <br>
|
||||
`./eltt2 -u clear` send a TPM2_Startup with startup type CLEAR to the TPM. <br>
|
||||
`./eltt2 -u state` send a TPM2_Startup with startup type STATE to the TPM.
|
||||
|
||||
`-z`: <br>
|
||||
With the "-z" command you can reset a selected PCR. Note that you can only reset PCRs 16 and 23. For example, use the following command to reset PCR 23 (0x17): <br>
|
||||
`./eltt2 -z 17`
|
||||
|
||||
## 2.2 Examples:
|
||||
|
||||
In order to work with the TPM, perform the following steps:
|
||||
- Send the TPM2_Startup command: `./eltt2 -u`
|
||||
|
||||
|
||||
# 3. If you have questions
|
||||
|
||||
If you have any questions or problems, please read the section "FAQ and
|
||||
Troubleshooting" in this document.
|
||||
In case you still have questions, contact your local Infineon
|
||||
Representative.
|
||||
Further information is available at <https://www.infineon.com/tpm>.
|
||||
|
||||
|
||||
# 4. FAQ and Troubleshooting
|
||||
|
||||
If you encounter any error, please make sure that
|
||||
- the TPM is properly connected.
|
||||
- the TPM driver is loaded, i.e. check that "/dev/tpm0" exists. In case of driver loading problems (e.g. shown by "Error opening device"), reboot your system and try to load the driver again.
|
||||
- ELTT2 has been started with root permissions. Please note that ELTT2 needs root permissions for all commands.
|
||||
- the TPM is started. (See section 2.2 in this document on how to do this.)
|
||||
|
||||
|
||||
The following list shows the most common errors and their solution:
|
||||
|
||||
The ELTT2 response is "Error opening the device.":
|
||||
- You need to load a TPM driver before you can work with ELTT2.
|
||||
- You need to start ELTT2 with root permissions.
|
||||
|
||||
The ELTT2 responds with error code 0x100.
|
||||
- You need to send the TPM2_Startup command, or you did send it twice. In
|
||||
case you have not sent it yet, do so with `./eltt2 -u`.
|
||||
|
||||
The TPM does not change any of the permanent flags shown by sending the "-g"
|
||||
command , e.g. after a force clear.
|
||||
- The TPM requires a reset in order to change any of the permanent flags.
|
||||
Press the reset button or disconnect the TPM to do so.
|
||||
|
||||
The value of a PCR does not change after sending PCR extend or reset.
|
||||
- With the application permissions you cannot modify every PCR. For more
|
||||
details, please refer to the description for the different PCR commands
|
||||
in this file.
|
||||
@@ -1,362 +0,0 @@
|
||||
--------------------------------------------------------------------------------
|
||||
Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0 v1.1
|
||||
Infineon Technologies AG
|
||||
|
||||
All information in this document is Copyright (c) 2014, Infineon Technologies AG
|
||||
All rights reserved.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Contents:
|
||||
|
||||
1. Welcome
|
||||
1.1 Prerequisites
|
||||
1.2 Contents of the package
|
||||
1.3 Getting Started
|
||||
|
||||
2. Usage of Embedded Linux TPM Toolbox 2 (ELTT2)
|
||||
2.1 Generic Usage
|
||||
2.2 Examples
|
||||
|
||||
3. If you have questions
|
||||
|
||||
4. Release Info
|
||||
|
||||
5. FAQ
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
|
||||
1. Welcome
|
||||
|
||||
Welcome to Embedded Linux TPM Toolbox 2 (ELTT2).
|
||||
ELTT2 is a single-file executable program intended for testing, performing
|
||||
diagnosis and basic state changes of the Infineon Technologies TPM 2.0.
|
||||
|
||||
|
||||
1.1 Prerequisites
|
||||
|
||||
To build and run ELTT2 you need GCC and a Linux system capable of hosting a
|
||||
TPM 2.0.
|
||||
|
||||
Tested PC Platforms (x86):
|
||||
- Ubuntu (R) Linux 12.04 LTS - 64 bit (modified Kernel 3.15.4)
|
||||
with Infineon TPM 2.0 SLB9665 Firmware 5.22
|
||||
|
||||
Tested Embedded Platforms (ARM):
|
||||
- Android 6.0 "Marshmallow" - 64 bit (modified Kernel 3.18.0+) on HiKey
|
||||
with Prototype Infineon I2C TPM 2.0 for Embedded Platforms
|
||||
|
||||
ELTT2 may run on many other little-endian hardware and software
|
||||
configurations capable of running Linux and hosting a TPM 2.0, but this has
|
||||
not been tested.
|
||||
|
||||
ELTT2 does not support machines with a big-endian CPU.
|
||||
|
||||
|
||||
1.2 Contents of Package
|
||||
|
||||
ELTT2 consists of the following files:
|
||||
- eltt2.c
|
||||
Contains all method implementations of ELTT2.
|
||||
- eltt2.h
|
||||
Contains all constant definitions, method and command byte declarations
|
||||
for the operation of ELTT2.
|
||||
- License.txt
|
||||
Contains the license agreement for ELTT2.
|
||||
- Makefile
|
||||
Contains the command to compile ELTT2.
|
||||
- README.txt
|
||||
This file.
|
||||
|
||||
|
||||
1.3 Getting Started
|
||||
|
||||
In order to execute ELTT2, you need to compile it first:
|
||||
1. Switch to the directory with the ELTT2 source code
|
||||
2. Compile the source code by typing the following command:
|
||||
make
|
||||
|
||||
Due to hardware (and thus TPM) access restrictions for normal users, ELTT2
|
||||
requires root (aka superuser or administrator) privileges. They can be
|
||||
obtained e.g. by using the 'sudo' command on Debian Linux derivates.
|
||||
|
||||
|
||||
2. Usage of ELTT2
|
||||
|
||||
|
||||
2.1 Generic Usage
|
||||
|
||||
ELTT2 is operated as follows:
|
||||
|
||||
Call: ./eltt2 <option(s)>
|
||||
|
||||
For example: ./eltt2 -g or ./eltt2 -gc
|
||||
|
||||
For getting an overview of the possible commands, run ./eltt2 -h
|
||||
|
||||
Some options require the TPM to be in a specific state. This state is shown
|
||||
in brackets ("[]") behind each command line option in the list below:
|
||||
|
||||
[-]: none
|
||||
[*]: the TPM platform hierarchy authorization value is not set (i.e., empty buffer)
|
||||
[l]: the required PCR bank is allocated
|
||||
[u]: started
|
||||
|
||||
To get the TPM into the required state, call ELTT2 with the corresponding
|
||||
commands ("x" for a state means that whether this state is required or not
|
||||
depends on the actual command or the command parameters sent eventually to
|
||||
the TPM).
|
||||
|
||||
|
||||
Command line options: Preconditions:
|
||||
|
||||
-a [hash algorithm] <data bytes>: Hash Sequence SHA-1/256/384 [default: SHA-1] [u]
|
||||
|
||||
-A <data bytes>: Hash Sequence SHA-256 [u]
|
||||
|
||||
-b <command bytes>: Enter your own TPM command [u]
|
||||
|
||||
-c: Read Clock [u]
|
||||
|
||||
-d <shutdown type>: Shutdown [u]
|
||||
|
||||
-e [hash algorithm] <PCR index> <PCR digest>: PCR Extend SHA-1/256/384 [default: SHA-1] [u], [l]
|
||||
|
||||
-E <PCR index> <PCR digest>: PCR Extend SHA-256 [u], [l]
|
||||
|
||||
-g: Get fixed capability values [u]
|
||||
|
||||
-v: Get variable capability values [u]
|
||||
|
||||
-G <data length>: Get Random [u]
|
||||
|
||||
-h: Help [-]
|
||||
|
||||
-l <hash algorithm>: PCR Allocate SHA-1/256/384 [u], [*]
|
||||
|
||||
-r [hash algorithm] <PCR index>: PCR Read SHA-1/256/384 [default: SHA-1] [u], [l]
|
||||
|
||||
-R <PCR index>: PCR Read SHA-256 [u], [l]
|
||||
|
||||
-s [hash algorithm] <data bytes>: Hash SHA-1/SHA256 [default: SHA-1] [u]
|
||||
|
||||
-S <data bytes>: Hash SHA-256 [u]
|
||||
|
||||
-t <test type>: Self Test [u]
|
||||
|
||||
-T: Get Test Result [u]
|
||||
|
||||
-u <startup type>: Startup [-]
|
||||
|
||||
-z <PCR index>: PCR Reset [u]
|
||||
|
||||
|
||||
Additional information:
|
||||
|
||||
-a:
|
||||
With the "-a" command you can hash given data with the SHA-1/256/384 hash
|
||||
algorithm. This hash sequence sends 3 commands [start, update, complete]
|
||||
to the TPM and allows to hash an arbitrary amount of data.
|
||||
For example, use the following command to hash the byte sequence {0x41,
|
||||
0x62, 0x43, 0x64}:
|
||||
./eltt2 -a 41624364 Hash given data with SHA-1 hash algorithm.
|
||||
or
|
||||
./eltt2 -a sha1 41624364 Hash given data with SHA-1 hash algorithm.
|
||||
./eltt2 -a sha256 41624364 Hash given data with SHA-256 hash algorithm.
|
||||
|
||||
-A:
|
||||
With the "-A" command you can hash given data with the SHA-256 hash
|
||||
algorithm. This hash sequence sends 3 commands [start, update, complete] to
|
||||
the TPM and allows to hash an arbitrary amount of data.
|
||||
For example, use the following command to hash the byte sequence {0x41,
|
||||
0x62, 0x43, 0x64}:
|
||||
./eltt2 -A 41624364
|
||||
|
||||
-b:
|
||||
With the "-b" command you can enter your own TPM command bytes and read the
|
||||
TPM response.
|
||||
For example, use the following command to send a TPM2_Startup with startup
|
||||
type CLEAR to the TPM:
|
||||
./eltt2 -b 80010000000C000001440000
|
||||
|
||||
-c:
|
||||
With the "-c" command you can read the clock values of the TPM.
|
||||
|
||||
-d:
|
||||
With the "-d" command you can issue a TPM shutdown. It has 2 options:
|
||||
./eltt2 -d
|
||||
or
|
||||
./eltt2 -d clear send a TPM2_Shutdown command with shutdown type CLEAR to
|
||||
the TPM.
|
||||
./eltt2 -d state send a TPM2_Shutdown command with shutdown type STATE to
|
||||
the TPM.
|
||||
|
||||
-e:
|
||||
With the "-e" command you can extend bytes in the selected PCR with SHA-1/256/384.
|
||||
To do so, you have to enter the index of PCR in hexadecimal that you like to
|
||||
extend and the digest you want to extend the selected PCR with. Note that
|
||||
you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest
|
||||
must have a length of 20/32/48 bytes (will be padded with 0 if necessary).
|
||||
The TPM then builds an SHA-1/256/384 hash over the PCR data in the selected PCR
|
||||
and the digest you provided and writes the result back to the selected PCR.
|
||||
For example, use the following command to extend PCR 23 (0x17) with the byte
|
||||
sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}:
|
||||
./eltt2 -e 17 41624364 Extend bytes in PCR 23 with SHA-1.
|
||||
or
|
||||
./eltt2 -e sha1 17 41624364 Extend bytes in PCR 23 with SHA-1.
|
||||
./eltt2 -e sha256 17 41624364 Extend bytes in PCR 23 with SHA-256.
|
||||
|
||||
-E:
|
||||
With the "-E" command you can extend bytes in the selected PCR with SHA-256.
|
||||
To do so, you have to enter the index of PCR in hexadecimal that you like to
|
||||
extend and the digest you want to extend the selected PCR with. Note that
|
||||
you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest
|
||||
must have a length of 32 bytes (will be padded with 0 if necessary).
|
||||
The TPM then builds an SHA-256 hash over the PCR data in the selected PCR
|
||||
and the digest you provided and writes the result back to the selected PCR.
|
||||
For example, use the following command to extend PCR 23 (0x17) with the byte
|
||||
sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}:
|
||||
./eltt2 -E 17 41624364
|
||||
|
||||
-g:
|
||||
With the "-g" command you can read the TPM's fixed properties.
|
||||
|
||||
-v:
|
||||
With the "-v" command you can read the TPM's variable properties.
|
||||
|
||||
-G:
|
||||
With the "-G" command you can get a given amount of random bytes. Note that
|
||||
you can only request a maximum amount of 32 random bytes at once.
|
||||
For example, use the following command to get 20 (0x14) random bytes:
|
||||
./eltt2 -G 14
|
||||
|
||||
-l:
|
||||
With the "-l" command you can allocate the SHA-1/256/384 PCR bank.
|
||||
Take note of two things. Firstly, the command requires a platform
|
||||
authorization value and it is set to an empty buffer; hence the command
|
||||
cannot be used if the TPM platform authorization value is set (e.g., by UEFI).
|
||||
Secondly, when the command is executed successfully a TPM reset has to
|
||||
follow for it to take effect. For example, use the following command to
|
||||
allocate a PCR bank:
|
||||
./eltt2 -l sha1 Allocate SHA-1 PCR bank.
|
||||
./eltt2 -l sha256 Allocate SHA-256 PCR bank.
|
||||
./eltt2 -l sha384 Allocate SHA-384 PCR bank.
|
||||
|
||||
-r:
|
||||
With the "-r" command you can read data from a selected SHA-1/256/384 PCR.
|
||||
For example, use the following command to read data from PCR 23 (0x17):
|
||||
./eltt2 -r 17 Read data from SHA-1 PCR 23.
|
||||
or
|
||||
./eltt2 -r sha1 17 Read data from SHA-1 PCR 23.
|
||||
./eltt2 -r sha256 17 Read data from SHA-256 PCR 23.
|
||||
|
||||
-R:
|
||||
With the "-R" command you can read data from a selected SHA-256 PCR.
|
||||
For example, use the following command to read data from PCR 23 (0x17):
|
||||
./eltt2 -R 17
|
||||
|
||||
-s:
|
||||
With the "-s" command you can hash given data with the SHA-1/256/384 hash
|
||||
algorithm. This command only allows a limited amount of data to be hashed
|
||||
(depending on the TPM's maximum input buffer size).
|
||||
For example, use the following command to hash the byte sequence {0x41,
|
||||
0x62, 0x43, 0x64}:
|
||||
./eltt2 -s 41624364 Hash given data with SHA-1 hash algorithm.
|
||||
or
|
||||
./eltt2 -s sha1 41624364 Hash given data with SHA-1 hash algorithm.
|
||||
./eltt2 -s sha256 41624364 Hash given data with SHA-256 hash algorithm.
|
||||
|
||||
-S:
|
||||
With the "-S" command you can hash given data with the SHA-256 hash
|
||||
algorithm. This command only allows a limited amount of data to be hashed
|
||||
(depending on the TPM input buffer size).
|
||||
For example, use the following command to hash the byte sequence {0x41,
|
||||
0x62, 0x43, 0x64}:
|
||||
./eltt2 -S 41624364
|
||||
|
||||
-t:
|
||||
With the "-t" command you can issue a TPM selftest. It has 3 options:
|
||||
./eltt2 -t
|
||||
or
|
||||
./eltt2 -t not_full Perform a partial TPM2_Selftest to test previously
|
||||
untested TPM capabilities.
|
||||
./eltt2 -t full Perform a full TPM2_Selftest to test all TPM
|
||||
capabilities.
|
||||
./eltt2 -t incremental Perform a test of selected algorithms.
|
||||
|
||||
-T:
|
||||
With the "-T" command you can read the results of a previously run selftest.
|
||||
|
||||
-u:
|
||||
With the "-u" command you can issue a TPM startup command. It has 2 options:
|
||||
./eltt2 -u
|
||||
or
|
||||
./eltt2 -u clear send a TPM2_Startup with startup type CLEAR to the TPM.
|
||||
./eltt2 -u state send a TPM2_Startup with startup type STATE to the TPM.
|
||||
|
||||
-z:
|
||||
With the "-z" command you can reset a selected PCR. Note that you can only
|
||||
reset PCRs 16 and 23 and that the PCR is going to be reset in both banks
|
||||
(SHA-1 and SHA-256).
|
||||
For example, use the following command to reset PCR 23 (0x17):
|
||||
./eltt2 -z 17
|
||||
|
||||
|
||||
2.2 Examples:
|
||||
|
||||
In order to work with the TPM, perform the following steps:
|
||||
- Send the TPM2_Startup command: ./eltt2 -u
|
||||
|
||||
|
||||
|
||||
3. If you have questions
|
||||
|
||||
If you have any questions or problems, please read the section "FAQ and
|
||||
Troubleshooting" in this document.
|
||||
In case you still have questions, contact your local Infineon
|
||||
Representative.
|
||||
Further information is available at http://www.infineon.com/tpm.
|
||||
|
||||
|
||||
|
||||
4. Release Info
|
||||
|
||||
This is version 1.1. This version is a general release.
|
||||
|
||||
|
||||
|
||||
5. FAQ and Troubleshooting
|
||||
|
||||
If you encounter any error, please make sure that
|
||||
- the TPM is properly connected.
|
||||
- the TPM driver is loaded, i.e. check that "/dev/tpm0" exists. In case of
|
||||
driver loading problems (e.g. shown by "Error opening device"), reboot
|
||||
your system and try to load the driver again.
|
||||
- ELTT2 has been started with root permissions. Please note that ELTT2 needs
|
||||
root permissions for all commands.
|
||||
- the TPM is started. (See section 2.2 in this document on how to do this.)
|
||||
- Trousers do not run anymore. In some cases the Kernel starts Trousers by
|
||||
booting.
|
||||
Shut down Trousers by entering the following command:
|
||||
sudo pkill tcsd
|
||||
|
||||
The following list shows the most common errors and their solution:
|
||||
|
||||
The ELTT2 response is "Error opening the device.":
|
||||
- You need to load a TPM driver before you can work with ELTT2.
|
||||
- You need to start ELTT2 with root permissions.
|
||||
|
||||
The ELTT2 responds with error code 0x100.
|
||||
- You need to send the TPM2_Startup command, or you did send it twice. In
|
||||
case you have not sent it yet, do so with "./eltt2 -u".
|
||||
|
||||
The TPM does not change any of the permanent flags shown by sending the "-g"
|
||||
command , e.g. after a force clear.
|
||||
- The TPM requires a reset in order to change any of the permanent flags.
|
||||
Press the reset button or disconnect the TPM to do so.
|
||||
|
||||
The value of a PCR does not change after sending PCR extend or reset.
|
||||
- With the application permissions you cannot modify every PCR. For more
|
||||
details, please refer to the description for the different PCR commands
|
||||
in this file.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,634 +0,0 @@
|
||||
#ifndef _ELTT2_H_
|
||||
#define _ELTT2_H_
|
||||
/**
|
||||
* @brief Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0
|
||||
* @details eltt2.h implements all TPM byte commands and the prototype declarations for eltt2.c.
|
||||
* @file eltt2.h
|
||||
* @date 2014/06/26
|
||||
* @copyright Copyright (c) 2014 - 2017 Infineon Technologies AG ( www.infineon.com ).\n
|
||||
* All rights reserved.\n
|
||||
* \n
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
|
||||
* conditions are met:\n
|
||||
* \n
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
* disclaimer.\n
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with the distribution.\n
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.\n
|
||||
* \n
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// this is the main page for doxygen documentation.
|
||||
/** @mainpage Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0 Documentation
|
||||
*
|
||||
* @section Welcome
|
||||
* Welcome to Infineon TPM 2.0 Software-Tool "Embedded Linux TPM Toolbox 2 (ELTT2)".\n
|
||||
* \n
|
||||
* @section Introduction
|
||||
* ELTT2 is a single file-executable program
|
||||
* intended for test, diagnosis and basic state changes of the Infineon
|
||||
* Technologies TPM 2.0.\n
|
||||
* \n
|
||||
* @section Copyright
|
||||
* Copyright (c) 2014 - 2017 Infineon Technologies AG ( www.infineon.com ).\n
|
||||
* All rights reserved.\n
|
||||
* \n
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
|
||||
* conditions are met:\n
|
||||
* \n
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
* disclaimer.\n
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with the distribution.\n
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.\n
|
||||
* \n
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
//-------------"Defines"-------------
|
||||
#define TPM_RESP_MAX_SIZE 4096 ///< This is the maximum possible TPM response size in bytes.
|
||||
#define TPM_REQ_MAX_SIZE 1024 ///< This is the maximum possible TPM request size in bytes. TBD: Find out correct value.
|
||||
#define ERR_COMMUNICATION -1 ///< Return error check for read and write to the TPM.
|
||||
#define ERR_BAD_CMD -2 ///< Error code for a bad command line argument or option.
|
||||
#define TPM_SHA1_DIGEST_SIZE 20 ///< For all SHA-1 operations the digest's size is always 20 bytes.
|
||||
#define TPM_SHA256_DIGEST_SIZE 32 ///< For all SHA-256 operations the digest's size is always 32 bytes.
|
||||
#define TPM_SHA384_DIGEST_SIZE 48 ///< For all SHA-384 operations the digest's size is always 48 bytes.
|
||||
#define TPM_CMD_HEADER_SIZE 10 ///< The size of a standard TPM command header is 10 bytes.
|
||||
#define TPM_CMD_SIZE_OFFSET 2 ///< The offset of a TPM command's size value is 2 bytes.
|
||||
#define HEX_BYTE_STRING_LENGTH 2 ///< A byte can be represented by two hexadecimal characters.
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 0x7FFFFFF ///< The maximum value of a signed 32-bit integer.
|
||||
#endif
|
||||
// TPM Return codes
|
||||
#define TPM_RC_SUCCESS 0x00000000 ///< The response error code for TPM_SUCCESS.
|
||||
#define TPM_RC_BAD_TAG 0x0000001E ///< The response error code for TPM_RC_BAD_TAG.
|
||||
#define TPM_RC_SIZE 0x00000095 ///< The response error code for TPM_RC_SIZE.
|
||||
#define TPM_RC_INITIALIZE 0x00000100 ///< The response error code for TPM_RC_INITIALIZE.
|
||||
#define TPM_RC_FAILURE 0x00000101 ///< The response error code for TPM_RC_FAILURE.
|
||||
#define TPM_RC_LOCALITY 0x00000907 ///< The response error code for TPM_RC_LOCALITY.
|
||||
#define FU_FIRMWARE_VALID_FLAG 4 ///< If this flag is set, the firmware is valid.
|
||||
#define FU_OWNER_FLAG 1 ///< If this flag is set, the owner is set.
|
||||
// print_response_buf options
|
||||
#define PRINT_RESPONSE_CLEAR 1 ///< Prints response unformatted.
|
||||
#define PRINT_RESPONSE_HEADERBLOCKS 2 ///< Prints response in commented blocks.
|
||||
#define PRINT_RESPONSE_HEX_BLOCK 3 ///< Prints response in rows of 16 bytes and shows the line number.
|
||||
#define PRINT_RESPONSE_HASH 4 ///< Prints response of Hash
|
||||
#define PRINT_RESPONSE_WITHOUT_HEADER 12 ///< Prints the response buffer from byte 12.
|
||||
#define PRINT_RESPONSE_HASH_WITHOUT_HEADER 16 ///< Prints the response buffer from byte 16.
|
||||
#define PRINT_RESPONSE_WITH_HEADER 0 ///< Prints the response buffer from byte 0.
|
||||
#define PRINT_RESPONSE_PCR_WITHOUT_HEADER 30 ///< Prints the pcr buffer from pcr_read.
|
||||
// time conversion
|
||||
#define YEAR_SECONDS 31536000 ///< Number of seconds in one year
|
||||
#define DAY_SECONDS 86400 ///< Number of seconds in one day
|
||||
#define HOUR_SECONDS 3600 ///< Number of seconds in one hour
|
||||
#define MINUTE_SECONDS 60 ///< Number of seconds in one minute
|
||||
#define MILISECOND_TO_SECOND 1000 ///< Convertion from miliseconds to seconds
|
||||
// hash
|
||||
#define STD_CC_HASH_SIZE 18 ///< Hash command size
|
||||
// TPM_PT constants
|
||||
#define PT_FIXED_SELECTOR 1 ///< Fixed GetCapability Flags
|
||||
#define PT_VAR_SELECTOR 2 ///< Variable GetCapability Flags
|
||||
|
||||
//-------------"Macros"-------------
|
||||
// Null pointer check
|
||||
#define NULL_POINTER_CHECK(x) if (NULL == x) { ret_val = EINVAL; fprintf(stderr, "Error: Invalid argument.\n"); break; } ///< Argument NULL check.
|
||||
#define MALLOC_ERROR_CHECK(x) if (NULL == x) { ret_val = errno; fprintf(stderr, "Error (re)allocating memory.\n"); break; } ///< Malloc error check.
|
||||
#define MEMSET_FREE(x, y) if (NULL != x) { memset(x, 0, y); free(x); x = NULL; } ///< Sets memory to 0, frees memory and sets pointer to NULL.
|
||||
// Return value check
|
||||
#define RET_VAL_CHECK(x) if (EXIT_SUCCESS != x) { break; } ///< Return value check
|
||||
// Command line option parser for hash algorithm
|
||||
#define HASH_ALG_PARSER(o, c) \
|
||||
do { \
|
||||
if (o == option) \
|
||||
{ \
|
||||
if (c == argc) \
|
||||
{ \
|
||||
hash_algo = ALG_SHA1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (0 == strcasecmp(optarg, "sha1")) \
|
||||
{ \
|
||||
hash_algo = ALG_SHA1; \
|
||||
} \
|
||||
else if (0 == strcasecmp(optarg, "sha256")) \
|
||||
{ \
|
||||
hash_algo = ALG_SHA256; \
|
||||
} \
|
||||
else if (0 == strcasecmp(optarg, "sha384")) \
|
||||
{ \
|
||||
hash_algo = ALG_SHA384; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ret_val = ERR_BAD_CMD; \
|
||||
fprintf(stderr, "Unknown option. Use '-h' for more information.\n"); \
|
||||
break; \
|
||||
} \
|
||||
if (argc > optind) \
|
||||
{ \
|
||||
optarg = argv[optind++]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
hash_algo = ALG_SHA256; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
//--------------"Enums"--------------
|
||||
// Hash algorithms
|
||||
typedef enum hash_algo_enum
|
||||
{
|
||||
ALG_NULL,
|
||||
ALG_SHA1,
|
||||
ALG_SHA256,
|
||||
ALG_SHA384,
|
||||
} hash_algo_enum;
|
||||
|
||||
//-------------"Methods"-------------
|
||||
/**
|
||||
* @brief Convert (max.) 8 byte buffer to an unsigned 64-bit integer.
|
||||
* @param [in] *input_buffer Input buffer. Make sure that its size is at least as high as offset + length.
|
||||
* @param [in] offset Start byte for conversion.
|
||||
* @param [in] length Amount of bytes to be converted.
|
||||
* @param [out] *output_value Return the converted unsigned 64-bit integer.
|
||||
* @param [in] input_buffer_size Size of input_buffer in bytes.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer or length is greater than 8.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int buf_to_uint64(uint8_t *input_buffer, uint32_t offset, uint32_t length, uint64_t *output_value, uint32_t input_buffer_size);
|
||||
|
||||
/**
|
||||
* @brief Convert a hexadecimal string representation of bytes like "0A1F" and
|
||||
returns an array containing the actual byte values as an array (e.g. { 0x0A, 0x1F }).
|
||||
* @param [in] *byte_string Incoming bytes as string.
|
||||
* @param [out] *byte_values Byte array representation of given input string.
|
||||
* Must be allocated by caller with the length given in byte_values_size.
|
||||
* @param [in] byte_values_size Size of byte_values array.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval value of errno In case parsing error.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int hexstr_to_bytearray(char *byte_string, uint8_t *byte_values, size_t byte_values_size);
|
||||
|
||||
/**
|
||||
* @brief Convert a number to a byte buffer.
|
||||
* @param [in] input User input.
|
||||
* @param [in] input_size Size of input data type in bytes.
|
||||
* @param [out] *output_byte Return buffer for the converted integer.
|
||||
Must be allocated by the caller with at least a size of 'input_size'.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int int_to_bytearray(uint64_t input, uint32_t input_size, uint8_t *output_byte);
|
||||
|
||||
/**
|
||||
* @brief Create the PCR_Extend command.
|
||||
* @param [in] *pcr_index_str User input string for PCR index.
|
||||
* @param [in] *pcr_digest_str User input string of value to extend the selected PCR with.
|
||||
* @param [out] *pcr_cmd_buf Return buffer for the complete command. Must be allocated by caller.
|
||||
* @param [in] *pcr_cmd_buf_size Size of memory allocated at pcr_cmd_buf in bytes.
|
||||
* @param [in] hash_algo Set to ALG_SHA1 for extending with SHA-1,
|
||||
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer or an invalid option.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval ERR_BAD_CMD In case of bad user input.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int pcr_extend(char *pcr_index_str, char *pcr_digest_str, uint8_t *pcr_cmd_buf, size_t pcr_cmd_buf_size, hash_algo_enum hash_algo);
|
||||
|
||||
/**
|
||||
* @brief Create the PCR_Allocate command.
|
||||
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
|
||||
* @param [in] hash_algo Set to ALG_SHA1 to allocate SHA-1,
|
||||
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer or an invalid option.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @date 2022/05/09
|
||||
*/
|
||||
static int pcr_allocate(uint8_t *pcr_cmd_buf, hash_algo_enum hash_algo);
|
||||
|
||||
/**
|
||||
* @brief Create the PCR_Read command.
|
||||
* @param [in] *pcr_index_str User input string for PCR index.
|
||||
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
|
||||
* @param [in] hash_algo Set to ALG_SHA1 for reading with SHA-1,
|
||||
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer or an invalid option.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval ERR_BAD_CMD In case of bad user input.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int pcr_read(char *pcr_index_str, uint8_t *pcr_cmd_buf, hash_algo_enum hash_algo);
|
||||
|
||||
/**
|
||||
* @brief Create the PCR_Reset command.
|
||||
* @param [in] *pcr_index_str User input string for PCR index.
|
||||
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval ERR_BAD_CMD In case of bad user input.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int pcr_reset(char *pcr_index_str, uint8_t *pcr_cmd_buf);
|
||||
|
||||
/**
|
||||
* @brief Print the command line usage and switches.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static void print_help();
|
||||
|
||||
/**
|
||||
* @brief Print the response buffer in different formats.
|
||||
* @param [in] *response_buf TPM response.
|
||||
* @param [in] resp_size TPM response size.
|
||||
* @param [in] offset Starting point for printing buffer.
|
||||
* @param [in] format Select the output format.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer or an unknown output format has been transfered.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval buf_to_uint64 All error codes from buf_to_uint64.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int print_response_buf(uint8_t *response_buf, size_t resp_size, uint32_t offset, int format);
|
||||
|
||||
/**
|
||||
* @brief Print a TPM response.
|
||||
* @param [in] *response_buf TPM response.
|
||||
* @param [in] resp_size TPM response size.
|
||||
* @param [in] option Defines appearance of output. Can have the following values:\n
|
||||
- PRINT_RESPONSE_CLEAR
|
||||
- PRINT_RESPONSE_HEADERBLOCKS
|
||||
- PRINT_RESPONSE_HEX_BLOCK
|
||||
- PRINT_RESPONSE_WITHOUT_HEADER
|
||||
- PRINT_RESPONSE_WITH_HEADER
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval print_response_buf All error codes from print_response_buf.
|
||||
* @retval print_clock_info All error codes from print_clock_info.
|
||||
* @retval print_capability_flags All error codes from print_capability_flags.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int response_print(uint8_t *response_buf, size_t resp_size, int option);
|
||||
|
||||
/**
|
||||
* @brief Check a TPM response for errors.
|
||||
* @param [in] *response_buf TPM response. Must have at least a size of TPM_CMD_HEADER_SIZE bytes.
|
||||
* @return Returns the TPM return code extracted from the given TPM response or one of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval buf_to_uint64 All error codes from buf_to_uint64.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int return_error_handling(uint8_t *response_buf);
|
||||
|
||||
/**
|
||||
* @brief Transmit TPM command to /dev/tpm0 and get the response.
|
||||
* @param [in] *buf TPM request.
|
||||
* @param [in] length TPM request length.
|
||||
* @param [out] *response TPM response.
|
||||
* @param [out] *resp_length TPM response length.
|
||||
* @return One of the listed return codes or the error code stored in the global errno system variable.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int tpmtool_transmit(const uint8_t *buf, ssize_t length, uint8_t *response, ssize_t *resp_length);
|
||||
|
||||
/**
|
||||
* @brief Print the capability flags.
|
||||
* @param [in] *response_buf TPM response.
|
||||
* @param [in] cap_selector Type of capabilities to print.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval buf_to_uint64 All error codes from buf_to_uint64.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int print_capability_flags(uint8_t *response_buf, uint8_t cap_selector);
|
||||
|
||||
/**
|
||||
* @brief Print the clock info.
|
||||
* @param [in] *response_buf TPM response.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval buf_to_uint64 All error codes from buf_to_uint64.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int print_clock_info(uint8_t *response_buf);
|
||||
|
||||
/**
|
||||
* @brief Create the get_random command.
|
||||
* @param [in] *data_length_string User input string for random data length.
|
||||
* @param [out] *response_buf Return buffer for the complete command.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval ERR_BAD_CMD In case of bad user input.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int get_random(char *data_length_string, uint8_t *response_buf);
|
||||
|
||||
/**
|
||||
* @brief Create the simple hash command.
|
||||
* @param [in] *data_string User input string of data to be hashed.
|
||||
* @param [in] hash_algo Set to ALG_SHA1 for hashing with SHA-1,
|
||||
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
|
||||
* @param [out] *hash_cmd_buf Return buffer for the complete command.
|
||||
* @param [in] hash_cmd_buf_size Return buffer size.
|
||||
* @return One of the listed return codes.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @retval int_to_bytearray All error codes from int_to_bytearray.
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int create_hash(char *data_string, hash_algo_enum hash_algo, uint8_t *hash_cmd_buf, uint32_t hash_cmd_buf_size);
|
||||
|
||||
/**
|
||||
* @brief Create and transmit a sequence of TPM commands for hashing larger amounts of data.
|
||||
* @param [in] *data_string User input string of data to be hashed.
|
||||
* @param [in] hash_algo Set to ALG_SHA1 for hashing with SHA-1,
|
||||
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
|
||||
* @param [out] *tpm_response_buf TPM response.
|
||||
* @param [out] *tpm_response_buf_size Size of tpm_response_buf.
|
||||
* @return One of the listed return codes or the error code stored in the global errno system variable.
|
||||
* @retval EINVAL In case of a NULL pointer.
|
||||
* @retval EXIT_SUCCESS In case of success.
|
||||
* @retval value of errno In case of memory allocation error.
|
||||
* @retval buf_to_uint64 All error codes from buf_to_uint64.
|
||||
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
|
||||
* @retval int_to_bytearray All error codes from int_to_bytearray.
|
||||
* @retval tpmtool_transmit All error codes from tpmtool_transmit.
|
||||
* @retval print_response_buf All error codes from print_response_buf
|
||||
* @date 2014/06/26
|
||||
*/
|
||||
static int create_hash_sequence(char *data_string, hash_algo_enum hash_algo, uint8_t *tpm_response_buf, ssize_t *tpm_response_buf_size);
|
||||
|
||||
//-------------"command bytes"-------------
|
||||
static const uint8_t tpm2_startup_clear[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0C, // commandSize
|
||||
0x00, 0x00, 0x01, 0x44, // TPM_CC_Startup
|
||||
0x00, 0x00 // TPM_SU_CLEAR
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_startup_state[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0C, // commandSize
|
||||
0x00, 0x00, 0x01, 0x44, // TPM_CC_Startup
|
||||
0x00, 0x01 // TPM_SU_STATE
|
||||
};
|
||||
|
||||
static const uint8_t tpm_cc_shutdown_clear[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0C, // commandSize
|
||||
0x00, 0x00, 0x01, 0x45, // TPM_CC_Shutdown
|
||||
0x00, 0x00 // TPM_SU_CLEAR
|
||||
};
|
||||
|
||||
static const uint8_t tpm_cc_shutdown_state[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0C, // commandSize
|
||||
0x00, 0x00, 0x01, 0x45, // TPM_CC_Shutdown
|
||||
0x00, 0x01 // TPM_SU_STATE
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_self_test[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0B, // commandSize
|
||||
0x00, 0x00, 0x01, 0x43, // TPM_CC_SelfTest
|
||||
0x00 // fullTest=No
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_self_test_full[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0B, // commandSize
|
||||
0x00, 0x00, 0x01, 0x43, // TPM_CC_SelfTest
|
||||
0x01 // fullTest=Yes
|
||||
};
|
||||
|
||||
static const uint8_t tpm_cc_get_test_result[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0A, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7C // TPM_CC_GetTestResult
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_self_test_incremental[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x2A, // commandSize
|
||||
0x00, 0x00, 0x01, 0x42, // TPM_CC_IncrementalSelfTest
|
||||
0x00, 0x00, 0x00, 0x0E, // Count of Algorithm
|
||||
0x00, 0x01, 0x00, 0x04, // Algorithm two per line
|
||||
0x00, 0x05, 0x00, 0x06,
|
||||
0x00, 0x08, 0x00, 0x0A,
|
||||
0x00, 0x0B, 0x00, 0x14,
|
||||
0x00, 0x15, 0x00, 0x16,
|
||||
0x00, 0x17, 0x00, 0x22,
|
||||
0x00, 0x25, 0x00, 0x43
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_getrandom[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0C, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7B, // TPM_CC_GetRandom
|
||||
0x00, 0x00 // bytesRequested (will be set later)
|
||||
};
|
||||
|
||||
static const uint8_t tpm_cc_readclock[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0A, // commandSize
|
||||
0x00, 0x00, 0x01, 0x81 // TPM_CC_ReadClock
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_getcapability_fixed[] ={
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x16, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7A, // TPM_CC_GetCapability
|
||||
0x00, 0x00, 0x00, 0x06, // TPM_CAP_TPM_PROPERTIES (Property Type: TPM_PT)
|
||||
0x00, 0x00, 0x01, 0x00, // Property: TPM_PT_FAMILY_INDICATOR: PT_GROUP * 1 + 0
|
||||
0x00, 0x00, 0x00, 0x66 // PropertyCount 102 (from 100 - 201)
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_getcapability_var[] ={
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x16, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7A, // TPM_CC_GetCapability
|
||||
0x00, 0x00, 0x00, 0x06, // TPM_CAP_TPM_PROPERTIES (Property Type: TPM_PT)
|
||||
0x00, 0x00, 0x02, 0x00, // Property: TPM_PT_FAMILY_INDICATOR: PT_GROUP * 2 + 0
|
||||
0x00, 0x00, 0x00, 0x02 // PropertyCount 02 (from 200 - 201)
|
||||
};
|
||||
|
||||
// Hash
|
||||
static const uint8_t tpm2_hash[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0e, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7D, // TPM_CC_Hash
|
||||
0x00, 0x00, // size (will be set later)
|
||||
// buffer (will be added later)
|
||||
0x00, 0x00, // hashAlg (will be added later)
|
||||
0x00, 0x00, 0x00, 0x00 // hierarchy of the ticket (TPM_RH_NULL; will be added later)
|
||||
};
|
||||
|
||||
// HashSequence
|
||||
static uint8_t tpm2_hash_sequence_start[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x0e, // commandSize
|
||||
0x00, 0x00, 0x01, 0x86, // TPM_CC_HashSequenceStart
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x00 // hashAlg (will be set later)
|
||||
};
|
||||
|
||||
static uint8_t tpm2_sequence_update[] = {
|
||||
0x80, 0x02, // TPM_ST_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x00, // commandSize (will be set later)
|
||||
0x00, 0x00, 0x01, 0x5c, // TPM_CC_SequenceUpdate
|
||||
0x00, 0x00, 0x00, 0x00, // sequenceHandle (will be set later)
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x09, // authSize (password authorization session)
|
||||
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
|
||||
0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00 // size (will be set later)
|
||||
// buffer (will be added later)
|
||||
};
|
||||
|
||||
static uint8_t tpm2_sequence_complete[] = {
|
||||
0x80, 0x02, // TPM_ST_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x21, // commandSize
|
||||
0x00, 0x00, 0x01, 0x3e, // TPM_CC_SequenceComplete
|
||||
0x00, 0x00, 0x00, 0x00, // sequenceHandle (will be set later)
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x09, // authSize (password authorization session)
|
||||
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
|
||||
0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, // size (NULL buffer)
|
||||
// null (indicate an empty buffer buffer)
|
||||
0x40, 0x00, 0x00, 0x07 // hierarchy of the ticket (TPM_RH_NULL)
|
||||
};
|
||||
|
||||
static const uint8_t sha1_alg[] = {
|
||||
0x00, 0x04 // command for sha1 alg
|
||||
};
|
||||
|
||||
static const uint8_t sha256_alg[] = {
|
||||
0x00, 0x0B // command for sha256 alg
|
||||
};
|
||||
|
||||
static const uint8_t sha384_alg[] = {
|
||||
0x00, 0x0C // command for sha384 alg
|
||||
};
|
||||
|
||||
static const uint8_t tpm_cc_hash_hierarchy[] = {
|
||||
0x40, 0x00, 0x00, 0x07 // hierarchy of the ticket (TPM_RH_NULL)
|
||||
};
|
||||
|
||||
//PCR_Command
|
||||
static const uint8_t tpm2_pcr_allocate[] = {
|
||||
0x80, 0x02, // TPM_ST_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x31, // commandSize
|
||||
0x00, 0x00, 0x01, 0x2B, // TPM_CC_PCR_Allocate
|
||||
0x40, 0x00, 0x00, 0x0C, // TPM_RH_PLATFORM
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x09, // authSize (password authorization session)
|
||||
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
|
||||
0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, // count (TPML_PCR_SELECTION)
|
||||
0x00, 0x04, // hash (TPMS_PCR_SELECTION; SHA-1)
|
||||
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
|
||||
0x00, 0x00, 0x00, // pcrSelect (TPMS_PCR_SELECTION; will be set later)
|
||||
0x00, 0x0B, // hash (TPMS_PCR_SELECTION; SHA-256)
|
||||
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
|
||||
0x00, 0x00, 0x00, // pcrSelect (TPMS_PCR_SELECTION; will be set later)
|
||||
0x00, 0x0C, // hash (TPMS_PCR_SELECTION; SHA-384)
|
||||
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
|
||||
0x00, 0x00, 0x00 // pcrSelect (TPMS_PCR_SELECTION; will be set later)
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_pcr_read[] = {
|
||||
0x80, 0x01, // TPM_ST_NO_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x14, // commandSize
|
||||
0x00, 0x00, 0x01, 0x7E, // TPM_CC_PCR_Read
|
||||
0x00, 0x00, 0x00, 0x01, // count (TPML_PCR_SELECTION)
|
||||
0x00, 0x00, // hash (TPMS_PCR_SELECTION; will be set later)
|
||||
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
|
||||
0x00, 0x00, 0x00 // pcrSelect (TPMS_PCR_SELECTION)
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_pcr_extend[] = {
|
||||
0x80, 0x02, // TPM_ST_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x00, // commandSize (will be set later)
|
||||
0x00, 0x00, 0x01, 0x82, // TPM_CC_PCR_Extend
|
||||
0x00, 0x00, 0x00, 0x00, // {PCR_FIRST:PCR_LAST} (TPMI_DH_PCR)
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x09, // authSize (password authorization session)
|
||||
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
|
||||
0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, // count (TPML_DIGEST_VALUES)
|
||||
0x00, 0x00 // hashAlg (TPMT_HA; will be set later)
|
||||
// digest (TPMT_HA; will be added later)
|
||||
};
|
||||
|
||||
static const uint8_t tpm2_pcr_reset[] = {
|
||||
0x80, 0x02, // TPM_ST_SESSIONS
|
||||
0x00, 0x00, 0x00, 0x1B, // commandSize
|
||||
0x00, 0x00, 0x01, 0x3D, // TPM_CC_PCR_Reset
|
||||
0x00, 0x00, 0x00, 0x00, // {PCR_FIRST:PCR_LAST} (TPMI_DH_PCR)
|
||||
0x00, 0x00, // authSize (NULL Password)
|
||||
// null (indicate a NULL Password)
|
||||
0x00, 0x09, // authSize (password authorization session)
|
||||
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
|
||||
0x00, 0x00, 0x01, 0x00, 0x00
|
||||
};
|
||||
|
||||
#endif /* _ELTT2_H_ */
|
||||
@@ -1,701 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath10k-ct-firmware
|
||||
PKG_VERSION:=2020-10-07
|
||||
PKG_RELEASE:=2
|
||||
CTVER1=021
|
||||
CTVER2=021
|
||||
|
||||
# From fw_lede.bash, or can do it manually as well.
|
||||
H988XFC=a4c3d1e2fb80f6b8b9738c7189795ab9505e6c09efc12ba5f08ee7f49e934239
|
||||
H988XFCH=93108bd0870652860cdb57749f5a12205ecb15bb1f129d916ad73b6f06406c82
|
||||
H9887FC=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b
|
||||
H9887FCH=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098
|
||||
H9980FC=52300e9d128c3d506e0b133d7a7964df3115f9511f1b574ef2a0767972c063bd
|
||||
H9980FCH=9c20c3a44b701f8fef0fe02f156e382b36b717fb56c76d540f6eac2077ec189b
|
||||
H9980CH=55f27045e7cf87a6a5656a050771d6d7a6197153a0737288a702c0836d5c6572
|
||||
H9980FHQ=add509b2a15ba90869f403c2e4440dbb91bd7037188d8468249cf1263adfd44e
|
||||
H9984FC=e6354a1547a308b4b0fe4cbc29693848c234acedd9e7a483a1b4fb5f9bbf0dc0
|
||||
H9984FCH=6e19ecd0b001ffb594a8b033deb2007595b8c0402402789b7de55b208639ebec
|
||||
H9984CH=7b6fdf3d970f3eff7c34df476c934a9bebb4f289b7968067950d31b82c71bb07
|
||||
H9984FHQ=f6a5d5a3a7b2c9267dc31673a19ee3b5312a2f84f26123cb5e8c000428ed76d2
|
||||
H4019FC=cde992cb328680e81cf85e195554699bcceef065c0c696ce4ef90c3311ab11fb
|
||||
H4019FCH=818afeb1226389357dfde754d641f936fb82ebe78607f10e15efd5c952a54f48
|
||||
H4019CH=30ba10f0d82116c6617cb58c3df5cc81e5ed8f29dbc8f95c0ca9c5013ce4f702
|
||||
H4019FHQ=8e4161f7bed5bd56513ca5caab582a6eee64e9e14a69f4de67587563b7b4d735
|
||||
H9888FC=d24e66bdb2f1098a2e06ff20fe037e31937e1a483e87c68827830513b4233b5d
|
||||
H9888FCH=5891e1c184da433ecc12ca0176ca89a77f7bc2b675576698b69bc93d46b77042
|
||||
H9888CH=b94f46cdda6171e5f566b1cdd6aafd68ff1a4f7e8a27762b90eb5d4f03839d99
|
||||
H9888FHQ=3cc81f8707bf5ba63bc9ffc14578c77637cae0e15766ae146af02eefb9ab7bfd
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ATH10K_FIRMWARE_REV:=d622d160e9f552ead68d9ae81b715422892dc2ef
|
||||
ATH10K_FIRMWARE_URL:=@GITHUB/kvalo/ath10k-firmware/$(ATH10K_FIRMWARE_REV)
|
||||
|
||||
QCA9887_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9887-board.bin
|
||||
define Download/qca9887-board
|
||||
FILE:=$(QCA9887_BOARD_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA9887/hw1.0
|
||||
URL_FILE:=board.bin
|
||||
HASH:=cf4df099f6ee05c181f55ce17297a1d32c61d725eb96246fd315ad5587c42426
|
||||
endef
|
||||
$(eval $(call Download,qca9887-board))
|
||||
|
||||
QCA988X_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca988x-board.bin
|
||||
define Download/qca988x-board
|
||||
FILE:=$(QCA988X_BOARD_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA988X/hw2.0
|
||||
URL_FILE:=board.bin
|
||||
HASH:=5b5b380333c2dd3b6ce67f30e2f7008f4020bf594970d3b464fd8d4a80fcd880
|
||||
endef
|
||||
$(eval $(call Download,qca988x-board))
|
||||
|
||||
QCA99X0_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca99x0-board.bin
|
||||
define Download/qca99x0-board
|
||||
FILE:=$(QCA99X0_BOARD_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA99X0/hw2.0
|
||||
URL_FILE:=boardData_AR900B_CUS239_5G_v2_001.bin
|
||||
HASH:=3bf7561ee373b369025dcd366d276d038a97d3397ccae41ce841d98a58b30aff
|
||||
endef
|
||||
$(eval $(call Download,qca99x0-board))
|
||||
|
||||
QCA99X0_BOARD2_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
|
||||
QCA99X0_BOARD2_FILE:=ath10k-firmware-$(QCA99X0_BOARD2_REV)-qca99x0-board-2.bin
|
||||
define Download/qca99x0-board2
|
||||
FILE:=$(QCA99X0_BOARD2_FILE)
|
||||
URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
|
||||
URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD2_REV)
|
||||
HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401
|
||||
endef
|
||||
$(eval $(call Download,qca99x0-board2))
|
||||
|
||||
QCA9984_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9984-board-2.bin
|
||||
define Download/qca9984-board2
|
||||
FILE:=$(QCA9984_BOARD2_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA9984/hw1.0
|
||||
URL_FILE:=board-2.bin
|
||||
HASH:=0d6d46cf0467185e3959ce3cb69e2415be6e48ab8a4bee3eb400edbe48cb9c25
|
||||
endef
|
||||
$(eval $(call Download,qca9984-board2))
|
||||
|
||||
QCA4019_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca4019-board-2.bin
|
||||
define Download/qca4019-board2
|
||||
FILE:=$(QCA4019_BOARD2_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA4019/hw1.0
|
||||
URL_FILE:=board-2.bin
|
||||
HASH:=94b66aa4ddbed5110a96364d3c7b4ebcb320e3ac4e8697660b277e76077bc338
|
||||
endef
|
||||
$(eval $(call Download,qca4019-board2))
|
||||
|
||||
QCA9888_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9888-board-2.bin
|
||||
define Download/qca9888-board2
|
||||
FILE:=$(QCA9888_BOARD2_FILE)
|
||||
URL:=$(ATH10K_FIRMWARE_URL)/QCA9888/hw2.0
|
||||
URL_FILE:=board-2.bin
|
||||
HASH:=5b871bb567f64525ca45adb88063211de472015d09e0f9aa3fa61ab71c8fdfd3
|
||||
endef
|
||||
$(eval $(call Download,qca9888-board2))
|
||||
|
||||
CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
|
||||
CT_FIRMWARE_FILE_FULL_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
|
||||
CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
|
||||
|
||||
define Download/ct-firmware
|
||||
URL:=https://www.candelatech.com/downloads/$(2)
|
||||
FILE:=$(call CT_FIRMWARE_FILE,$(1))
|
||||
URL_FILE:=$($(1)_FIRMWARE_FILE_CT)
|
||||
endef
|
||||
|
||||
define Download/ct-firmware-full-htt
|
||||
URL:=https://www.candelatech.com/downloads/$(2)
|
||||
FILE:=$(call CT_FIRMWARE_FILE_FULL_HTT,$(1))
|
||||
URL_FILE:=$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
|
||||
endef
|
||||
|
||||
define Download/ct-firmware-htt
|
||||
URL:=https://www.candelatech.com/downloads/$(2)
|
||||
FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
|
||||
URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
|
||||
endef
|
||||
|
||||
QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.$(CTVER1)
|
||||
define Download/ath10k-firmware-qca988x-ct
|
||||
$(call Download/ct-firmware,QCA988X,)
|
||||
HASH:=$(H988XFC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca988x-ct))
|
||||
|
||||
QCA988X_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.$(CTVER1)
|
||||
define Download/ath10k-firmware-qca988x-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA988X,)
|
||||
HASH:=$(H988XFCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca988x-ct-full-htt))
|
||||
|
||||
|
||||
QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.$(CTVER1)
|
||||
define Download/ath10k-firmware-qca9887-ct
|
||||
$(call Download/ct-firmware,QCA9887,ath10k-9887)
|
||||
HASH:=$(H9887FC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9887-ct))
|
||||
|
||||
QCA9887_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.$(CTVER1)
|
||||
define Download/ath10k-firmware-qca9887-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA9887,ath10k-9887)
|
||||
HASH:=$(H9887FCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9887-ct-full-htt))
|
||||
|
||||
|
||||
QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca99x0-ct
|
||||
$(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
|
||||
HASH:=$(H9980FC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca99x0-ct))
|
||||
|
||||
QCA99X0_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca99x0-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA99X0,ath10k-10-4b)
|
||||
HASH:=$(H9980FCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt))
|
||||
|
||||
QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca99x0-ct-htt
|
||||
$(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
|
||||
HASH:=$(H9980CH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
|
||||
|
||||
|
||||
QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9984-ct
|
||||
$(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
|
||||
HASH:=$(H9984FC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9984-ct))
|
||||
|
||||
QCA9984_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9984-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA9984,ath10k-9984-10-4b)
|
||||
HASH:=$(H9984FCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt))
|
||||
|
||||
QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9984-ct-htt
|
||||
$(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
|
||||
HASH:=$(H9984CH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
|
||||
|
||||
|
||||
QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca4019-ct
|
||||
$(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
|
||||
HASH:=$(H4019FC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca4019-ct))
|
||||
|
||||
QCA4019_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca4019-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA4019,ath10k-4019-10-4b)
|
||||
HASH:=$(H4019FCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt))
|
||||
|
||||
QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca4019-ct-htt
|
||||
$(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
|
||||
HASH:=$(H4019CH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
|
||||
|
||||
|
||||
QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9888-ct
|
||||
$(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
|
||||
HASH:=$(H9888FC)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9888-ct))
|
||||
|
||||
QCA9888_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9888-ct-full-htt
|
||||
$(call Download/ct-firmware-full-htt,QCA9888,ath10k-9888-10-4b)
|
||||
HASH:=$(H9888FCH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt))
|
||||
|
||||
QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2)
|
||||
define Download/ath10k-firmware-qca9888-ct-htt
|
||||
$(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
|
||||
HASH:=$(H9888CH)
|
||||
endef
|
||||
$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
|
||||
|
||||
|
||||
define Package/ath10k-ct-firmware-default
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
URL:=https://www.candelatech.com/ath10k.php
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca988x-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.1 firmware for QCA988x devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca988x
|
||||
endef
|
||||
define Package/ath10k-firmware-qca988x-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.1 full-htt-mgt fw for QCA988x
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca988x
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9887-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.1 firmware for QCA9887 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9887
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9887-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.1 full-htt-mgt fw for QCA9887
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9887
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 firmware for QCA99x0 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca99x0
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA99x0
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca99x0
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-htt
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca99x0
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9984-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 firmware for QCA9984 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9984
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA9984
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9984
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-htt
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9984
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca4019-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 firmware for QCA4018/9
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca4019
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 full-htt-mgt for QCA4018/9
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca4019
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-htt
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca4019
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9888-ct
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 fw for QCA9886/8 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9888
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-full-htt
|
||||
$(Package/ath10k-ct-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA9886/8
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9888
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-htt
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
PROVIDES:=ath10k-firmware-qca9888
|
||||
DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
|
||||
endef
|
||||
|
||||
|
||||
define Package/ath10k-firmware-qca9887-ct/description
|
||||
Alternative ath10k firmware for QCA9887 from Candela Technologies.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.1.php
|
||||
This firmware conflicts with the standard 9887 firmware, so select only
|
||||
one.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9887-ct-full-htt/description
|
||||
Alternative ath10k firmware for QCA9887 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and fixes .11r authentication.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.1.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca988x-ct/description
|
||||
Alternative ath10k firmware for QCA988X from Candela Technologies.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.1.php
|
||||
This firmware will NOT be used unless the standard ath10k-firmware-qca988x
|
||||
is un-selected since the driver will try to load firmware-5.bin before
|
||||
firmware-2.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca988x-ct-full-htt/description
|
||||
Alternative ath10k firmware for QCA988X from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and fixes .11r authentication.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.1.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0-ct/description
|
||||
Alternative ath10k firmware for QCA99x0 from Candela Technologies.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware conflicts with the standard 99x0 firmware, so select only
|
||||
one.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-full-htt/description
|
||||
Alternative ath10k firmware for QCA99x0 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-htt/description
|
||||
Alternative ath10k firmware for QCA99x0 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
This firmware lacks a lot of features that ath10k does not use, saving
|
||||
a lot of resources.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9984-ct/description
|
||||
Alternative ath10k firmware for QCA9984 from Candela Technologies.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware conflicts with the standard 9984 firmware, so select only
|
||||
one.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-full-htt/description
|
||||
Alternative ath10k firmware for QCA9984 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-htt/description
|
||||
Alternative ath10k firmware for QCA9984 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
This firmware lacks a lot of features that ath10k does not use, saving
|
||||
a lot of resources.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca4019-ct/description
|
||||
Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
|
||||
Enables IBSS and other features. Works with standard or ath10k-ct driver.
|
||||
See: http://www.candelatech.com/ath10k-10.4.php
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-full-htt/description
|
||||
Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
Enables IBSS and other features.
|
||||
See: http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-htt/description
|
||||
Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
This firmware lacks a lot of features that ath10k does not use, saving
|
||||
a lot of resources.
|
||||
Enables IBSS and other features.
|
||||
See: http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9888-ct/description
|
||||
Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware conflicts with the standard 9886 and 9888 firmware, so select only
|
||||
one.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-full-htt/description
|
||||
Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-htt/description
|
||||
Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
|
||||
Uses normal HTT TX data path for management frames, which improves
|
||||
stability in busy networks and may be required for .11r authentication.
|
||||
This firmware lacks a lot of features that ath10k does not use, saving
|
||||
a lot of resources.
|
||||
Enables IBSS and other features. See:
|
||||
http://www.candelatech.com/ath10k-10.4.php
|
||||
This firmware selects and requires the ath10k-ct driver.
|
||||
endef
|
||||
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
|
||||
define Package/ath10k-firmware-qca9887-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9887) \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9887_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9887-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9887) \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/ct-firmware-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9887_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca988x-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA988X_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA988X) \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca988x-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA988X_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA988X) \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/ct-firmware-2.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA99X0) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA99X0) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca99x0-ct-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9984-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9984) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9984) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9984-ct-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca4019-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA4019) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA4019) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca4019-ct-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9888-ct/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
|
||||
ln -s \
|
||||
../../cal-pci-0000:01:00.0.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9888) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-full-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
|
||||
ln -s \
|
||||
../../cal-pci-0000:01:00.0.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9888) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
|
||||
endef
|
||||
define Package/ath10k-firmware-qca9888-ct-htt/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
|
||||
ln -s \
|
||||
../../cal-pci-0000:01:00.0.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-full-htt))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
|
||||
@@ -1,122 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath10k-ct
|
||||
PKG_RELEASE=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
|
||||
PKG_MIRROR_HASH:=37b4f00231cb0ae00f63da1c94ae53c940c76d047ce0fb081c08a35fffbfd2c0
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-05-22b
|
||||
PKG_SOURCE_VERSION:=54a9ac02f1139596ea4361ebbc3e444955d86cfd
|
||||
#PKG_MIRROR_HASH:=97cf22a4a57381c7eb7a9b8a8b1e347e9711ce51c89db971b4ab9a35af476ece
|
||||
|
||||
# Build the 5.4 ath10k-ct driver version. Other option is "-4.19".
|
||||
# Probably this should match as closely as
|
||||
# possible to whatever mac80211 backports version is being used.
|
||||
CT_KVER="-5.7"
|
||||
|
||||
PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_EXTMOD_SUBDIRS:=ath10k$(CT_KVER)
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/ath10k-ct
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=ath10k-ct driver optimized for CT ath10k firmware
|
||||
DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core
|
||||
FILES:=\
|
||||
$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \
|
||||
$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko
|
||||
AUTOLOAD:=$(call AutoProbe,ath10k_pci)
|
||||
PROVIDES:=kmod-ath10k
|
||||
VARIANT:=regular
|
||||
endef
|
||||
|
||||
define KernelPackage/ath10k-ct/config
|
||||
|
||||
config ATH10K-CT_LEDS
|
||||
bool "Enable LED support"
|
||||
default y
|
||||
depends on PACKAGE_kmod-ath10k-ct || PACKAGE_kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
|
||||
define KernelPackage/ath10k-ct-smallbuffers
|
||||
$(call KernelPackage/ath10k-ct)
|
||||
TITLE+= (small buffers for low-RAM devices)
|
||||
VARIANT:=smallbuffers
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h
|
||||
|
||||
ifdef CONFIG_PACKAGE_MAC80211_MESH
|
||||
NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
|
||||
endif
|
||||
|
||||
CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m CONFIG_ATH10K_CE=y
|
||||
|
||||
# This AHB logic is needed for IPQ4019 radios
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_AHB=m
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
|
||||
|
||||
NOSTDINC_FLAGS += -DSTANDALONE_CT
|
||||
|
||||
ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_DEBUG
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_DFS
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_SPECTRAL
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ATH10K-CT_LEDS),y)
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_LEDS=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_LEDS
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),smallbuffers)
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_SMALLBUFFERS
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||
CT_MAKEDEFS += V=1
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/ath10k$(CT_KVER)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,ath10k-ct))
|
||||
$(eval $(call KernelPackage,ath10k-ct-smallbuffers))
|
||||
@@ -1,37 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Tue, 26 Feb 2019 08:06:35 +0100
|
||||
Subject: ath10k-ct: apply mac80211 rates to ath10k-ct rate state
|
||||
|
||||
The rates from mac80211 have to be copied to the state of ath10k-ct or
|
||||
otherwise the ath10k_check_apply_special_rates function overwrites
|
||||
them again with some default values. This breaks for example the
|
||||
mcast_rate set for a wifi-iface.
|
||||
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
|
||||
--- a/ath10k-5.4/mac.c
|
||||
+++ b/ath10k-5.4/mac.c
|
||||
@@ -6793,6 +6793,7 @@ static void ath10k_bss_info_changed(stru
|
||||
"mac vdev %d mcast_rate %x\n",
|
||||
arvif->vdev_id, rate);
|
||||
|
||||
+ arvif->mcast_rate[band] = rate;
|
||||
vdev_param = ar->wmi.vdev_param->mcast_data_rate;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
vdev_param, rate);
|
||||
@@ -6801,6 +6802,7 @@ static void ath10k_bss_info_changed(stru
|
||||
"failed to set mcast rate on vdev %i: %d\n",
|
||||
arvif->vdev_id, ret);
|
||||
|
||||
+ arvif->bcast_rate[band] = rate;
|
||||
vdev_param = ar->wmi.vdev_param->bcast_data_rate;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
vdev_param, rate);
|
||||
@@ -6827,6 +6829,7 @@ static void ath10k_bss_info_changed(stru
|
||||
return;
|
||||
}
|
||||
|
||||
+ arvif->mgt_rate[def.chan->band] = hw_rate_code;
|
||||
vdev_param = ar->wmi.vdev_param->mgmt_rate;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
hw_rate_code);
|
||||
@@ -1,598 +0,0 @@
|
||||
From: Sebastian Gottschall <s.gottschall@newmedia-net.de>
|
||||
|
||||
Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based
|
||||
chipsets with on chipset connected led's using WMI Firmware API. The LED
|
||||
device will get available named as "ath10k-phyX" at sysfs and can be controlled
|
||||
with various triggers. adds also debugfs interface for gpio control.
|
||||
|
||||
This patch is specific for OpenWRt base, as is use old backported package
|
||||
with old wireless source. Support for QCA9984 is removed.
|
||||
Reworked to use ath10k-ct custom source
|
||||
|
||||
|
||||
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
|
||||
Reviewed-by: Steve deRosier <derosier@cal-sierra.com>
|
||||
[kvalo: major reorg and cleanup]
|
||||
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
---
|
||||
|
||||
v13:
|
||||
|
||||
* only compile tested!
|
||||
|
||||
* fix all checkpatch warnings
|
||||
|
||||
* fix commit log
|
||||
|
||||
* sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio)
|
||||
|
||||
* unsigned -> unsigned int
|
||||
|
||||
* remove GPIOLIB code, that should be added in a separate patch
|
||||
|
||||
* rename gpio.c to leds.c
|
||||
|
||||
* add leds.h
|
||||
|
||||
* rename some functions:
|
||||
|
||||
ath10k_attach_led() -> ath10k_leds_register()
|
||||
ath10k_unregister_led() -> ath10k_leds_unregister()
|
||||
ath10k_reset_led_pin() -> ath10k_leds_start()
|
||||
|
||||
* call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering
|
||||
|
||||
* call ath10k_leds_start() only from ath10k_core_start() and not from mac.c
|
||||
|
||||
* rename struct ath10k_gpiocontrol as anonymous function under struct
|
||||
ath10k::leds, no need for memory allocation
|
||||
|
||||
* merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller
|
||||
|
||||
* remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it
|
||||
|
||||
* Kconfig help text improvement and move it lower in the menu, also don't enable it by default
|
||||
|
||||
* switch to set_brightness_blocking() so that the callback can sleep,
|
||||
then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex
|
||||
to access ar->state
|
||||
|
||||
* don't touch ath10k_wmi_pdev_get_temperature()
|
||||
|
||||
* as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface
|
||||
|
||||
* remove debugfs interface, that should be added in another patch
|
||||
|
||||
* cleanup includes
|
||||
|
||||
ath10k-5.4/Kconfig | 10 +++
|
||||
ath10k-5.4/Makefile | 1 +
|
||||
ath10k-5.4/core.c | 22 +++++++
|
||||
ath10k-5.4/core.h | 9 ++-
|
||||
ath10k-5.4/hw.h | 1 +
|
||||
ath10k-5.4/leds.c | 103 ++++++++++++++++++++++++++++++
|
||||
ath10k-5.4/leds.h | 45 +++++++++++++
|
||||
ath10k-5.4/mac.c | 1 +
|
||||
ath10k-5.4/wmi-ops.h | 32 ++++++++++
|
||||
ath10k-5.4/wmi-tlv.c | 2 +
|
||||
ath10k-5.4/wmi.c | 54 ++++++++++++++++
|
||||
ath10k-5.4/wmi.h | 35 ++++++++++
|
||||
12 files changed, 314 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ath10k-5.4/leds.c
|
||||
create mode 100644 ath10k-5.4/leds.h
|
||||
|
||||
--- a/ath10k-5.4/Kconfig
|
||||
+++ b/ath10k-5.4/Kconfig
|
||||
@@ -66,6 +66,16 @@ config ATH10K_DEBUGFS
|
||||
|
||||
If unsure, say Y to make it easier to debug problems.
|
||||
|
||||
+config ATH10K_LEDS
|
||||
+ bool "Atheros ath10k LED support"
|
||||
+ depends on ATH10K
|
||||
+ select MAC80211_LEDS
|
||||
+ select LEDS_CLASS
|
||||
+ select NEW_LEDS
|
||||
+ default y
|
||||
+ ---help---
|
||||
+ This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N.
|
||||
+
|
||||
config ATH10K_SPECTRAL
|
||||
bool "Atheros ath10k spectral scan support"
|
||||
depends on ATH10K_DEBUGFS
|
||||
--- a/ath10k-5.4/Makefile
|
||||
+++ b/ath10k-5.4/Makefile
|
||||
@@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) +=
|
||||
ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
|
||||
ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
|
||||
ath10k_core-$(CONFIG_THERMAL) += thermal.o
|
||||
+ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o
|
||||
ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
|
||||
ath10k_core-$(CONFIG_PM) += wow.o
|
||||
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
|
||||
--- a/ath10k-5.4/core.c
|
||||
+++ b/ath10k-5.4/core.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "testmode.h"
|
||||
#include "wmi-ops.h"
|
||||
#include "coredump.h"
|
||||
+#include "leds.h"
|
||||
|
||||
/* Disable ath10k-ct DBGLOG output by default */
|
||||
unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG;
|
||||
@@ -67,6 +68,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA988X_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca988x hw2.0",
|
||||
+ .led_pin = 1,
|
||||
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
|
||||
@@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA9887_1_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca9887 hw1.0",
|
||||
+ .led_pin = 1,
|
||||
.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
|
||||
@@ -344,6 +347,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA99X0_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca99x0 hw2.0",
|
||||
+ .led_pin = 17,
|
||||
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.otp_exe_param = 0x00000700,
|
||||
@@ -385,6 +389,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA9984_1_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca9984/qca9994 hw1.0",
|
||||
+ .led_pin = 17,
|
||||
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
|
||||
@@ -433,6 +438,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA9888_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca9888 hw2.0",
|
||||
+ .led_pin = 17,
|
||||
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
|
||||
@@ -3573,6 +3579,10 @@ int ath10k_core_start(struct ath10k *ar,
|
||||
ath10k_wmi_check_apply_board_power_ctl_table(ar);
|
||||
}
|
||||
|
||||
+ status = ath10k_leds_start(ar);
|
||||
+ if (status)
|
||||
+ goto err_hif_stop;
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_hif_stop:
|
||||
@@ -3829,9 +3839,18 @@ static void ath10k_core_register_work(st
|
||||
goto err_spectral_destroy;
|
||||
}
|
||||
|
||||
+ status = ath10k_leds_register(ar);
|
||||
+ if (status) {
|
||||
+ ath10k_err(ar, "could not register leds: %d\n",
|
||||
+ status);
|
||||
+ goto err_thermal_unregister;
|
||||
+ }
|
||||
+
|
||||
set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags);
|
||||
return;
|
||||
|
||||
+err_thermal_unregister:
|
||||
+ ath10k_thermal_unregister(ar);
|
||||
err_spectral_destroy:
|
||||
ath10k_spectral_destroy(ar);
|
||||
err_debug_destroy:
|
||||
@@ -3891,6 +3910,8 @@ void ath10k_core_unregister(struct ath10
|
||||
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
|
||||
return;
|
||||
|
||||
+ ath10k_leds_unregister(ar);
|
||||
+
|
||||
ath10k_thermal_unregister(ar);
|
||||
/* Stop spectral before unregistering from mac80211 to remove the
|
||||
* relayfs debugfs file cleanly. Otherwise the parent debugfs tree
|
||||
--- a/ath10k-5.4/core.h
|
||||
+++ b/ath10k-5.4/core.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <linux/time.h>
|
||||
+#include <linux/leds.h>
|
||||
|
||||
#include "htt.h"
|
||||
#include "htc.h"
|
||||
@@ -1469,6 +1470,13 @@ struct ath10k {
|
||||
} testmode;
|
||||
|
||||
struct {
|
||||
+ struct gpio_led wifi_led;
|
||||
+ struct led_classdev cdev;
|
||||
+ char label[48];
|
||||
+ u32 gpio_state_pin;
|
||||
+ } leds;
|
||||
+
|
||||
+ struct {
|
||||
/* protected by data_lock */
|
||||
u32 fw_crash_counter;
|
||||
u32 fw_warm_reset_counter;
|
||||
--- a/ath10k-5.4/hw.h
|
||||
+++ b/ath10k-5.4/hw.h
|
||||
@@ -518,6 +518,7 @@ struct ath10k_hw_params {
|
||||
const char *name;
|
||||
u32 patch_load_addr;
|
||||
int uart_pin;
|
||||
+ int led_pin;
|
||||
u32 otp_exe_param;
|
||||
|
||||
/* Type of hw cycle counter wraparound logic, for more info
|
||||
--- /dev/null
|
||||
+++ b/ath10k-5.4/leds.c
|
||||
@@ -0,0 +1,103 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2005-2011 Atheros Communications Inc.
|
||||
+ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
|
||||
+ * Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com>
|
||||
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
+ *
|
||||
+ * Permission to use, copy, modify, and/or distribute this software for any
|
||||
+ * purpose with or without fee is hereby granted, provided that the above
|
||||
+ * copyright notice and this permission notice appear in all copies.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/leds.h>
|
||||
+
|
||||
+#include "core.h"
|
||||
+#include "wmi.h"
|
||||
+#include "wmi-ops.h"
|
||||
+
|
||||
+#include "leds.h"
|
||||
+
|
||||
+static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev,
|
||||
+ enum led_brightness brightness)
|
||||
+{
|
||||
+ struct ath10k *ar = container_of(led_cdev, struct ath10k,
|
||||
+ leds.cdev);
|
||||
+ struct gpio_led *led = &ar->leds.wifi_led;
|
||||
+
|
||||
+ mutex_lock(&ar->conf_mutex);
|
||||
+
|
||||
+ if (ar->state != ATH10K_STATE_ON)
|
||||
+ goto out;
|
||||
+
|
||||
+ ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low;
|
||||
+ ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin);
|
||||
+
|
||||
+out:
|
||||
+ mutex_unlock(&ar->conf_mutex);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int ath10k_leds_start(struct ath10k *ar)
|
||||
+{
|
||||
+ if (ar->hw_params.led_pin == 0)
|
||||
+ /* leds not supported */
|
||||
+ return 0;
|
||||
+
|
||||
+ /* under some circumstances, the gpio pin gets reconfigured
|
||||
+ * to default state by the firmware, so we need to
|
||||
+ * reconfigure it this behaviour has only ben seen on
|
||||
+ * QCA9984 and QCA99XX devices so far
|
||||
+ */
|
||||
+ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0,
|
||||
+ WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE);
|
||||
+ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int ath10k_leds_register(struct ath10k *ar)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (ar->hw_params.led_pin == 0)
|
||||
+ /* leds not supported */
|
||||
+ return 0;
|
||||
+
|
||||
+ snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s",
|
||||
+ wiphy_name(ar->hw->wiphy));
|
||||
+ ar->leds.wifi_led.active_low = 1;
|
||||
+ ar->leds.wifi_led.gpio = ar->hw_params.led_pin;
|
||||
+ ar->leds.wifi_led.name = ar->leds.label;
|
||||
+ ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
|
||||
+
|
||||
+ ar->leds.cdev.name = ar->leds.label;
|
||||
+ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking;
|
||||
+
|
||||
+ /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */
|
||||
+ ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger;
|
||||
+
|
||||
+ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void ath10k_leds_unregister(struct ath10k *ar)
|
||||
+{
|
||||
+ if (ar->hw_params.led_pin == 0)
|
||||
+ /* leds not supported */
|
||||
+ return;
|
||||
+
|
||||
+ led_classdev_unregister(&ar->leds.cdev);
|
||||
+}
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/ath10k-5.4/leds.h
|
||||
@@ -0,0 +1,41 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
+ *
|
||||
+ * Permission to use, copy, modify, and/or distribute this software for any
|
||||
+ * purpose with or without fee is hereby granted, provided that the above
|
||||
+ * copyright notice and this permission notice appear in all copies.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+ */
|
||||
+#ifndef _LEDS_H_
|
||||
+#define _LEDS_H_
|
||||
+
|
||||
+#include "core.h"
|
||||
+
|
||||
+#ifdef CONFIG_ATH10K_LEDS
|
||||
+void ath10k_leds_unregister(struct ath10k *ar);
|
||||
+int ath10k_leds_start(struct ath10k *ar);
|
||||
+int ath10k_leds_register(struct ath10k *ar);
|
||||
+#else
|
||||
+static inline void ath10k_leds_unregister(struct ath10k *ar)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static inline int ath10k_leds_start(struct ath10k *ar)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline int ath10k_leds_register(struct ath10k *ar)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+#endif /* _LEDS_H_ */
|
||||
--- a/ath10k-5.4/mac.c
|
||||
+++ b/ath10k-5.4/mac.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "wmi-tlv.h"
|
||||
#include "wmi-ops.h"
|
||||
#include "wow.h"
|
||||
+#include "leds.h"
|
||||
|
||||
/*********/
|
||||
/* Rates */
|
||||
--- a/ath10k-5.4/wmi-ops.h
|
||||
+++ b/ath10k-5.4/wmi-ops.h
|
||||
@@ -218,7 +218,10 @@ struct wmi_ops {
|
||||
struct sk_buff *(*gen_bb_timing)
|
||||
(struct ath10k *ar,
|
||||
const struct wmi_bb_timing_cfg_arg *arg);
|
||||
+ struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num,
|
||||
+ u32 input, u32 pull_type, u32 intr_mode);
|
||||
|
||||
+ struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set);
|
||||
};
|
||||
|
||||
int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
|
||||
@@ -1105,6 +1108,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
|
||||
return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
|
||||
}
|
||||
|
||||
+static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num,
|
||||
+ u32 input, u32 pull_type, u32 intr_mode)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ if (!ar->wmi.ops->gen_gpio_config)
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode);
|
||||
+ if (IS_ERR(skb))
|
||||
+ return PTR_ERR(skb);
|
||||
+
|
||||
+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid);
|
||||
+}
|
||||
+
|
||||
+static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ if (!ar->wmi.ops->gen_gpio_config)
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set);
|
||||
+ if (IS_ERR(skb))
|
||||
+ return PTR_ERR(skb);
|
||||
+
|
||||
+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid);
|
||||
+}
|
||||
+
|
||||
static inline int
|
||||
ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level)
|
||||
{
|
||||
--- a/ath10k-5.4/wmi-tlv.c
|
||||
+++ b/ath10k-5.4/wmi-tlv.c
|
||||
@@ -4364,6 +4364,8 @@ static const struct wmi_ops wmi_tlv_ops
|
||||
.gen_echo = ath10k_wmi_tlv_op_gen_echo,
|
||||
.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
|
||||
.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
|
||||
+ /* .gen_gpio_config not implemented */
|
||||
+ /* .gen_gpio_output not implemented */
|
||||
};
|
||||
|
||||
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
|
||||
--- a/ath10k-5.4/wmi.c
|
||||
+++ b/ath10k-5.4/wmi.c
|
||||
@@ -8295,6 +8295,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
|
||||
return skb;
|
||||
}
|
||||
|
||||
+static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar,
|
||||
+ u32 gpio_num, u32 input,
|
||||
+ u32 pull_type, u32 intr_mode)
|
||||
+{
|
||||
+ struct wmi_gpio_config_cmd *cmd;
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
|
||||
+ if (!skb)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ cmd = (struct wmi_gpio_config_cmd *)skb->data;
|
||||
+ cmd->pull_type = __cpu_to_le32(pull_type);
|
||||
+ cmd->gpio_num = __cpu_to_le32(gpio_num);
|
||||
+ cmd->input = __cpu_to_le32(input);
|
||||
+ cmd->intr_mode = __cpu_to_le32(intr_mode);
|
||||
+
|
||||
+ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n",
|
||||
+ gpio_num, input, pull_type, intr_mode);
|
||||
+
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar,
|
||||
+ u32 gpio_num, u32 set)
|
||||
+{
|
||||
+ struct wmi_gpio_output_cmd *cmd;
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
|
||||
+ if (!skb)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ cmd = (struct wmi_gpio_output_cmd *)skb->data;
|
||||
+ cmd->gpio_num = __cpu_to_le32(gpio_num);
|
||||
+ cmd->set = __cpu_to_le32(set);
|
||||
+
|
||||
+ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n",
|
||||
+ gpio_num, set);
|
||||
+
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
static struct sk_buff *
|
||||
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
|
||||
enum wmi_sta_ps_mode psmode)
|
||||
@@ -10094,6 +10137,9 @@ static const struct wmi_ops wmi_ops = {
|
||||
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
|
||||
+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
|
||||
+
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -10164,6 +10210,8 @@ static const struct wmi_ops wmi_10_1_ops
|
||||
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
|
||||
+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -10243,6 +10291,8 @@ static const struct wmi_ops wmi_10_2_ops
|
||||
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
|
||||
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
|
||||
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
|
||||
+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
|
||||
+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
|
||||
/* .gen_pdev_enable_adaptive_cca not implemented */
|
||||
};
|
||||
|
||||
@@ -10314,6 +10364,8 @@ static const struct wmi_ops wmi_10_2_4_o
|
||||
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
|
||||
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
|
||||
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
|
||||
+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
|
||||
+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
|
||||
/* .gen_bcn_tmpl not implemented */
|
||||
/* .gen_prb_tmpl not implemented */
|
||||
/* .gen_p2p_go_bcn_ie not implemented */
|
||||
@@ -10395,6 +10447,8 @@ static const struct wmi_ops wmi_10_4_ops
|
||||
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
|
||||
.gen_echo = ath10k_wmi_op_gen_echo,
|
||||
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
|
||||
+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
|
||||
+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
|
||||
};
|
||||
|
||||
int ath10k_wmi_attach(struct ath10k *ar)
|
||||
--- a/ath10k-5.4/wmi.h
|
||||
+++ b/ath10k-5.4/wmi.h
|
||||
@@ -3110,6 +3110,41 @@ enum wmi_10_4_feature_mask {
|
||||
|
||||
};
|
||||
|
||||
+/* WMI_GPIO_CONFIG_CMDID */
|
||||
+enum {
|
||||
+ WMI_GPIO_PULL_NONE,
|
||||
+ WMI_GPIO_PULL_UP,
|
||||
+ WMI_GPIO_PULL_DOWN,
|
||||
+};
|
||||
+
|
||||
+enum {
|
||||
+ WMI_GPIO_INTTYPE_DISABLE,
|
||||
+ WMI_GPIO_INTTYPE_RISING_EDGE,
|
||||
+ WMI_GPIO_INTTYPE_FALLING_EDGE,
|
||||
+ WMI_GPIO_INTTYPE_BOTH_EDGE,
|
||||
+ WMI_GPIO_INTTYPE_LEVEL_LOW,
|
||||
+ WMI_GPIO_INTTYPE_LEVEL_HIGH
|
||||
+};
|
||||
+
|
||||
+/* WMI_GPIO_CONFIG_CMDID */
|
||||
+struct wmi_gpio_config_cmd {
|
||||
+ __le32 gpio_num; /* GPIO number to be setup */
|
||||
+ __le32 input; /* 0 - Output/ 1 - Input */
|
||||
+ __le32 pull_type; /* Pull type defined above */
|
||||
+ __le32 intr_mode; /* Interrupt mode defined above (Input) */
|
||||
+} __packed;
|
||||
+
|
||||
+/* WMI_GPIO_OUTPUT_CMDID */
|
||||
+struct wmi_gpio_output_cmd {
|
||||
+ __le32 gpio_num; /* GPIO number to be setup */
|
||||
+ __le32 set; /* Set the GPIO pin*/
|
||||
+} __packed;
|
||||
+
|
||||
+/* WMI_GPIO_INPUT_EVENTID */
|
||||
+struct wmi_gpio_input_event {
|
||||
+ __le32 gpio_num; /* GPIO number which changed state */
|
||||
+} __packed;
|
||||
+
|
||||
struct wmi_ext_resource_config_10_4_cmd {
|
||||
/* contains enum wmi_host_platform_type */
|
||||
__le32 host_platform_config;
|
||||
@@ -1,53 +0,0 @@
|
||||
From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Kresin <dev@kresin.me>
|
||||
Date: Fri, 22 Jun 2018 18:59:44 +0200
|
||||
Subject: [PATCH] ath10k: use tpt LED trigger by default
|
||||
|
||||
Use the tpt LED trigger for each created phy led. Ths way LEDs attached
|
||||
to the ath10k GPIO pins are indicating the phy status and blink on
|
||||
traffic.
|
||||
|
||||
Signed-off-by: Mathias Kresin <dev@kresin.me>
|
||||
---
|
||||
ath10k-5.4/core.h | 4 ++++
|
||||
ath10k-5.4/leds.c | 4 +---
|
||||
ath10k-5.4/mac.c | 2 +-
|
||||
3 files changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/ath10k-5.4/core.h
|
||||
+++ b/ath10k-5.4/core.h
|
||||
@@ -1573,6 +1573,10 @@ struct ath10k {
|
||||
u8 csi_data[4096];
|
||||
u16 csi_data_len;
|
||||
|
||||
+#ifdef CPTCFG_MAC80211_LEDS
|
||||
+ const char *led_default_trigger;
|
||||
+#endif
|
||||
+
|
||||
/* must be last */
|
||||
u8 drv_priv[0] __aligned(sizeof(void *));
|
||||
};
|
||||
--- a/ath10k-5.4/leds.c
|
||||
+++ b/ath10k-5.4/leds.c
|
||||
@@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k *
|
||||
|
||||
ar->leds.cdev.name = ar->leds.label;
|
||||
ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking;
|
||||
-
|
||||
- /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */
|
||||
- ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger;
|
||||
+ ar->leds.cdev.default_trigger = ar->led_default_trigger;
|
||||
|
||||
ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
|
||||
if (ret)
|
||||
--- a/ath10k-5.4/mac.c
|
||||
+++ b/ath10k-5.4/mac.c
|
||||
@@ -10367,7 +10367,7 @@ int ath10k_mac_register(struct ath10k *a
|
||||
ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
|
||||
|
||||
#ifdef CPTCFG_MAC80211_LEDS
|
||||
- ieee80211_create_tpt_led_trigger(ar->hw,
|
||||
+ ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw,
|
||||
IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
|
||||
ARRAY_SIZE(ath10k_tpt_blink));
|
||||
#endif
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/ath10k-5.4/mac.c
|
||||
+++ b/ath10k-5.4/mac.c
|
||||
@@ -10180,6 +10180,7 @@ int ath10k_mac_register(struct ath10k *a
|
||||
wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
|
||||
wiphy_ext_feature_set(ar->hw->wiphy,
|
||||
NL80211_EXT_FEATURE_SET_SCAN_DWELL);
|
||||
+ wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL);
|
||||
|
||||
if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) ||
|
||||
test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/ath10k-5.4/htt.h
|
||||
+++ b/ath10k-5.4/htt.h
|
||||
@@ -225,7 +225,11 @@ enum htt_rx_ring_flags {
|
||||
};
|
||||
|
||||
#define HTT_RX_RING_SIZE_MIN 128
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
#define HTT_RX_RING_SIZE_MAX 2048
|
||||
+#else
|
||||
+#define HTT_RX_RING_SIZE_MAX 512
|
||||
+#endif
|
||||
#define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX
|
||||
#define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1)
|
||||
#define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1)
|
||||
@@ -1,50 +0,0 @@
|
||||
--- a/ath10k-5.4/pci.c
|
||||
+++ b/ath10k-5.4/pci.c
|
||||
@@ -131,7 +131,11 @@ static struct ce_attr host_ce_config_wla
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 512,
|
||||
+#else
|
||||
+ .dest_nentries = 128,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htt_htc_rx_cb,
|
||||
},
|
||||
|
||||
@@ -140,7 +144,11 @@ static struct ce_attr host_ce_config_wla
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 128,
|
||||
+#else
|
||||
+ .dest_nentries = 64,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htc_rx_cb,
|
||||
},
|
||||
|
||||
@@ -167,7 +175,11 @@ static struct ce_attr host_ce_config_wla
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 512,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 512,
|
||||
+#else
|
||||
+ .dest_nentries = 128,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htt_rx_cb,
|
||||
},
|
||||
|
||||
@@ -192,7 +204,11 @@ static struct ce_attr host_ce_config_wla
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 128,
|
||||
+#else
|
||||
+ .dest_nentries = 96,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_pktlog_rx_cb,
|
||||
},
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
diff -Naur a/ath10k-5.7/mac.c b/ath10k-5.7/mac.c
|
||||
--- a/ath10k-5.7/mac.c 2021-06-09 16:30:17.793556032 -0400
|
||||
+++ b/ath10k-5.7/mac.c 2021-06-09 17:38:08.587733979 -0400
|
||||
@@ -7103,13 +7103,15 @@
|
||||
scan_timeout = min_t(u32, arg.max_rest_time *
|
||||
(arg.n_channels - 1) + (req->duration +
|
||||
ATH10K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) *
|
||||
- arg.n_channels, arg.max_scan_time + 200);
|
||||
+ arg.n_channels, arg.max_scan_time);
|
||||
|
||||
} else {
|
||||
- /* Add a 200ms margin to account for event/command processing */
|
||||
- scan_timeout = arg.max_scan_time + 200;
|
||||
+ scan_timeout = arg.max_scan_time;
|
||||
}
|
||||
|
||||
+ /* Add a 200ms margin to account for event/command processing */
|
||||
+ scan_timeout += 200;
|
||||
+
|
||||
ret = ath10k_start_scan(ar, &arg);
|
||||
if (ret) {
|
||||
ath10k_warn(ar, "failed to start hw scan: %d\n", ret);
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/ath10k-5.7/mac.c 2021-07-06 11:12:56.022146449 -0700
|
||||
+++ b/ath10k-5.7/mac.c 2021-07-06 19:37:52.352753693 -0700
|
||||
@@ -8286,7 +8286,7 @@
|
||||
struct ieee80211_channel *channel)
|
||||
{
|
||||
int ret;
|
||||
- enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
|
||||
+ enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
--- a/ath10k-5.7/wmi.c
|
||||
+++ b/ath10k-5.7/wmi.c
|
||||
@@ -6347,16 +6347,18 @@
|
||||
|
||||
survey = &ar->survey[idx];
|
||||
|
||||
- survey->noise = noise_floor;
|
||||
- survey->time = div_u64(total, cc_freq_hz);
|
||||
- survey->time_busy = div_u64(busy, cc_freq_hz);
|
||||
- survey->time_rx = div_u64(rx_bss, cc_freq_hz);
|
||||
- survey->time_tx = div_u64(tx, cc_freq_hz);
|
||||
- survey->filled |= (SURVEY_INFO_NOISE_DBM |
|
||||
- SURVEY_INFO_TIME |
|
||||
- SURVEY_INFO_TIME_BUSY |
|
||||
- SURVEY_INFO_TIME_RX |
|
||||
- SURVEY_INFO_TIME_TX);
|
||||
+ survey->noise = noise_floor;
|
||||
+ survey->time = div_u64(total, cc_freq_hz);
|
||||
+ survey->time_busy = div_u64(busy, cc_freq_hz);
|
||||
+ survey->time_rx = div_u64(rx, cc_freq_hz);
|
||||
+ survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz);
|
||||
+ survey->time_tx = div_u64(tx, cc_freq_hz);
|
||||
+ survey->filled |= (SURVEY_INFO_NOISE_DBM |
|
||||
+ SURVEY_INFO_TIME |
|
||||
+ SURVEY_INFO_TIME_BUSY |
|
||||
+ SURVEY_INFO_TIME_RX |
|
||||
+ SURVEY_INFO_TIME_TX |
|
||||
+ SURVEY_INFO_TIME_BSS_RX);
|
||||
exit:
|
||||
spin_unlock_bh(&ar->data_lock);
|
||||
complete(&ar->bss_survey_done);
|
||||
@@ -1,14 +0,0 @@
|
||||
Index: ath10k-ct-2021-05-22b-54a9ac02/ath10k-5.7/core.c
|
||||
===================================================================
|
||||
--- ath10k-ct-2021-05-22b-54a9ac02.orig/ath10k-5.7/core.c
|
||||
+++ ath10k-ct-2021-05-22b-54a9ac02/ath10k-5.7/core.c
|
||||
@@ -4146,6 +4146,9 @@ struct ath10k *ath10k_core_create(size_t
|
||||
INIT_WORK(&ar->stop_scan_work, ath10k_wmi_stop_scan_work);
|
||||
|
||||
init_dummy_netdev(&ar->napi_dev);
|
||||
+ snprintf(ar->napi_dev.name, sizeof(ar->napi_dev.name), "%s",
|
||||
+ wiphy_name(ar->hw->wiphy));
|
||||
+ ar->napi_dev.threaded = 1;
|
||||
|
||||
ret = ath10k_coredump_create(ar);
|
||||
if (ret)
|
||||
@@ -1,182 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath10k-firmware
|
||||
PKG_SOURCE_DATE:=2019-10-03
|
||||
PKG_SOURCE_VERSION:=d622d160e9f552ead68d9ae81b715422892dc2ef
|
||||
PKG_MIRROR_HASH:=2e504e071c3f896d629c4cfffe7ff4b5f1acdb4fecd3f01e8ff8c73e87a67cc7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ath10k-firmware-default
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
URL:=$(PKG_SOURCE_URL)
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9887
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA9887 devices
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9888
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA9888 devices
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca988x
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA988x devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA99x0 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0/description
|
||||
Standard ath10k firmware for QCA99x0 from QCA
|
||||
This firmware conflicts with the CT 99x0 firmware, so select only
|
||||
one.
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9984
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA9984 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca4019
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for IPQ/QCA4019 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca6174
|
||||
$(Package/ath10k-firmware-default)
|
||||
TITLE:=ath10k firmware for QCA6174 devices
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
endef
|
||||
|
||||
QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
|
||||
QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
|
||||
|
||||
define Download/qca99x0-board
|
||||
URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
|
||||
URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
|
||||
FILE:=$(QCA99X0_BOARD_FILE)
|
||||
HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401
|
||||
endef
|
||||
$(eval $(call Download,qca99x0-board))
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca4019/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA4019/hw1.0/3.5.3/firmware-5.bin_10.4-3.5.3-00057 \
|
||||
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9887/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9887/hw1.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9887/hw1.0/board.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9888/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9888/hw2.0/3.5.3/firmware-5.bin_10.4-3.5.3-00053 \
|
||||
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca988x/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \
|
||||
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca6174/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA6174/hw2.1/board-2.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA6174/hw2.1/
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA6174/hw2.1/firmware-5.bin_SW_RM.1.1.1-00157-QCARMSWPZ-1 \
|
||||
$(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA6174/hw3.0/board-2.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA6174/hw3.0/
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA6174/hw3.0/4.4.1.c1/firmware-6.bin_RM.4.4.1.c1-00042-QCARMSWP-1 \
|
||||
$(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca99x0/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
|
||||
$(INSTALL_DATA) \
|
||||
$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA99X0/hw2.0/firmware-5.bin_10.4.1.00030-1 \
|
||||
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
|
||||
endef
|
||||
|
||||
define Package/ath10k-firmware-qca9984/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/QCA9984/hw1.0/3.5.3/firmware-5.bin_10.4-3.5.3-00053 \
|
||||
$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca9887))
|
||||
#$(eval $(call BuildPackage,ath10k-firmware-qca9888))
|
||||
$(eval $(call BuildPackage,ath10k-firmware-qca988x))
|
||||
#$(eval $(call BuildPackage,ath10k-firmware-qca99x0))
|
||||
#$(eval $(call BuildPackage,ath10k-firmware-qca6174))
|
||||
#$(eval $(call BuildPackage,ath10k-firmware-qca9984))
|
||||
#$(eval $(call BuildPackage,ath10k-firmware-qca4019))
|
||||
@@ -1,231 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batctl
|
||||
PKG_VERSION:=2020.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=d29cdb53ee68abd5027eae07d9fd645b3f154e0d577efa2666c1334bb6d60efd
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only ISC MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT LICENSES/deprecated/ISC
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/batctl/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:=+libnl-tiny +libc +librt
|
||||
PROVIDES:=batctl
|
||||
endef
|
||||
|
||||
define Package/batctl/description
|
||||
batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
|
||||
It is an easier method for configuring batman-adv and provides some
|
||||
additional tools for debugging as well. This package builds
|
||||
version $(PKG_VERSION) of the user space utility.
|
||||
endef
|
||||
|
||||
define Package/batctl-tiny
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
|
||||
VARIANT:=tiny
|
||||
ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
|
||||
endef
|
||||
|
||||
define Package/batctl-tiny/description
|
||||
$(Package/batctl/description)
|
||||
Only configuration relevant subcommands are enabled.
|
||||
endef
|
||||
|
||||
define Package/batctl-default
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
|
||||
VARIANT:=default
|
||||
ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
|
||||
endef
|
||||
|
||||
define Package/batctl-default/description
|
||||
$(Package/batctl/description)
|
||||
Standard subcommands for configuration and online debugging are enabled.
|
||||
endef
|
||||
|
||||
define Package/batctl-full
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
|
||||
VARIANT:=full
|
||||
ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
|
||||
endef
|
||||
|
||||
define Package/batctl-full/description
|
||||
$(Package/batctl/description)
|
||||
Subcommands for configuration, online and offline debugging are enabled.
|
||||
endef
|
||||
|
||||
# The linker can identify unused sections of a binary when each symbol is stored
|
||||
# in a separate section. This mostly removes unused linker sections and reduces
|
||||
# the size by ~3% on mipsel.
|
||||
|
||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
# Link-time optimization allows to move parts of the optimization from the single
|
||||
# source file to the global source view. This is done by emitting the GIMPLE
|
||||
# representation in each object file and analyzing it again during the link step.
|
||||
|
||||
TARGET_CFLAGS += -flto
|
||||
TARGET_LDFLAGS += -fuse-linker-plugin
|
||||
|
||||
MAKE_VARS += \
|
||||
LIBNL_NAME="libnl-tiny" \
|
||||
LIBNL_GENL_NAME="libnl-tiny"
|
||||
|
||||
MAKE_FLAGS += \
|
||||
REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)"
|
||||
|
||||
config-n := \
|
||||
aggregation \
|
||||
ap_isolation \
|
||||
backbonetable \
|
||||
bisect_iv \
|
||||
bonding \
|
||||
bridge_loop_avoidance \
|
||||
claimtable \
|
||||
dat_cache \
|
||||
distributed_arp_table \
|
||||
elp_interval \
|
||||
event \
|
||||
fragmentation \
|
||||
gateways \
|
||||
gw_mode \
|
||||
hop_penalty \
|
||||
interface \
|
||||
isolation_mark \
|
||||
loglevel \
|
||||
mcast_flags \
|
||||
multicast_fanout \
|
||||
multicast_forceflood \
|
||||
multicast_mode \
|
||||
nc_nodes \
|
||||
neighbors \
|
||||
network_coding \
|
||||
orig_interval \
|
||||
originators \
|
||||
ping \
|
||||
routing_algo \
|
||||
statistics \
|
||||
tcpdump \
|
||||
throughput_override \
|
||||
throughputmeter \
|
||||
traceroute \
|
||||
transglobal \
|
||||
translate \
|
||||
translocal \
|
||||
|
||||
config-settings := \
|
||||
aggregation \
|
||||
ap_isolation \
|
||||
bonding \
|
||||
bridge_loop_avoidance \
|
||||
distributed_arp_table \
|
||||
elp_interval \
|
||||
fragmentation \
|
||||
gw_mode \
|
||||
hop_penalty \
|
||||
interface \
|
||||
isolation_mark \
|
||||
loglevel \
|
||||
multicast_fanout \
|
||||
multicast_forceflood \
|
||||
multicast_mode \
|
||||
network_coding \
|
||||
orig_interval \
|
||||
routing_algo \
|
||||
throughput_override \
|
||||
|
||||
config-tables := \
|
||||
backbonetable \
|
||||
claimtable \
|
||||
dat_cache \
|
||||
gateways \
|
||||
loglevel \
|
||||
nc_nodes \
|
||||
neighbors \
|
||||
originators \
|
||||
statistics \
|
||||
transglobal \
|
||||
translocal \
|
||||
|
||||
config-tools := \
|
||||
event \
|
||||
ping \
|
||||
tcpdump \
|
||||
throughputmeter \
|
||||
traceroute \
|
||||
translate \
|
||||
|
||||
config-extratools := \
|
||||
bisect_iv \
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tiny)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),default)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
$(config-tables) \
|
||||
$(config-tools) \
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
$(config-tables) \
|
||||
$(config-tools) \
|
||||
$(config-extratools) \
|
||||
|
||||
endif
|
||||
|
||||
define ConfigVars
|
||||
$(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
|
||||
))
|
||||
endef
|
||||
|
||||
define batctl_config
|
||||
$(call ConfigVars,n)$(call ConfigVars,y)
|
||||
endef
|
||||
$(eval $(call shexport,batctl_config))
|
||||
|
||||
MAKE_FLAGS += $$$$$(call shvar,batctl_config)
|
||||
|
||||
define Package/batctl-tiny/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
|
||||
endef
|
||||
|
||||
define Package/batctl-default/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
|
||||
endef
|
||||
|
||||
define Package/batctl-full/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,batctl-default))
|
||||
$(eval $(call BuildPackage,batctl-tiny))
|
||||
$(eval $(call BuildPackage,batctl-full))
|
||||
@@ -1,110 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors:
|
||||
#
|
||||
# Marek Lindner, Simon Wunderlich
|
||||
|
||||
#
|
||||
# B.A.T.M.A.N meshing protocol
|
||||
#
|
||||
|
||||
config BATMAN_ADV_BATMAN_V
|
||||
bool "B.A.T.M.A.N. V protocol"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the B.A.T.M.A.N. V protocol, the successor
|
||||
of the currently used B.A.T.M.A.N. IV protocol. The main
|
||||
changes include splitting of the OGM protocol into a neighbor
|
||||
discovery protocol (Echo Location Protocol, ELP) and a new OGM
|
||||
Protocol OGMv2 for flooding protocol information through the
|
||||
network, as well as a throughput based metric.
|
||||
B.A.T.M.A.N. V is currently considered experimental and not
|
||||
compatible to B.A.T.M.A.N. IV networks.
|
||||
|
||||
config BATMAN_ADV_BLA
|
||||
bool "Bridge Loop Avoidance"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select PACKAGE_kmod-lib-crc16
|
||||
default y
|
||||
help
|
||||
This option enables BLA (Bridge Loop Avoidance), a mechanism
|
||||
to avoid Ethernet frames looping when mesh nodes are connected
|
||||
to both the same LAN and the same mesh. If you will never use
|
||||
more than one mesh node in the same LAN, you can safely remove
|
||||
this feature and save some space.
|
||||
|
||||
config BATMAN_ADV_DAT
|
||||
bool "Distributed ARP Table"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables DAT (Distributed ARP Table), a DHT based
|
||||
mechanism that increases ARP reliability on sparse wireless
|
||||
mesh networks. If you think that your network does not need
|
||||
this option you can safely remove it and save some space.
|
||||
|
||||
config BATMAN_ADV_NC
|
||||
bool "Network Coding"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This option enables network coding, a mechanism that aims to
|
||||
increase the overall network throughput by fusing multiple
|
||||
packets in one transmission.
|
||||
Note that interfaces controlled by batman-adv must be manually
|
||||
configured to have promiscuous mode enabled in order to make
|
||||
network coding work.
|
||||
If you think that your network does not need this feature you
|
||||
can safely disable it and save some space.
|
||||
|
||||
config BATMAN_ADV_MCAST
|
||||
bool "Multicast optimisation"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the multicast optimisation which aims to
|
||||
reduce the air overhead while improving the reliability of
|
||||
multicast messages.
|
||||
|
||||
config BATMAN_ADV_DEBUGFS
|
||||
bool "batman-adv debugfs entries"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select KERNEL_DEBUG_FS
|
||||
help
|
||||
Enable this to export routing related debug tables via debugfs.
|
||||
The information for each soft-interface and used hard-interface can be
|
||||
found under batman_adv/
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config BATMAN_ADV_DEBUG
|
||||
bool "B.A.T.M.A.N. debugging"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. This enables compilation of support for
|
||||
outputting debugging information to the debugfs log or tracing
|
||||
buffer. The output is controlled via the batadv netdev specific
|
||||
log_level setting.
|
||||
|
||||
config BATMAN_ADV_SYSFS
|
||||
bool "batman-adv sysfs entries"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
Say Y here if you want to enable batman-adv device configuration and
|
||||
status interface through sysfs attributes. It is replaced by the
|
||||
batadv generic netlink family but still used by various userspace
|
||||
tools and scripts.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
config BATMAN_ADV_TRACING
|
||||
bool "B.A.T.M.A.N. tracing support"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select KERNEL_FTRACE
|
||||
select KERNEL_ENABLE_DEFAULT_TRACERS
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. Select this option to gather traces like the debug
|
||||
messages using the generic tracing infrastructure of the kernel.
|
||||
BATMAN_ADV_DEBUG must also be selected to get trace events for
|
||||
batadv_dbg.
|
||||
@@ -1,91 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batman-adv
|
||||
PKG_VERSION:=2020.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=a73f5ce72c6efa9dd7bd7cc8daa667d0982e12e40811c978bb652607bb5666a3
|
||||
PKG_EXTMOD_SUBDIRS:=net/batman-adv
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/batman-adv
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=B.A.T.M.A.N. Adv
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl
|
||||
FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoProbe,batman-adv)
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/description
|
||||
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
|
||||
a routing protocol for multi-hop ad-hoc mesh networks. The
|
||||
networks may be wired or wireless. See
|
||||
https://www.open-mesh.org/ for more information and user space
|
||||
tools. This package builds version $(PKG_VERSION) of the kernel
|
||||
module.
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/kmod-batman-adv/conffiles
|
||||
/etc/config/batman-adv
|
||||
endef
|
||||
|
||||
PKG_EXTRA_KCONFIG:= \
|
||||
CONFIG_BATMAN_ADV=m \
|
||||
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \
|
||||
CONFIG_BATMAN_ADV_DEBUGFS=$(if $(CONFIG_BATMAN_ADV_DEBUGFS),y,n) \
|
||||
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \
|
||||
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \
|
||||
CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \
|
||||
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \
|
||||
CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \
|
||||
CONFIG_BATMAN_ADV_SYSFS=$(if $(CONFIG_BATMAN_ADV_SYSFS),y,n) \
|
||||
CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \
|
||||
|
||||
PKG_EXTRA_CFLAGS:= \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
-I$(PKG_BUILD_DIR)/net/batman-adv \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(PKG_BUILD_DIR)/include/ \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h \
|
||||
-include $(PKG_BUILD_DIR)/compat-hacks.h \
|
||||
-DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\"
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/net/batman-adv" \
|
||||
$(PKG_EXTRA_KCONFIG) \
|
||||
EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/install
|
||||
$(CP) ./files/. $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,batman-adv))
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This UCI-Defaults script will split the batadv proto network interfaces
|
||||
# in batadv_hardif and batadv proto. The configuration options from
|
||||
# /etc/config/batman-adv will be moved to the latter.
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
proto_batadv_to_batadv_hardif() {
|
||||
local section="$1"
|
||||
local proto
|
||||
local mesh
|
||||
local routing_algo
|
||||
|
||||
config_get proto "${section}" proto
|
||||
config_get mesh "${section}" mesh
|
||||
config_get routing_algo "${section}" routing_algo
|
||||
|
||||
if [ -z "$mesh" -o "${proto}" != "batadv" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
uci set network."${section}".proto="batadv_hardif"
|
||||
uci rename network."${section}".mesh="master"
|
||||
uci delete network."${section}".routing_algo
|
||||
|
||||
# create new section or adjust existing one
|
||||
uci set network."${mesh}"=interface
|
||||
uci set network."${mesh}".proto=batadv
|
||||
[ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}"
|
||||
}
|
||||
|
||||
mv_batadv_config_section() {
|
||||
local section="$1"
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
|
||||
config_get aggregated_ogms "${section}" aggregated_ogms
|
||||
config_get ap_isolation "${section}" ap_isolation
|
||||
config_get bonding "${section}" bonding
|
||||
config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance
|
||||
config_get distributed_arp_table "${section}" distributed_arp_table
|
||||
config_get fragmentation "${section}" fragmentation
|
||||
config_get gw_bandwidth "${section}" gw_bandwidth
|
||||
config_get gw_mode "${section}" gw_mode
|
||||
config_get gw_sel_class "${section}" gw_sel_class
|
||||
config_get hop_penalty "${section}" hop_penalty
|
||||
config_get isolation_mark "${section}" isolation_mark
|
||||
config_get log_level "${section}" log_level
|
||||
config_get multicast_mode "${section}" multicast_mode
|
||||
config_get network_coding "${section}" network_coding
|
||||
config_get orig_interval "${section}" orig_interval
|
||||
|
||||
# update section in case it exists
|
||||
[ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}"
|
||||
[ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}"
|
||||
[ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}"
|
||||
[ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}"
|
||||
[ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}"
|
||||
[ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}"
|
||||
[ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}"
|
||||
[ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}"
|
||||
[ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}"
|
||||
[ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}"
|
||||
[ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}"
|
||||
[ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}"
|
||||
[ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}"
|
||||
[ -n "${network_coding}" ] && uci set network."${section}".network_coding="${network_coding}"
|
||||
[ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}"
|
||||
}
|
||||
|
||||
if [ -f /etc/config/batman-adv ]; then
|
||||
config_load network
|
||||
config_foreach proto_batadv_to_batadv_hardif 'interface'
|
||||
uci commit network
|
||||
|
||||
config_load batman-adv
|
||||
config_foreach mv_batadv_config_section 'mesh'
|
||||
uci commit network
|
||||
|
||||
rm -f /etc/config/batman-adv
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,123 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_batadv_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
|
||||
proto_config_add_boolean 'aggregated_ogms:bool'
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
proto_config_add_boolean 'bonding:bool'
|
||||
proto_config_add_boolean 'bridge_loop_avoidance:bool'
|
||||
proto_config_add_boolean 'distributed_arp_table:bool'
|
||||
proto_config_add_boolean 'fragmentation:bool'
|
||||
proto_config_add_string 'gw_bandwidth'
|
||||
proto_config_add_string 'gw_mode'
|
||||
proto_config_add_int 'gw_sel_class'
|
||||
proto_config_add_int 'hop_penalty'
|
||||
proto_config_add_string 'isolation_mark'
|
||||
proto_config_add_string 'log_level'
|
||||
proto_config_add_int 'multicast_fanout'
|
||||
proto_config_add_boolean 'multicast_mode:bool'
|
||||
proto_config_add_boolean 'network_coding:bool'
|
||||
proto_config_add_int 'orig_interval'
|
||||
proto_config_add_string 'routing_algo'
|
||||
}
|
||||
|
||||
proto_batadv_setup() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_fanout
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
local routing_algo
|
||||
|
||||
json_get_vars aggregated_ogms
|
||||
json_get_vars ap_isolation
|
||||
json_get_vars bonding
|
||||
json_get_vars bridge_loop_avoidance
|
||||
json_get_vars distributed_arp_table
|
||||
json_get_vars fragmentation
|
||||
json_get_vars gw_bandwidth
|
||||
json_get_vars gw_mode
|
||||
json_get_vars gw_sel_class
|
||||
json_get_vars hop_penalty
|
||||
json_get_vars isolation_mark
|
||||
json_get_vars log_level
|
||||
json_get_vars multicast_fanout
|
||||
json_get_vars multicast_mode
|
||||
json_get_vars network_coding
|
||||
json_get_vars orig_interval
|
||||
json_get_vars routing_algo
|
||||
|
||||
set_default routing_algo 'BATMAN_IV'
|
||||
|
||||
batctl routing_algo "$routing_algo"
|
||||
batctl meshif "$iface" interface create
|
||||
|
||||
[ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms"
|
||||
[ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation"
|
||||
[ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding"
|
||||
[ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
|
||||
[ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
|
||||
[ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation"
|
||||
|
||||
case "$gw_mode" in
|
||||
server)
|
||||
if [ -n "$gw_bandwidth" ]; then
|
||||
batctl meshif "$iface" gw_mode "server" "$gw_bandwidth"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "server"
|
||||
fi
|
||||
;;
|
||||
client)
|
||||
if [ -n "$gw_sel_class" ]; then
|
||||
batctl meshif "$iface" gw_mode "client" "$gw_sel_class"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "client"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
batctl meshif "$iface" gw_mode "off"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty"
|
||||
[ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark"
|
||||
[ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout"
|
||||
[ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&-
|
||||
[ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&-
|
||||
[ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&-
|
||||
[ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval"
|
||||
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_teardown() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
|
||||
batctl meshif "$iface" interface destroy
|
||||
}
|
||||
|
||||
add_protocol batadv
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_init_config() {
|
||||
proto_config_add_int 'elp_interval'
|
||||
proto_config_add_string "master"
|
||||
proto_config_add_string 'throughput_override'
|
||||
}
|
||||
|
||||
proto_batadv_hardif_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local elp_interval
|
||||
local master
|
||||
local throughput_override
|
||||
|
||||
json_get_vars elp_interval
|
||||
json_get_vars master
|
||||
json_get_vars throughput_override
|
||||
|
||||
( proto_add_host_dependency "$config" '' "$master" )
|
||||
|
||||
batctl meshif "$master" interface -M add "$iface"
|
||||
|
||||
[ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval"
|
||||
[ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override"
|
||||
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_teardown() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local master
|
||||
|
||||
json_get_vars master
|
||||
|
||||
batctl meshif "$master" interface -M del "$iface" || true
|
||||
}
|
||||
|
||||
add_protocol batadv_hardif
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_batadv_vlan_init_config() {
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
}
|
||||
|
||||
proto_batadv_vlan_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
# batadv_vlan options
|
||||
local ap_isolation
|
||||
|
||||
json_get_vars ap_isolation
|
||||
|
||||
[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation"
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
add_protocol batadv_vlan
|
||||
@@ -1,181 +0,0 @@
|
||||
/* Please avoid adding hacks here - instead add it to mac80211/backports.git */
|
||||
|
||||
#undef CONFIG_MODULE_STRIPPED
|
||||
|
||||
#include <linux/version.h> /* LINUX_VERSION_CODE */
|
||||
#include <linux/types.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) ({\
|
||||
BUILD_BUG_ON(extack != NULL); \
|
||||
netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info); \
|
||||
})
|
||||
|
||||
#endif /* < KERNEL_VERSION(4, 15, 0) */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
|
||||
|
||||
#ifndef sizeof_field
|
||||
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
|
||||
#endif
|
||||
|
||||
#endif /* < KERNEL_VERSION(4, 16, 0) */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
|
||||
|
||||
#include_next <linux/igmp.h>
|
||||
#include_next <net/addrconf.h>
|
||||
|
||||
static inline int batadv_ipv6_mc_check_mld1(struct sk_buff *skb)
|
||||
{
|
||||
return ipv6_mc_check_mld(skb, NULL);
|
||||
}
|
||||
|
||||
static inline int batadv_ipv6_mc_check_mld2(struct sk_buff *skb,
|
||||
struct sk_buff **skb_trimmed)
|
||||
{
|
||||
return ipv6_mc_check_mld(skb, skb_trimmed);
|
||||
}
|
||||
|
||||
#define ipv6_mc_check_mld_get(_1, _2, ipv6_mc_check_mld_name, ...) ipv6_mc_check_mld_name
|
||||
#define ipv6_mc_check_mld(...) \
|
||||
ipv6_mc_check_mld_get(__VA_ARGS__, batadv_ipv6_mc_check_mld2, batadv_ipv6_mc_check_mld1)(__VA_ARGS__)
|
||||
|
||||
static inline int batadv_ip_mc_check_igmp1(struct sk_buff *skb)
|
||||
{
|
||||
return ip_mc_check_igmp(skb, NULL);
|
||||
}
|
||||
|
||||
static inline int batadv_ip_mc_check_igmp2(struct sk_buff *skb,
|
||||
struct sk_buff **skb_trimmed)
|
||||
{
|
||||
return ip_mc_check_igmp(skb, skb_trimmed);
|
||||
}
|
||||
|
||||
#define ip_mc_check_igmp_get(_1, _2, ip_mc_check_igmp_name, ...) ip_mc_check_igmp_name
|
||||
#define ip_mc_check_igmp(...) \
|
||||
ip_mc_check_igmp_get(__VA_ARGS__, batadv_ip_mc_check_igmp2, batadv_ip_mc_check_igmp1)(__VA_ARGS__)
|
||||
|
||||
#endif /* < KERNEL_VERSION(5, 1, 0) */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||
|
||||
#define batadv_softif_slave_add(__dev, __slave_dev, __extack) \
|
||||
batadv_softif_slave_add(__dev, __slave_dev)
|
||||
|
||||
#endif /* < KERNEL_VERSION(4, 15, 0) */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
|
||||
|
||||
static inline int batadv_access_ok(int type, const void __user *p,
|
||||
unsigned long size)
|
||||
{
|
||||
return access_ok(type, p, size);
|
||||
}
|
||||
|
||||
#ifdef access_ok
|
||||
#undef access_ok
|
||||
#endif
|
||||
|
||||
#define access_ok_get(_1, _2, _3 , access_ok_name, ...) access_ok_name
|
||||
#define access_ok(...) \
|
||||
access_ok_get(__VA_ARGS__, access_ok3, access_ok2)(__VA_ARGS__)
|
||||
|
||||
#define access_ok2(addr, size) batadv_access_ok(VERIFY_WRITE, (addr), (size))
|
||||
#define access_ok3(type, addr, size) batadv_access_ok((type), (addr), (size))
|
||||
|
||||
#endif /* < KERNEL_VERSION(5, 0, 0) */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
|
||||
|
||||
#ifndef fallthrough
|
||||
#if __GNUC__ > 7 && !defined(__CHECKER__)
|
||||
# define fallthrough __attribute__((__fallthrough__))
|
||||
#else
|
||||
# define fallthrough do {} while (0) /* fallthrough */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* < KERNEL_VERSION(5, 4, 0) */
|
||||
|
||||
/* <DECLARE_EWMA> */
|
||||
|
||||
#include <linux/version.h>
|
||||
#include_next <linux/average.h>
|
||||
|
||||
#include <linux/bug.h>
|
||||
|
||||
#ifdef DECLARE_EWMA
|
||||
#undef DECLARE_EWMA
|
||||
#endif /* DECLARE_EWMA */
|
||||
|
||||
/*
|
||||
* Exponentially weighted moving average (EWMA)
|
||||
*
|
||||
* This implements a fixed-precision EWMA algorithm, with both the
|
||||
* precision and fall-off coefficient determined at compile-time
|
||||
* and built into the generated helper funtions.
|
||||
*
|
||||
* The first argument to the macro is the name that will be used
|
||||
* for the struct and helper functions.
|
||||
*
|
||||
* The second argument, the precision, expresses how many bits are
|
||||
* used for the fractional part of the fixed-precision values.
|
||||
*
|
||||
* The third argument, the weight reciprocal, determines how the
|
||||
* new values will be weighed vs. the old state, new values will
|
||||
* get weight 1/weight_rcp and old values 1-1/weight_rcp. Note
|
||||
* that this parameter must be a power of two for efficiency.
|
||||
*/
|
||||
|
||||
#define DECLARE_EWMA(name, _precision, _weight_rcp) \
|
||||
struct ewma_##name { \
|
||||
unsigned long internal; \
|
||||
}; \
|
||||
static inline void ewma_##name##_init(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
/* \
|
||||
* Even if you want to feed it just 0/1 you should have \
|
||||
* some bits for the non-fractional part... \
|
||||
*/ \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
e->internal = 0; \
|
||||
} \
|
||||
static inline unsigned long \
|
||||
ewma_##name##_read(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
return e->internal >> (_precision); \
|
||||
} \
|
||||
static inline void ewma_##name##_add(struct ewma_##name *e, \
|
||||
unsigned long val) \
|
||||
{ \
|
||||
unsigned long internal = READ_ONCE(e->internal); \
|
||||
unsigned long weight_rcp = ilog2(_weight_rcp); \
|
||||
unsigned long precision = _precision; \
|
||||
\
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
\
|
||||
WRITE_ONCE(e->internal, internal ? \
|
||||
(((internal << weight_rcp) - internal) + \
|
||||
(val << precision)) >> weight_rcp : \
|
||||
(val << precision)); \
|
||||
}
|
||||
|
||||
/* </DECLARE_EWMA> */
|
||||
@@ -1,151 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/version.mk
|
||||
|
||||
PKG_NAME:=ipq-wifi
|
||||
PKG_RELEASE:=1
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
# Use ath10k-bdencoder from https://github.com/qca/qca-swiss-army-knife.git
|
||||
# to generate the board-* files here.
|
||||
#
|
||||
# This is intended to be used on an interim basis until device-specific
|
||||
# board data for new devices is available through the upstream compilation
|
||||
#
|
||||
# Please send a mail with your device-specific board files upstream.
|
||||
# You can find instructions and examples on the linux-wireless wiki:
|
||||
# <https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>
|
||||
|
||||
ALLWIFIBOARDS:= \
|
||||
8dev_habanero-dvk \
|
||||
aruba_ap-303 \
|
||||
avm_fritzrepeater-1200 \
|
||||
buffalo_wtr-m2133hp \
|
||||
cellc_rtl30vw \
|
||||
devolo_magic-2-wifi-next \
|
||||
dlink_dap2610 \
|
||||
edgecore_ecw5410 \
|
||||
edgecore_ssw2ac2600 \
|
||||
edgecore_oap100 \
|
||||
engenius_eap2200 \
|
||||
engenius_emd1 \
|
||||
engenius_emr3500 \
|
||||
ezviz_cs-w3-wd1200g-eup \
|
||||
glinet_gl-ap1300 \
|
||||
glinet_gl-s1300 \
|
||||
linksys_ea8300 \
|
||||
linksys_mr8300-v0 \
|
||||
luma_wrtq-329acn \
|
||||
mikrotik_hap-ac2 \
|
||||
mikrotik_sxtsq-5-ac \
|
||||
mobipromo_cm520-79f \
|
||||
nec_wg2600hp3 \
|
||||
plasmacloud_pa1200 \
|
||||
plasmacloud_pa2200 \
|
||||
qxwlan_e2600ac \
|
||||
cig_wf610d \
|
||||
wallys_dr40x9 \
|
||||
tp-link_ec420-g1 \
|
||||
udaya-a5-id2 \
|
||||
hfcl_ion4
|
||||
|
||||
ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD))
|
||||
|
||||
define Package/ipq-wifi-default
|
||||
SUBMENU:=ath10k Board-Specific Overrides
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x)
|
||||
TITLE:=Custom Board
|
||||
endef
|
||||
|
||||
define ipq-wifi-install-one-to
|
||||
$(INSTALL_DIR) $(2)/lib/firmware/ath10k/$(3)/
|
||||
$(INSTALL_DATA) $(1) $(2)/lib/firmware/ath10k/$(3)/board-2.bin
|
||||
endef
|
||||
|
||||
define ipq-wifi-install-one
|
||||
$(if $(filter $(suffix $(1)),.QCA4019 .qca4019),\
|
||||
$(call ipq-wifi-install-one-to,$(1),$(2),QCA4019/hw1.0),\
|
||||
$(if $(filter $(suffix $(1)),.QCA9888 .qca9888),\
|
||||
$(call ipq-wifi-install-one-to,$(1),$(2),QCA9888/hw2.0),\
|
||||
$(if $(filter $(suffix $(1)),.QCA9984 .qca9984),\
|
||||
$(call ipq-wifi-install-one-to,$(1),$(2),QCA9984/hw1.0),\
|
||||
$(error Unrecognized board-file suffix '$(suffix $(1))' for '$(1)')\
|
||||
)))
|
||||
|
||||
endef
|
||||
# Blank line required at end of above define due to foreach context
|
||||
|
||||
define generate-ipq-wifi-package
|
||||
define Package/ipq-wifi-$(1)
|
||||
$(call Package/ipq-wifi-default)
|
||||
TITLE:=board-2.bin Overrides for $(2)
|
||||
CONFLICTS:=$(PREV_BOARD)
|
||||
endef
|
||||
|
||||
define Package/ipq-wifi-$(1)/description
|
||||
The $(2) requires board-specific, reference ("cal") data
|
||||
that is not yet present in the upstream wireless firmware distribution.
|
||||
|
||||
This package supplies board-2.bin file(s) that, in the interim,
|
||||
overwrite those supplied by the ath10k-firmware-* packages.
|
||||
|
||||
This is package is only necessary for the $(2).
|
||||
|
||||
Do not install it for any other device!
|
||||
endef
|
||||
|
||||
define Package/ipq-wifi-$(1)/install-overlay
|
||||
$$$$(foreach IPQ_WIFI_BOARD_FILE,$$$$(wildcard board-$(1).*),\
|
||||
$$$$(call ipq-wifi-install-one,$$$$(IPQ_WIFI_BOARD_FILE),$$(1)))
|
||||
endef
|
||||
|
||||
PREV_BOARD+=ipq-wifi-$(1)
|
||||
endef
|
||||
|
||||
# Add board name to ALLWIFIBOARDS
|
||||
# Place files in this directory as board-<devicename>.<qca4019|qca9888|qca9984>
|
||||
# Add $(eval $(call generate-ipq-wifi-package,<devicename>,<display name>))
|
||||
|
||||
$(eval $(call generate-ipq-wifi-package,8dev_habanero-dvk,8devices Habanero DVK))
|
||||
$(eval $(call generate-ipq-wifi-package,aruba_ap-303,Aruba AP-303))
|
||||
$(eval $(call generate-ipq-wifi-package,avm_fritzrepeater-1200,AVM FRITZRepeater 1200))
|
||||
$(eval $(call generate-ipq-wifi-package,buffalo_wtr-m2133hp,Buffalo WTR-M2133HP))
|
||||
$(eval $(call generate-ipq-wifi-package,cellc_rtl30vw, Cell C RTL30VW))
|
||||
$(eval $(call generate-ipq-wifi-package,devolo_magic-2-wifi-next,devolo Magic 2 WiFi next))
|
||||
$(eval $(call generate-ipq-wifi-package,dlink_dap2610,D-Link DAP-2610))
|
||||
$(eval $(call generate-ipq-wifi-package,edgecore_ecw5410,Edgecore ECW5410))
|
||||
$(eval $(call generate-ipq-wifi-package,edgecore_ssw2ac2600,Edgecore SSW2AC2600))
|
||||
$(eval $(call generate-ipq-wifi-package,edgecore_oap100,Edgecore OAP100))
|
||||
$(eval $(call generate-ipq-wifi-package,engenius_eap2200,EnGenius EAP2200))
|
||||
$(eval $(call generate-ipq-wifi-package,engenius_emd1,EnGenius EMD1))
|
||||
$(eval $(call generate-ipq-wifi-package,engenius_emr3500,EnGenius EMR3500))
|
||||
$(eval $(call generate-ipq-wifi-package,ezviz_cs-w3-wd1200g-eup,EZVIZ CS-W3-WD1200G EUP))
|
||||
$(eval $(call generate-ipq-wifi-package,glinet_gl-ap1300,GL.iNet GL-AP1300))
|
||||
$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300))
|
||||
$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
|
||||
$(eval $(call generate-ipq-wifi-package,linksys_mr8300-v0,Linksys MR8300))
|
||||
$(eval $(call generate-ipq-wifi-package,luma_wrtq-329acn,Luma WRTQ-329ACN))
|
||||
$(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac2,Mikrotik hAP ac2))
|
||||
$(eval $(call generate-ipq-wifi-package,mikrotik_sxtsq-5-ac,MikroTik SXTsq 5 ac))
|
||||
$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F))
|
||||
$(eval $(call generate-ipq-wifi-package,nec_wg2600hp3,NEC Platforms WG2600HP3))
|
||||
$(eval $(call generate-ipq-wifi-package,plasmacloud_pa1200,Plasma Cloud PA1200))
|
||||
$(eval $(call generate-ipq-wifi-package,plasmacloud_pa2200,Plasma Cloud PA2200))
|
||||
$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC))
|
||||
$(eval $(call generate-ipq-wifi-package,cig_wf610d,CIG WF_610D))
|
||||
$(eval $(call generate-ipq-wifi-package,tp-link_ec420-g1,tp-link EC420-G1))
|
||||
$(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
|
||||
$(eval $(call generate-ipq-wifi-package,hfcl_ion4,HFCL ION4))
|
||||
$(eval $(call generate-ipq-wifi-package,udaya-a5-id2,udaya A5 ID2))
|
||||
|
||||
$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ARCH:=arm
|
||||
BOARD:=ipq40xx
|
||||
BOARDNAME:=Qualcomm Atheros IPQ40XX
|
||||
FEATURES:=squashfs fpu ramdisk nand
|
||||
CPU_TYPE:=cortex-a7
|
||||
CPU_SUBTYPE:=neon-vfpv4
|
||||
SUBTARGETS:=generic mikrotik
|
||||
|
||||
KERNEL_PATCHVER:=5.4
|
||||
KERNEL_TESTING_PATCHVER:=5.4
|
||||
DEVICE_TYPE:=qsdk
|
||||
|
||||
KERNELNAME:=zImage Image dtbs
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
DEFAULT_PACKAGES += \
|
||||
kmod-usb-dwc3-qcom \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
|
||||
kmod-ath10k-ct wpad-basic-wolfssl \
|
||||
kmod-usb3 kmod-usb-dwc3 ath10k-firmware-qca4019-ct \
|
||||
uboot-envtools
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
alfa-network,ap120c-ac)
|
||||
ucidef_set_led_netdev "wan" "WAN" "amber:wan" "eth1"
|
||||
;;
|
||||
asus,rt-ac58u)
|
||||
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
|
||||
ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x1e"
|
||||
;;
|
||||
avm,fritzbox-4040)
|
||||
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt" "phy1tpt"
|
||||
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
|
||||
ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x1e"
|
||||
;;
|
||||
avm,fritzbox-7530 |\
|
||||
glinet,gl-b1300)
|
||||
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
|
||||
;;
|
||||
edgecore,oap100 |\
|
||||
edgecore,oap100e)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wlan2g" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wlan5g" "phy1tpt"
|
||||
;;
|
||||
|
||||
engenius,eap1300)
|
||||
ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wlan2g" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "yellow:wlan5g" "phy1tpt"
|
||||
ucidef_set_led_default "mesh" "MESH" "blue:mesh" "0"
|
||||
;;
|
||||
engenius,eap2200)
|
||||
ucidef_set_led_netdev "lan1" "LAN1" "blue:lan1" "eth0"
|
||||
ucidef_set_led_netdev "lan2" "LAN2" "blue:lan2" "eth1"
|
||||
;;
|
||||
engenius,ens620ext)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy1tpt"
|
||||
ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0"
|
||||
ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1"
|
||||
;;
|
||||
mikrotik,sxtsq-5-ac)
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:rssimediumlow" "wlan0" "21" "100"
|
||||
ucidef_set_led_rssi "rssimedium" "rssimedium" "green:rssimedium" "wlan0" "41" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "61" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "81" "100"
|
||||
;;
|
||||
mobipromo,cm520-79f)
|
||||
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
|
||||
ucidef_set_led_switch "lan1" "LAN1" "blue:lan1" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "blue:lan2" "switch0" "0x08"
|
||||
;;
|
||||
netgear,ex6100v2 |\
|
||||
netgear,ex6150v2)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:router" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:client" "phy1tpt"
|
||||
;;
|
||||
qxwlan,e2600ac-c1 |\
|
||||
qxwlan,e2600ac-c2)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN0" "green:wlan0" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN1" "green:wlan1" "phy1tpt"
|
||||
;;
|
||||
edgecore,ecw5211 |\
|
||||
edgecore,spw2ac1200 |\
|
||||
edgecore,spw2ac1200-lan-poe |\
|
||||
cig,wf610d |\
|
||||
zyxel,nbg6617 |\
|
||||
zyxel,wre6606)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy1tpt"
|
||||
;;
|
||||
hfcl,ion4)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "yellow:wlan2g" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "red:wlan5g" "phy1tpt"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -1,211 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
# Copyright (c) 2011-2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
ipq40xx_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
8dev,habanero-dvk|\
|
||||
8dev,jalapeno|\
|
||||
alfa-network,ap120c-ac|\
|
||||
edgecore,spw2ac1200-lan-poe |\
|
||||
engenius,emr3500|\
|
||||
engenius,ens620ext|\
|
||||
luma,wrtq-329acn|\
|
||||
plasmacloud,pa1200|\
|
||||
plasmacloud,pa2200|\
|
||||
wallys,dr40x9)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
;;
|
||||
aruba,ap-303|\
|
||||
aruba,ap-365|\
|
||||
avm,fritzrepeater-1200|\
|
||||
dlink,dap-2610 |\
|
||||
engenius,eap1300|\
|
||||
engenius,emd1|\
|
||||
meraki,mr33|\
|
||||
mikrotik,sxtsq-5-ac|\
|
||||
netgear,ex6100v2|\
|
||||
netgear,ex6150v2|\
|
||||
tp-link,ec420-g1|\
|
||||
hfcl,ion4|\
|
||||
zyxel,wre6606)
|
||||
ucidef_set_interface_wan "eth0"
|
||||
;;
|
||||
aruba,ap-303h)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
|
||||
;;
|
||||
asus,map-ac2200|\
|
||||
cilab,meshpoint-one|\
|
||||
cig,wf610d|\
|
||||
edgecore,ecw5211|\
|
||||
edgecore,spw2ac1200 |\
|
||||
edgecore,oap100|\
|
||||
edgecore,oap100e|\
|
||||
udaya,a5-id2|\
|
||||
openmesh,a42|\
|
||||
openmesh,a62)
|
||||
ucidef_set_interfaces_lan_wan "eth1" "eth0"
|
||||
;;
|
||||
asus,rt-ac58u|\
|
||||
mikrotik,hap-ac2|\
|
||||
zyxel,nbg6617)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
;;
|
||||
avm,fritzbox-4040|\
|
||||
linksys,ea6350v3|\
|
||||
linksys,ea8300|\
|
||||
linksys,mr8300)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
;;
|
||||
avm,fritzbox-7530)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
;;
|
||||
avm,fritzrepeater-3000)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "4:lan:1" "5:lan:2"
|
||||
;;
|
||||
compex,wpj419|\
|
||||
compex,wpj428|\
|
||||
engenius,eap2200)
|
||||
ucidef_set_interface_lan "eth0 eth1"
|
||||
;;
|
||||
buffalo,wtr-m2133hp)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
;;
|
||||
cellc,rtl30vw)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "3:lan" "4:lan"
|
||||
;;
|
||||
devolo,magic-2-wifi-next)
|
||||
ucidef_set_interface_lan "eth0 eth1 eth2"
|
||||
;;
|
||||
ezviz,cs-w3-wd1200g-eup)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan"
|
||||
;;
|
||||
glinet,gl-ap1300 |\
|
||||
glinet,gl-b1300 |\
|
||||
glinet,gl-s1300)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "3:lan" "4:lan"
|
||||
;;
|
||||
mobipromo,cm520-79f)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "3:lan:2" "4:lan:1"
|
||||
ucidef_set_interface_wan "eth1"
|
||||
;;
|
||||
qxwlan,e2600ac-c1 |\
|
||||
qxwlan,e2600ac-c2)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
;;
|
||||
unielec,u4019-32m)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
;;
|
||||
um-325ac |\
|
||||
um-510ac-v3 |\
|
||||
um-550ac)
|
||||
ucidef_set_interface_wan "eth0"
|
||||
ucidef_set_interface_lan "eth1"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported hardware. Network interfaces not initialized"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ipq40xx_setup_macs()
|
||||
{
|
||||
local board="$1"
|
||||
local lan_mac=""
|
||||
local wan_mac=""
|
||||
local label_mac=""
|
||||
|
||||
case "$board" in
|
||||
8dev,habanero-dvk)
|
||||
label_mac=$(mtd_get_mac_binary "ART" 0x1006)
|
||||
;;
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
|
||||
lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
cilab,meshpoint-one)
|
||||
label_mac=$(mtd_get_mac_binary "ART" 0x1006)
|
||||
;;
|
||||
devolo,magic-2-wifi-next)
|
||||
lan_mac=$(mtd_get_mac_ascii APPSBLENV MacAddress0)
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
dlink,dap-2610)
|
||||
lan_mac=$(mtd_get_mac_ascii bdcfg lanmac)
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
engenius,eap2200|\
|
||||
engenius,emd1)
|
||||
lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
engenius,emr3500)
|
||||
wan_mac=$(mtd_get_mac_ascii 0:APPSBLENV wanaddr)
|
||||
lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
engenius,ens620ext)
|
||||
wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
lan_mac=$(macaddr_add "$wan_mac" 1)
|
||||
;;
|
||||
ezviz,cs-w3-wd1200g-eup)
|
||||
label_mac=$(mtd_get_mac_binary "ART" 0x6)
|
||||
;;
|
||||
linksys,ea6350v3)
|
||||
wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
|
||||
lan_mac=$(macaddr_add "$wan_mac" 1)
|
||||
;;
|
||||
mikrotik,hap-ac2)
|
||||
wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
|
||||
lan_mac=$(macaddr_add $wan_mac 1)
|
||||
label_mac="$wan_mac"
|
||||
;;
|
||||
mikrotik,sxtsq-5-ac)
|
||||
lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
|
||||
label_mac="$lan_mac"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
||||
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
||||
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
||||
}
|
||||
|
||||
board_config_update
|
||||
board=$(board_name)
|
||||
ipq40xx_setup_interfaces $board
|
||||
ipq40xx_setup_macs $board
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
cellc,rtl30vw)
|
||||
ucidef_add_gpio_switch "w_disable" "W_DISABLE mPCIE pin" "398" "1"
|
||||
ucidef_add_gpio_switch "pmd_resin_n" "PMD_RESIN_N pin" "399" "1"
|
||||
ucidef_add_gpio_switch "mcpie_vcc" "LTE power" "400" "0"
|
||||
ucidef_add_gpio_switch "usb_vcc" "USB power" "401" "0"
|
||||
;;
|
||||
cilab,meshpoint-one)
|
||||
ucidef_add_gpio_switch "poe_passtrough" "POE passtrough enable" "413" "1"
|
||||
;;
|
||||
compex,wpj428)
|
||||
ucidef_add_gpio_switch "sim_card_select" "SIM card select" "3" "0"
|
||||
;;
|
||||
wallys,dr40x9)
|
||||
ucidef_add_gpio_switch "sim_card_select" "SIM card select" "423" "0"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -1,315 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||
|
||||
. /lib/functions/caldata.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$FIRMWARE" in
|
||||
"ath10k/cal-pci-0000:01:00.0.bin")
|
||||
case "$board" in
|
||||
meraki,mr33)
|
||||
caldata_extract_ubi "ART" 0x9000 0x844
|
||||
caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
||||
case "$board" in
|
||||
asus,map-ac2200)
|
||||
caldata_extract_ubi "Factory" 0x9000 0x2f20
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
;;
|
||||
avm,fritzrepeater-3000)
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
||||
;;
|
||||
buffalo,wtr-m2133hp)
|
||||
caldata_extract "ART" 0x9000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x32)
|
||||
;;
|
||||
engenius,eap2200 |\
|
||||
openmesh,a62 |\
|
||||
plasmacloud,pa2200)
|
||||
caldata_extract "0:ART" 0x9000 0x2f20
|
||||
;;
|
||||
linksys,ea8300 |\
|
||||
linksys,mr8300)
|
||||
caldata_extract "ART" 0x9000 0x2f20
|
||||
# OEM assigns 4 sequential MACs
|
||||
ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
|
||||
;;
|
||||
tp-link,ec420-g1)
|
||||
caldata_extract "0:ART" 0x9000 0x2f20
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath10k/pre-cal-ahb-a000000.wifi.bin")
|
||||
case "$board" in
|
||||
8dev,habanero-dvk |\
|
||||
8dev,jalapeno |\
|
||||
alfa-network,ap120c-ac |\
|
||||
cilab,meshpoint-one |\
|
||||
ezviz,cs-w3-wd1200g-eup |\
|
||||
glinet,gl-ap1300 |\
|
||||
glinet,gl-b1300 |\
|
||||
glinet,gl-s1300 |\
|
||||
linksys,ea6350v3 |\
|
||||
mobipromo,cm520-79f |\
|
||||
udaya,a5-id2 |\
|
||||
qcom,ap-dk01.1-c1)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
;;
|
||||
aruba,ap-303 |\
|
||||
aruba,ap-303h |\
|
||||
aruba,ap-365)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary mfginfo 0x1D)
|
||||
;;
|
||||
asus,map-ac2200)
|
||||
caldata_extract_ubi "Factory" 0x1000 0x2f20
|
||||
;;
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
caldata_extract_ubi "Factory" 0x1000 0x2f20
|
||||
;;
|
||||
avm,fritzbox-4040)
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
||||
;;
|
||||
avm,fritzbox-7530 |\
|
||||
avm,fritzrepeater-1200 |\
|
||||
avm,fritzrepeater-3000)
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
||||
;;
|
||||
buffalo,wtr-m2133hp)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x26)
|
||||
;;
|
||||
cig,wf610d)
|
||||
caldata_extract "0:ART" 0x1000 0x2f20
|
||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +2)
|
||||
;;
|
||||
cellc,rtl30vw |\
|
||||
compex,wpj419 |\
|
||||
compex,wpj428 |\
|
||||
edgecore,ecw5211 |\
|
||||
edgecore,spw2ac1200 |\
|
||||
edgecore,spw2ac1200-lan-poe |\
|
||||
edgecore,oap100 |\
|
||||
edgecore,oap100e |\
|
||||
engenius,eap1300 |\
|
||||
engenius,eap2200 |\
|
||||
luma,wrtq-329acn|\
|
||||
openmesh,a42 |\
|
||||
openmesh,a62 |\
|
||||
plasmacloud,pa1200 |\
|
||||
plasmacloud,pa2200 |\
|
||||
qxwlan,e2600ac-c1 |\
|
||||
qxwlan,e2600ac-c2 |\
|
||||
unielec,u4019-32m |\
|
||||
wallys,dr40x9)
|
||||
caldata_extract "0:ART" 0x1000 0x2f20
|
||||
;;
|
||||
devolo,magic-2-wifi-next)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress0)
|
||||
;;
|
||||
dlink,dap-2610)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac)
|
||||
;;
|
||||
engenius,emd1)
|
||||
caldata_extract "0:ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr)
|
||||
;;
|
||||
engenius,emr3500)
|
||||
caldata_extract "0:ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
||||
;;
|
||||
engenius,ens620ext)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
|
||||
;;
|
||||
linksys,ea8300 |\
|
||||
linksys,mr8300)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
|
||||
;;
|
||||
meraki,mr33)
|
||||
caldata_extract_ubi "ART" 0x1000 0x2f20
|
||||
caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2)
|
||||
;;
|
||||
mikrotik,hap-ac2)
|
||||
wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
|
||||
( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x0 0x2f20 ) || \
|
||||
( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_0" 0x0 0x2f20 )
|
||||
;;
|
||||
netgear,ex6100v2 |\
|
||||
netgear,ex6150v2)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0)
|
||||
;;
|
||||
zyxel,nbg6617 |\
|
||||
zyxel,wre6606)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
||||
;;
|
||||
tp-link,ec420-g1)
|
||||
caldata_extract "0:ART" 0x1000 0x2f20
|
||||
;;
|
||||
hfcl,ion4)
|
||||
caldata_extract "0:ART" 4096 12064
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN0_BASEMAC)
|
||||
;;
|
||||
um-325ac |\
|
||||
um-510ac-v3 |\
|
||||
um-550ac)
|
||||
caldata_extract "ART" 0x1000 0x2f20
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath10k/pre-cal-ahb-a800000.wifi.bin")
|
||||
case "$board" in
|
||||
8dev,habanero-dvk |\
|
||||
8dev,jalapeno |\
|
||||
alfa-network,ap120c-ac |\
|
||||
cilab,meshpoint-one |\
|
||||
ezviz,cs-w3-wd1200g-eup |\
|
||||
glinet,gl-ap1300 |\
|
||||
glinet,gl-b1300 |\
|
||||
glinet,gl-s1300 |\
|
||||
linksys,ea6350v3 |\
|
||||
mobipromo,cm520-79f |\
|
||||
udaya,a5-id2 |\
|
||||
qcom,ap-dk01.1-c1)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
;;
|
||||
aruba,ap-303 |\
|
||||
aruba,ap-303h |\
|
||||
aruba,ap-365)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mfginfo 0x1D) +1)
|
||||
;;
|
||||
asus,map-ac2200)
|
||||
caldata_extract_ubi "Factory" 0x5000 0x2f20
|
||||
;;
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
caldata_extract_ubi "Factory" 0x5000 0x2f20
|
||||
;;
|
||||
avm,fritzbox-4040)
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
||||
;;
|
||||
avm,fritzbox-7530 |\
|
||||
avm,fritzrepeater-1200 |\
|
||||
avm,fritzrepeater-3000)
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
||||
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
||||
;;
|
||||
buffalo,wtr-m2133hp)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x2c)
|
||||
;;
|
||||
cig,wf610d)
|
||||
caldata_extract "0:ART" 0x5000 0x2f20
|
||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +3)
|
||||
;;
|
||||
cellc,rtl30vw |\
|
||||
compex,wpj419 |\
|
||||
compex,wpj428 |\
|
||||
edgecore,ecw5211 |\
|
||||
edgecore,spw2ac1200 |\
|
||||
edgecore,spw2ac1200-lan-poe |\
|
||||
edgecore,oap100 |\
|
||||
edgecore,oap100e |\
|
||||
engenius,eap1300 |\
|
||||
engenius,eap2200 |\
|
||||
luma,wrtq-329acn|\
|
||||
openmesh,a42 |\
|
||||
openmesh,a62 |\
|
||||
plasmacloud,pa1200 |\
|
||||
plasmacloud,pa2200 |\
|
||||
qxwlan,e2600ac-c1 |\
|
||||
qxwlan,e2600ac-c2 |\
|
||||
unielec,u4019-32m |\
|
||||
wallys,dr40x9)
|
||||
caldata_extract "0:ART" 0x5000 0x2f20
|
||||
;;
|
||||
devolo,magic-2-wifi-next)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress1)
|
||||
;;
|
||||
dlink,dap-2610)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
|
||||
;;
|
||||
engenius,emd1)
|
||||
caldata_extract "0:ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr) +1)
|
||||
;;
|
||||
engenius,emr3500)
|
||||
caldata_extract "0:ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1)
|
||||
;;
|
||||
engenius,ens620ext)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
|
||||
;;
|
||||
linksys,ea8300 |\
|
||||
linksys,mr8300)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
||||
;;
|
||||
meraki,mr33)
|
||||
caldata_extract_ubi "ART" 0x5000 0x2f20
|
||||
caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
|
||||
;;
|
||||
mikrotik,hap-ac2|\
|
||||
mikrotik,sxtsq-5-ac)
|
||||
wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
|
||||
( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x8000 0x2f20 ) || \
|
||||
( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_2" 0x0 0x2f20 )
|
||||
;;
|
||||
netgear,ex6100v2 |\
|
||||
netgear,ex6150v2)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc)
|
||||
;;
|
||||
zyxel,nbg6617 |\
|
||||
zyxel,wre6606)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
||||
;;
|
||||
hfcl,ion4)
|
||||
caldata_extract "0:ART" 20480 12064
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN1_BASEMAC)
|
||||
;;
|
||||
um-325ac |\
|
||||
um-510ac-v3 |\
|
||||
um-550ac)
|
||||
caldata_extract "ART" 0x5000 0x2f20
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||
|
||||
|
||||
fwcfg_symlink() {
|
||||
local chip=$1
|
||||
local path=$2
|
||||
|
||||
ln -s /lib/firmware/ath10k/fwcfg-${chip}.txt /lib/firmware/${FIRMWARE}
|
||||
}
|
||||
|
||||
case "$FIRMWARE" in
|
||||
ath10k/fwcfg-ahb-a000000.wifi.txt|\
|
||||
ath10k/fwcfg-ahb-a800000.wifi.txt)
|
||||
fwcfg_symlink ipq4019
|
||||
|
||||
;;
|
||||
ath10k/fwcfg-pci-0000:01:00.0.txt)
|
||||
case "$(board_name)" in
|
||||
linksys,ea8300)
|
||||
fwcfg_symlink qca9888
|
||||
;;
|
||||
tp-link,ap2220|\
|
||||
tp-link,ec420-g1)
|
||||
fwcfg_symlink qca9984
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ "$ACTION" = add ] || exit
|
||||
|
||||
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
|
||||
[ "$NPROCS" -gt 1 ] || exit
|
||||
|
||||
PROC_MASK="$(( (1 << $NPROCS) - 1 ))"
|
||||
|
||||
find_irq_cpu() {
|
||||
local dev="$1"
|
||||
local match="$(grep -m 1 "$dev\$" /proc/interrupts)"
|
||||
local cpu=0
|
||||
|
||||
[ -n "$match" ] && {
|
||||
set -- $match
|
||||
shift
|
||||
for cur in `seq 1 $NPROCS`; do
|
||||
[ "$1" -gt 0 ] && {
|
||||
cpu=$(($cur - 1))
|
||||
break
|
||||
}
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
echo "$cpu"
|
||||
}
|
||||
|
||||
set_hex_val() {
|
||||
local file="$1"
|
||||
local val="$2"
|
||||
val="$(printf %x "$val")"
|
||||
[ -n "$DEBUG" ] && echo "$file = $val"
|
||||
echo "$val" > "$file"
|
||||
}
|
||||
|
||||
default_ps="$(uci get "network.@globals[0].default_ps")"
|
||||
[ -n "$default_ps" -a "$default_ps" != 1 ] && exit 0
|
||||
|
||||
exec 512>/var/lock/smp_tune.lock
|
||||
flock 512 || exit 1
|
||||
|
||||
for dev in /sys/class/net/*; do
|
||||
[ -d "$dev" ] || continue
|
||||
|
||||
# ignore virtual interfaces
|
||||
[ -n "$(ls "${dev}/" | grep '^lower_')" ] && continue
|
||||
[ -d "${dev}/device" ] || continue
|
||||
|
||||
device="$(readlink "${dev}/device")"
|
||||
device="$(basename "$device")"
|
||||
irq_cpu="$(find_irq_cpu "$device")"
|
||||
irq_cpu_mask="$((1 << $irq_cpu))"
|
||||
|
||||
for q in ${dev}/queues/rx-*; do
|
||||
set_hex_val "$q/rps_cpus" "$(($PROC_MASK & ~$irq_cpu_mask))"
|
||||
done
|
||||
|
||||
ntxq="$(ls -d ${dev}/queues/tx-* | wc -l)"
|
||||
|
||||
idx=$(($irq_cpu + 1))
|
||||
for q in ${dev}/queues/tx-*; do
|
||||
set_hex_val "$q/xps_cpus" "$((1 << $idx))"
|
||||
let "idx = idx + 1"
|
||||
[ "$idx" -ge "$NPROCS" ] && idx=0
|
||||
done
|
||||
done
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
boot() {
|
||||
case $(board_name) in
|
||||
alfa-network,ap120c-ac)
|
||||
[ -n "$(fw_printenv bootcount changed 2>/dev/null)" ] &&\
|
||||
echo -e "bootcount\nchanged\n" | /usr/sbin/fw_setenv -s -
|
||||
;;
|
||||
linksys,ea6350v3|\
|
||||
linksys,ea8300|\
|
||||
linksys,mr8300)
|
||||
mtd resetbc s_env || true
|
||||
;;
|
||||
edgecore,ecw5211)
|
||||
part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | cut -d " " -f1)"
|
||||
case "$part" in
|
||||
rootfs1|\
|
||||
rootfs2)
|
||||
avail=$(fw_printenv -n upgrade_available)
|
||||
[ ${avail} -ne 1 ] && fw_setenv upgrade_available 1
|
||||
fw_setenv bootcount 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
edgecore,spw2ac1200|\
|
||||
edgecore,spw2ac1200-lan-poe)
|
||||
avail=$(fw_printenv -n upgrade_available)
|
||||
[ ${avail} -eq 0 ] || {
|
||||
fw_setenv upgrade_available 0
|
||||
fw_setenv bootcount 0
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Copyright (c) 2013 The Linux Foundation. All rights reserved.
|
||||
::sysinit:/etc/init.d/rcS S boot
|
||||
::shutdown:/etc/init.d/rcS K shutdown
|
||||
ttyMSM0::askfirst:/usr/libexec/login.sh
|
||||
ttyMSM1::askfirst:/usr/libexec/login.sh
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user