建立 MAG160C 逆向工程交接仓库
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Task 4 Report
|
||||
|
||||
status: DONE_WITH_CONCERNS
|
||||
|
||||
## Files created/modified
|
||||
|
||||
- CMakeLists.txt
|
||||
- include/mag160c/mag160c.h
|
||||
- src/core/device.hpp
|
||||
- src/core/device.cpp
|
||||
- src/c_api.cpp
|
||||
- tests/cpp/test_c_api.cpp
|
||||
- tests/cpp/test_device_model.cpp
|
||||
- progress.md
|
||||
|
||||
## Commands run
|
||||
|
||||
```powershell
|
||||
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\core\tcm_device.cpp src\core\device.cpp src\c_api.cpp tests\cpp\test_c_api.cpp -o build_task4_c_api_test.exe
|
||||
.\build_task4_c_api_test.exe
|
||||
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\core\tcm_device.cpp src\core\device.cpp src\c_api.cpp tests\cpp\test_device_model.cpp -o build_task4_device_model_test.exe
|
||||
.\build_task4_device_model_test.exe
|
||||
```
|
||||
|
||||
## Test results
|
||||
|
||||
- Direct MinGW C++17 compile/run verification passed for test_c_api.
|
||||
- Direct MinGW C++17 compile/run verification passed for test_device_model.
|
||||
|
||||
## Concerns
|
||||
|
||||
- CMake/CTest verification remains unavailable because cmake is not installed or not on PATH.
|
||||
- libusb-enabled enumeration path is implemented under conditional compilation but not compiled in this environment because MAG160C_HAS_LIBUSB=0.
|
||||
- Generated local executables build_task4_c_api_test.exe and build_task4_device_model_test.exe exist from substitute verification.
|
||||
|
||||
## Self-review notes
|
||||
|
||||
- Endpoint pair selection returns first bulk IN and first bulk OUT.
|
||||
- No-libusb list_devices path returns MAG160C_ERR_UNSUPPORTED and clears output pointers/count through the C ABI.
|
||||
- C ABI device list allocation uses new[] and free uses delete[].
|
||||
- Public device info struct uses only C-compatible fields.
|
||||
|
||||
## Fix report: libusb-enabled list_devices test compatibility
|
||||
|
||||
status: DONE
|
||||
|
||||
### Files modified
|
||||
|
||||
- CMakeLists.txt
|
||||
- tests/cpp/test_c_api.cpp
|
||||
|
||||
### Commands run
|
||||
|
||||
```powershell
|
||||
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\core\tcm_device.cpp src\core\device.cpp src\c_api.cpp tests\cpp\test_c_api.cpp -o build_task4_c_api_test.exe
|
||||
.\build_task4_c_api_test.exe
|
||||
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\core\tcm_device.cpp src\core\device.cpp src\c_api.cpp tests\cpp\test_device_model.cpp -o build_task4_device_model_test.exe
|
||||
.\build_task4_device_model_test.exe
|
||||
```
|
||||
|
||||
### Test results
|
||||
|
||||
- Direct MinGW C++17 compile/run verification passed for test_c_api.
|
||||
- Direct MinGW C++17 compile/run verification passed for test_device_model.
|
||||
|
||||
### Self-review
|
||||
|
||||
- test_c_api now expects MAG160C_ERR_UNSUPPORTED only when MAG160C_HAS_LIBUSB is 0.
|
||||
- test_c_api accepts MAG160C_OK and frees any returned device list when MAG160C_HAS_LIBUSB is 1.
|
||||
- CMake now propagates MAG160C_HAS_LIBUSB to test_c_api via MAG160C_HAS_LIBUSB_VALUE.
|
||||
Reference in New Issue
Block a user