差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
en:stpc-sxxx-3568b [2026/11/14 00:49]
wjj Style English Note blocks like the Chinese 提示 blocks
en:stpc-sxxx-3568b [2026/11/14 05:26] (当前版本)
wjj Typographic fix: en dash in 7.4 note
行 276: 行 276:
   #bodyContent .sml-doc p.sml-note{min-width:min(100%,240px)!important;}   #bodyContent .sml-doc p.sml-note{min-width:min(100%,240px)!important;}
 } }
 +.sml-3d{position:absolute;inset:0;display:none;z-index:4;background:#f3f6fa;}.sml-g-stage.on3d{height:430px;}.sml-g-stage.on3d>*:not(.sml-3d){visibility:hidden;}.sml-g-stage.on3d .sml-3d{display:block;}.sml-g-side.on3d{justify-content:flex-start;}.sml-g-side.on3d button.sml-g-thumb{flex:0 0 auto;min-height:38px;}button.sml-g-thumb[data-3d] svg{display:block;width:100%;height:100%;}@media (max-width:900px){.sml-g-stage.on3d{height:330px;}.sml-g-side{flex-wrap:wrap!important;gap:4px!important;}button.sml-g-thumb{flex:1 1 calc(33.333% - 3px)!important;min-width:0;}.sml-g-side.on3d button.sml-g-thumb{min-height:44px;}.sml-g-cap{max-width:calc(100% - 78px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}}
 +.sml-g-side{flex:0 0 168px;}
 </style></html> </style></html>
 <html><script> <html><script>
行 316: 行 318:
 <li class="l1"><a href="#interfaces_and_dimensions">2 Interfaces and Dimensions</a></li> <li class="l1"><a href="#interfaces_and_dimensions">2 Interfaces and Dimensions</a></li>
 <li class="l2"><a href="#exterior_views">2.1 Exterior Views</a></li> <li class="l2"><a href="#exterior_views">2.1 Exterior Views</a></li>
-<li class="l2"><a href="#interface_diagram">2.2 Interface Diagram</a></li> +<li class="l2"><a href="#interface_overview">2.2 Interface Overview</a></li> 
-<li class="l2"><a href="#mechanical_dimensions">2.3 Mechanical Dimensions</a></li> +<li class="l2"><a href="#interface_pin_definitions">2.3 Interface Pin Definitions</a></li> 
-<li class="l1"><a href="#product_development_resources">3 Product Development Resources</a></li>+<li class="l2"><a href="#mechanical_dimensions">2.4 Mechanical Dimensions</a></li> 
 +<li class="l3"><a href="#quick_start">3 Quick Start</a></li> 
 +<li class="l2"><a href="#system_download">3.1 System Download</a></li> 
 +<li class="l2"><a href="#flashing_tool_download">3.2 Flashing Tool Download</a></li> 
 +<li class="l2"><a href="#system_flashing">3.3 System Flashing</a></li> 
 +<li class="l2"><a href="#android_system_upgrade">3.4 Android System Upgrade</a></li> 
 +<li class="l1"><a href="#before_you_start">3.4.1 Before You Start</a></li> 
 +<li class="l1"><a href="#prepare_updateimg">3.4.2 Prepare update.img</a></li> 
 +<li class="l1"><a href="#local_upgrade_via_usb_drive">3.4.3 Local Upgrade via USB Drive</a></li> 
 +<li class="l1"><a href="#ota_update_android">3.4.4 OTA Update (Android)</a></li> 
 +<li class="l3"><a href="#android_system_usage">4 Android System Usage</a></li> 
 +<li class="l2"><a href="#enable_adb_debugging">4.1 Enable ADB Debugging</a></li> 
 +<li class="l1"><a href="#usb_adb_usage">4.1.1 USB ADB Usage</a></li> 
 +<li class="l1"><a href="#network_adb_usage">4.1.2 Network ADB Usage</a></li> 
 +<li class="l2"><a href="#wifi_usage">4.2 WiFi Usage</a></li> 
 +<li class="l2"><a href="#ethernet_usage">4.3 Ethernet Usage</a></li> 
 +<li class="l2"><a href="#g_module_usage">4.4 4G Module Usage</a></li> 
 +<li class="l1"><a href="#support_list">4.4.1 Support List</a></li> 
 +<li class="l1"><a href="#steps">4.4.2 Steps</a></li> 
 +<li class="l2"><a href="#serial_port_usage">4.5 Serial Port Usage</a></li> 
 +<li class="l1"><a href="#test_tool_comassistant">4.5.1 Test Tool ComAssistant</a></li> 
 +<li class="l1"><a href="#test_method">4.5.2 Test Method</a></li> 
 +<li class="l1"><a href="#application-layer_calls">4.5.3 Application-Layer Calls</a></li> 
 +<li class="l2"><a href="#usb_and_sd_card">4.6 USB and SD Card</a></li> 
 +<li class="l2"><a href="#audio_test">4.7 Audio Test</a></li> 
 +<li class="l2"><a href="#hdmi_and_dual_display">4.8 HDMI and Dual Display</a></li> 
 +<li class="l2"><a href="#button_and_indicator_led_test">4.9 Button and Indicator LED Test</a></li> 
 +<li class="l2"><a href="#touch_screen_test">4.10 Touch Screen Test</a></li> 
 +<li class="l2"><a href="#gpio_usage">4.11 GPIO Usage</a></li> 
 +<li class="l2"><a href="#api_reference_and_usage">4.12 API Reference and Usage</a></li> 
 +<li class="l1"><a href="#usage_instructions">4.12.1 Usage Instructions</a></li> 
 +<li class="l1"><a href="#hardware_and_system_information_query">4.12.2 Hardware and System Information Query</a></li> 
 +<li class="l1"><a href="#display_control_display">4.12.3 Display Control (display_)</a></li> 
 +<li class="l1"><a href="#gpio_control_gpio">4.12.4 GPIO Control (gpio_)</a></li> 
 +<li class="l1"><a href="#serial_port_control_uart">4.12.5 Serial Port Control (uart_)</a></li> 
 +<li class="l1"><a href="#system_control_sysctrl">4.12.6 System Control (sysctrl_)</a></li> 
 +<li class="l3"><a href="#linux_system_usage">5 Linux System Usage</a></li> 
 +<li class="l2"><a href="#sound_card_usage">5.1 Sound Card Usage</a></li> 
 +<li class="l2"><a href="#network_usage">5.2 Network Usage</a></li> 
 +<li class="l1"><a href="#ethernet">5.2.1 Ethernet</a></li> 
 +<li class="l1"><a href="#wifi">5.2.2 WiFi</a></li> 
 +<li class="l2"><a href="#serial_port_usage_linux">5.3 Serial Port Usage (Linux)</a></li> 
 +<li class="l2"><a href="#gpio_usage_sysfs">5.4 GPIO Usage (sysfs)</a></li> 
 +<li class="l2"><a href="#usb_and_sd_card_mounting">5.5 USB and SD Card Mounting</a></li> 
 +<li class="l2"><a href="#resolution_and_hdmi">5.6 Resolution and HDMI</a></li> 
 +<li class="l2"><a href="#remote_access_and_file_transfer">5.7 Remote Access and File Transfer</a></li> 
 +<li class="l2"><a href="#auto-run_programs_at_boot">5.8 Auto-run Programs at Boot</a></li> 
 +<li class="l1"><a href="#execute_before_login">5.8.1 Execute Before Login</a></li> 
 +<li class="l1"><a href="#execute_after_login">5.8.2 Execute After Login</a></li> 
 +<li class="l1"><a href="#execute_after_entering_the_graphical_interface">5.8.3 Execute After Entering the Graphical Interface</a></li> 
 +<li class="l2"><a href="#ui_and_display_customization">5.9 UI and Display Customization</a></li> 
 +<li class="l1"><a href="#status_bar_customization">5.9.1 Status Bar Customization</a></li> 
 +<li class="l1"><a href="#disable_the_desktop_environment">5.9.2 Disable the Desktop Environment</a></li> 
 +<li class="l1"><a href="#replace_the_boot_logo">5.9.3 Replace the Boot LOGO</a></li> 
 +<li class="l1"><a href="#switching_between_different_lcd_displays">5.9.4 Switching Between Different LCD Displays</a></li> 
 +<li class="l1"><a href="#screen_rotation">5.9.5 Screen Rotation</a></li> 
 +<li class="l2"><a href="#ota_firmware_update">5.10 OTA Firmware Update</a></li> 
 +<li class="l1"><a href="#ota_over_network">5.10.1 OTA over Network</a></li> 
 +<li class="l1"><a href="#ota_update_via_usb_drive">5.10.2 OTA Update via USB Drive</a></li> 
 +<li class="l2"><a href="#cross-compilation_environment">5.11 Cross-Compilation Environment</a></li> 
 +<li class="l1"><a href="#install_the_cross-compilation_environment_via_apt">5.11.1 Install the Cross-Compilation Environment via apt</a></li> 
 +<li class="l1"><a href="#download_a_specific_toolchain_version">5.11.2 Download a Specific Toolchain Version</a></li> 
 +<li class="l1"><a href="#toolchain_downloads">5.11.3 Toolchain Downloads</a></li> 
 +<li class="l2"><a href="#qt_application_development">5.12 Qt Application Development</a></li> 
 +<li class="l1"><a href="#import_a_docker_image_for_compilation">5.12.1 Import a Docker Image for Compilation</a></li> 
 +<li class="l1"><a href="#set_up_the_qt_build_environment_on_the_board">5.12.2 Set Up the Qt Build Environment on the Board</a></li> 
 +<li class="l2"><a href="#video_hardware_codec_support">5.13 Video Hardware Codec Support</a></li> 
 +<li class="l3"><a href="#general_methods">6 General Methods</a></li> 
 +<li class="l2"><a href="#check_cpu_temperature">6.1 Check CPU Temperature</a></li> 
 +<li class="l2"><a href="#check_the_cpu_serial_number">6.2 Check the CPU Serial Number</a></li> 
 +<li class="l2"><a href="#check_cpu_frequency">6.3 Check CPU Frequency</a></li> 
 +<li class="l2"><a href="#check_memory_capacity">6.4 Check Memory Capacity</a></li> 
 +<li class="l2"><a href="#check_storage_capacity">6.5 Check Storage Capacity</a></li> 
 +<li class="l2"><a href="#network_ping_test">6.6 Network Ping Test</a></li> 
 +<li class="l2"><a href="#set_system_time_and_save_to_the_rtc_chip">6.7 Set System Time and Save to the RTC Chip</a></li> 
 +<li class="l3"><a href="#appendix">7 Appendix</a></li> 
 +<li class="l2"><a href="#faq_troubleshooting">7.1 FAQ Troubleshooting</a></li> 
 +<li class="l2"><a href="#document_information_and_revision_history">7.2 Document Information and Revision History</a></li> 
 +<li class="l2"><a href="#technical_support">7.3 Technical Support</a></li> 
 +<li class="l2"><a href="#development_resources">7.4 Development Resources</a></li>
 </ul> </ul>
 </div></div> </div></div>
 <div class="sml-gallery"> <div class="sml-gallery">
-<div class="sml-g-head"><div><div class="sml-g-kicker">PRODUCT GALLERY / PRODUCT GALLERY</div><div class="sml-g-title">sTPC-SXXX-3568B Series · Exterior</div></div><div class="sml-g-note">Shown on the S156 model · click a view on the right</div></div> +<div class="sml-g-head"><div><div class="sml-g-kicker">PRODUCT GALLERY</div><div class="sml-g-title">sTPC-SXXX-3568B Series · Exterior</div></div><div class="sml-g-note">Shown on the S156 model · click a view on the right</div></div> 
-<div class="sml-g-body"><div class="sml-g-stage"><img id="sml-g-main" class="sml-g-main" src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front_v.jpg" alt="Front view · Full-flat capacitive touch glass, plastic bezel"><div class="sml-g-badge">PANEL PC</div><a id="sml-g-zoom" class="sml-g-zoom" href="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front.jpg" target="_blank" rel="noopener">Open full size ↗</a><div class="sml-g-cap" id="sml-g-cap">Front view · Full-flat capacitive touch glass, plastic bezel</div><div class="sml-g-count" id="sml-g-count">01 / 05</div></div> +<div class="sml-g-body"><div class="sml-g-stage"><img id="sml-g-main" class="sml-g-main" src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front_v.jpg" alt="Front view · Full-flat capacitive touch glass, plastic bezel"><div class="sml-g-badge">PANEL PC</div><a id="sml-g-zoom" class="sml-g-zoom" href="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front.jpg" target="_blank" rel="noopener">Open full size ↗</a><div class="sml-3d" id="sml-3d"></div><div class="sml-g-cap" id="sml-g-cap">Front view · Capacitive touch panel</div><div class="sml-g-count" id="sml-g-count">01 / 06</div></div> 
-<div class="sml-g-side"><div class="sml-g-side-hd">05 VIEWS</div> +<div class="sml-g-side"><div class="sml-g-side-hd">06 VIEWS</div> 
-<button type="button" class="sml-g-thumb on" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front.jpg" data-idx="01" data-cap="Front view · Full-flat capacitive touch glass, plastic bezel"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_01.jpg" alt="Front view"></span><span class="sml-g-tx"><b>VIEW 01</b>Front view</span></button> +<button type="button" class="sml-g-thumb on" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_front.jpg" data-idx="01" data-cap="Front view · Capacitive touch panel"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_01.jpg" alt="Front view"></span><span class="sml-g-tx"><b>SLC</b>Front view</span></button> 
-<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_persp_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_persp.jpg" data-idx="02" data-cap="Perspective · Raised rear expansion bay, fanless structure"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_02.jpg" alt="Perspective"></span><span class="sml-g-tx"><b>VIEW 02</b>Perspective</span></button> +<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_persp_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_persp.jpg" data-idx="02" data-cap="Perspective · Main module"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_02.jpg" alt="Perspective"></span><span class="sml-g-tx"><b>SLC</b>Perspective</span></button> 
-<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_back_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_back.jpg" data-idx="03" data-cap="Back view · Brushed SUS201 stainless rear housing, VESA holes"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_03.jpg" alt="Back view"></span><span class="sml-g-tx"><b>VIEW 03</b>Back view</span></button> +<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_back_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_back.jpg" data-idx="03" data-cap="Back view · Mounting back plate"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_03.jpg" alt="Back view"></span><span class="sml-g-tx"><b>SLC</b>Back view</span></button> 
-<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_a_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_a.jpg" data-idx="04" data-cap="Lower I/O row · Power, serial, HDMI, LAN and USB in one row"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_04.jpg" alt="Lower I/O row"></span><span class="sml-g-tx"><b>VIEW 04</b>Lower I/O row</span></button> +<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_a_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_a.jpg" data-idx="04" data-cap="Lower I/O row · Power and network"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_04.jpg" alt="Lower I/O row"></span><span class="sml-g-tx"><b>SLC</b>Lower I/O row</span></button> 
-<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_b_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_b.jpg" data-idx="05" data-cap="Upper I/O row · SIM, antennas, speaker and GPIO header"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_05.jpg" alt="Upper I/O row"></span><span class="sml-g-tx"><b>VIEW 05</b>Upper I/O row</span></button>+<button type="button" class="sml-g-thumb" data-view="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_b_v.jpg" data-full="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_io_b.jpg" data-idx="05" data-cap="Upper I/O row · SIM and antennas"><span class="sml-g-tn"><img src="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_thumb_05.jpg" alt="Upper I/O row"></span><span class="sml-g-tx"><b>SLC</b>Upper I/O row</span></button> 
 +<button type="button" class="sml-g-thumb" data-3d="1" data-idx="06" data-zip="/dokuwiki/lib/exe/fetch.php?media=wiki:stpc_s156_3d.zip" data-lang="en" data-size="about 1.3 MB" data-rear="3" data-parts="[[&quot;机身中框&quot;,&quot;Mid Frame&quot;,&quot;#363a3f&quot;,0.0,1],[&quot;视窗玻璃&quot;,&quot;Front Glass&quot;,&quot;#101113&quot;,1.55,1],[&quot;显示模组&quot;,&quot;Display Module&quot;,&quot;#2a2e33&quot;,1.05,1],[&quot;后盖&quot;,&quot;Rear Cover&quot;,&quot;#f3f5f7&quot;,1.45,-1],[&quot;主板载板&quot;,&quot;Carrier Board&quot;,&quot;#2f6f59&quot;,0.55,1],[&quot;屏线组件&quot;,&quot;Panel Cable&quot;,&quot;#c9a227&quot;,0.55,1],[&quot;天线/顶条&quot;,&quot;Antenna Bar&quot;,&quot;#7b5ea7&quot;,0.6,-1],[&quot;固定卡扣&quot;,&quot;Clip&quot;,&quot;#8e99a6&quot;,0.3,-1],[&quot;固定卡扣&quot;,&quot;Clip&quot;,&quot;#8e99a6&quot;,0.3,-1],[&quot;紧固件&quot;,&quot;Fastener&quot;,&quot;#8e99a6&quot;,0.3,-1],[&quot;下侧接口座&quot;,&quot;I/O Block&quot;,&quot;#a45a52&quot;,0.45,-1],[&quot;接地弹片&quot;,&quot;Ground Spring&quot;,&quot;#9aa4b0&quot;,0.2,-1],[&quot;竖向排线&quot;,&quot;Vertical FPC&quot;,&quot;#c9a227&quot;,0.45,-1],[&quot;接地弹片&quot;,&quot;Ground Spring&quot;,&quot;#9aa4b0&quot;,0.2,-1],[&quot;喇叭&quot;,&quot;Speaker&quot;,&quot;#a45a52&quot;,0.45,-1],[&quot;主板组件&quot;,&quot;Main Board&quot;,&quot;#2f6f5c&quot;,0.75,-1],[&quot;前面框&quot;,&quot;Front Bezel&quot;,&quot;#191b1e&quot;,1.75,1]]" data-cap="3D Teardown · Part structure"><span class="sml-g-tn"><svg viewBox="0 0 44 30" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><g fill="none" stroke="#0b5394" stroke-width="1.3" stroke-linejoin="round"><path d="M12 8 L22 3 L32 8 L22 13 Z"/><path d="M12 8 L12 20 L22 25 L22 13"/><path d="M32 8 L32 20 L22 25"/><path d="M17 5.5 L27 10.5" stroke="#8fb2d6" stroke-width="1"/></g></svg></span><span class="sml-g-tx"><b>SLC</b>3D Teardown</span></button>
 </div></div> </div></div>
 <div class="sml-g-specs"><div class="sml-g-spec"><b>RK3568</b><em>Quad Cortex-A55 · 1TOPS NPU</em></div><div class="sml-g-spec"><b>10.1″–21.5″</b><em>Three sizes · capacitive</em></div><div class="sml-g-spec"><b>Fanless</b><em>VESA / panel cutout</em></div><div class="sml-g-spec"><b>Dual OS</b><em>Android 11 / Ubuntu 22.04</em></div></div> <div class="sml-g-specs"><div class="sml-g-spec"><b>RK3568</b><em>Quad Cortex-A55 · 1TOPS NPU</em></div><div class="sml-g-spec"><b>10.1″–21.5″</b><em>Three sizes · capacitive</em></div><div class="sml-g-spec"><b>Fanless</b><em>VESA / panel cutout</em></div><div class="sml-g-spec"><b>Dual OS</b><em>Android 11 / Ubuntu 22.04</em></div></div>
行 505: 行 587:
  
 ===== 1 Product Specifications ===== ===== 1 Product Specifications =====
- 
 ==== 1.1 Overview ==== ==== 1.1 Overview ====
- 
 The sTPC-SXXX-3568B Series (production models sTPC-S101-3568B / S156-3568B / S215-3568B) is a **fanless ARM Touch Panel PC (PANEL PC)** built on the Rockchip **RK3568** platform, covering 10.1″ / 15.6″ / 21.5″ screen sizes. The sTPC-SXXX-3568B Series (production models sTPC-S101-3568B / S156-3568B / S215-3568B) is a **fanless ARM Touch Panel PC (PANEL PC)** built on the Rockchip **RK3568** platform, covering 10.1″ / 15.6″ / 21.5″ screen sizes.
  
行 519: 行 599:
  
 ==== 1.2 General Specifications ==== ==== 1.2 General Specifications ====
- 
 ^ Item ^ Specification ^ ^ Item ^ Specification ^
 | **CPU** | Rockchip RK3568, quad-core 4 × Cortex-A55, up to 2.0GHz | | **CPU** | Rockchip RK3568, quad-core 4 × Cortex-A55, up to 2.0GHz |
行 544: 行 623:
  
 ==== 1.3 Screen and Mechanics ==== ==== 1.3 Screen and Mechanics ====
- 
 ^ Item ^ sTPC-S101-3568B ^ sTPC-S156-3568B ^ sTPC-S215-3568B ^ ^ Item ^ sTPC-S101-3568B ^ sTPC-S156-3568B ^ sTPC-S215-3568B ^
 | **Screen size** | 10.1″ TFT | 15.6″ TFT | 21.5″ TFT | | **Screen size** | 10.1″ TFT | 15.6″ TFT | 21.5″ TFT |
行 560: 行 638:
  
 ==== 1.4 Environmental and Reliability ==== ==== 1.4 Environmental and Reliability ====
- 
 ^ Item ^ Rating ^ ^ Item ^ Rating ^
 | **Relative humidity** | 5 ~ 95% @40℃ (non-condensing) | | **Relative humidity** | 5 ~ 95% @40℃ (non-condensing) |
行 568: 行 645:
  
 ==== 1.5 Models and Configurations ==== ==== 1.5 Models and Configurations ====
- 
 ^ Part number ^ Model ^ Description ^ ^ Part number ^ Model ^ Description ^
 | B11.AS101.38.0004 | sTPC-S101-3568B-2G-32G | Standard, 10.1″, RK3568, 2GB RAM, 32GB eMMC, capacitive touch 1280×800, DC 12V input, 1 × GLAN, 2 × USB3.0 + 2 × USB2.0, 2 × RS485 + 2 × RS232, 1 × SPK + 1 × MIC, on-board dual-band Wi-Fi, 4G optional, operating temperature -20 ~ 70℃ | | B11.AS101.38.0004 | sTPC-S101-3568B-2G-32G | Standard, 10.1″, RK3568, 2GB RAM, 32GB eMMC, capacitive touch 1280×800, DC 12V input, 1 × GLAN, 2 × USB3.0 + 2 × USB2.0, 2 × RS485 + 2 × RS232, 1 × SPK + 1 × MIC, on-board dual-band Wi-Fi, 4G optional, operating temperature -20 ~ 70℃ |
行 580: 行 656:
  
 ==== 1.6 Optional Accessories ==== ==== 1.6 Optional Accessories ====
- 
 ^ Option ^ Description ^ ^ Option ^ Description ^
 | Power adapter | 12V 3A adapter with a mains cable | | Power adapter | 12V 3A adapter with a mains cable |
行 587: 行 662:
  
 ===== 2 Interfaces and Dimensions ===== ===== 2 Interfaces and Dimensions =====
- 
 ==== 2.1 Exterior Views ==== ==== 2.1 Exterior Views ====
- 
 The unit has a full-flat front and a rear expansion bay: the front carries only the touch screen and plastic bezel; the raised bay in the centre of the back holds the I/O in two rows (power, serial, USB, HDMI, LAN, antennas and SIM slots), with VESA mounting holes in the four corners. The unit has a full-flat front and a rear expansion bay: the front carries only the touch screen and plastic bezel; the raised bay in the centre of the back holds the I/O in two rows (power, serial, USB, HDMI, LAN, antennas and SIM slots), with VESA mounting holes in the four corners.
  
行 598: 行 671:
 | {{wiki:stpc_s156_back.jpg?400}} \\ Back: VESA holes and expansion bay | {{wiki:stpc_s156_io_a.jpg?400}} \\ I/O area: two rows of connectors | | {{wiki:stpc_s156_back.jpg?400}} \\ Back: VESA holes and expansion bay | {{wiki:stpc_s156_io_a.jpg?400}} \\ I/O area: two rows of connectors |
  
-==== 2.2 Interface Diagram ==== +==== 2.2 Interface Overview ====
 The I/O is arranged in two rows inside the expansion bay. The callouts in the diagram correspond to the numbers in the table below; click the image for full size. The I/O is arranged in two rows inside the expansion bay. The callouts in the diagram correspond to the numbers in the table below; click the image for full size.
  
行 624: 行 696:
 **Note:** Quantities above are the series nominal configuration; the fitted count varies with model and configuration. Always follow the silkscreen on the unit. **Note:** Quantities above are the series nominal configuration; the fitted count varies with model and configuration. Always follow the silkscreen on the unit.
  
-==== 2.3 Mechanical Dimensions ====+==== 2.3 Interface Pin Definitions ==== 
 +All external connectors on the unit are finished connectors; no bare board pin headers. The serial ports and speaker use pluggable terminal blocks with 2.5mm / 2.0mm pitch; align wiring with the silkscreen labels. Recommended wire gauge: 0.2 ~ 1.5mm²; strip length: 6 ~ 7mm. 
 + 
 +**DC 12V (5.5×2.1mm Barrel Connector)** 
 + 
 +^ Item ^ Definition ^ 
 +| Center Pin | +12V | 
 +| Outer Ring | GND | 
 +| Input Range | DC 12V ±0.3V (15″ model: 12 ~ 24V) | 
 +| Protection | Overvoltage protection, overcurrent protection | 
 + 
 +**RS485 (2.5mm 3P Terminal, 2 Groups: ttyS1 / ttyS3)** 
 + 
 +^ Pin ^ RS485-1 (ttyS1)^ RS485-2 (ttyS3)^ Description ^ 
 +| 1 | A1 | A3 | Differential Positive (485_A) | 
 +| 2 | B1 | B3 | Differential Negative (485_B) | 
 +| 3 | G1 | G3 | Signal Ground | 
 + 
 +Half duplex; transmit/receive direction is switched automatically by hardware; no software RTS control is required. 
 + 
 +**RS232 (2.5mm 3P Terminal, 2 Groups: ttyS2 / ttyS4)** 
 + 
 +^ Pin ^ RS232-1 (ttyS2)^ RS232-2 (ttyS4)^ Description ^ 
 +| 1 | R2 | R4 | Receive RXD, connect to peer TXD | 
 +| 2 | T2 | T4 | Transmit TXD, connect to peer RXD | 
 +| 3 | G2 | G4 | Signal Ground | 
 + 
 +Full duplex; when connecting to external devices, **cross R/T and share GND**. 
 + 
 +**Note:** The silkscreen suffix matches the device node number (A1 → ttyS1, R2 → ttyS2, A3 → ttyS3, R4 → ttyS4); therefore RS485 uses ttyS1 / ttyS3 and RS232 uses ttyS2 / ttyS4. Non-consecutive numbering is normal. 
 + 
 +**SPK (PH2.0-4P)** 
 + 
 +^ Pin ^ Silkscreen Label ^ Signal ^ Description ^ 
 +| 1 | L+ | Left Channel + | 8Ω 6W | 
 +| 2 | L- | Left Channel - | — | 
 +| 3 | R- | Right Channel - | — | 
 +| 4 | R+ | Right Channel + | 8Ω 6W | 
 + 
 +**MIC (Ø3.5 phone jack)** 
 + 
 +^ Part ^ Signal ^ Description ^ 
 +| TIP | MIC+ | Microphone Signal | 
 +| SLEEVE | GND | Ground | 
 + 
 +**USB** 
 + 
 +^ Interface ^ Mode ^ Description ^ 
 +| USB3.0 (Upper Row) | Host | 5Gbps; connect USB flash drives / keyboard and mouse / industrial cameras | 
 +| USB3.0 (Lower Row) | Host / Device | In Device mode, used for system flashing and ADB debugging | 
 +| USB2.0 (Dual-Stack) | Host | 480Mbps; connect USB flash drives / keyboard and mouse / printers | 
 + 
 +**HDMI / LAN / SIM** 
 + 
 +^ Interface ^ Specifications ^ 
 +| HDMI | Standard Type A 19-pin, up to 3840×2160 | 
 +| LAN | RJ45 8P8C, 10/100/1000M auto-negotiation, supports Auto-MDIX, with Link/Act indicator LEDs | 
 +| SIM | 2 × Micro SIM, use one of the two, insertion direction follows the silkscreen label on the socket | 
 + 
 +**GPIO (PH2.0-16P Terminal, Optional Breakout)** 
 + 
 +The unit GPIO is an optional breakout (rear GPIO connector / internal pin header); align wiring with the silkscreen labels on the unit. 
 + 
 +^ Pin ^ Direction ^ Description ^ 
 +| Odd pins 1 / 3 / 5 / 7 / 9 / 11 / 13 / 15 | GPO | General-purpose output, fixed by hardware, output only | 
 +| Even pins 2 / 4 / 6 / 8 / 10 / 12 / 14 / 16 | GPI | General-purpose input, fixed by hardware, input only | 
 + 
 +GPO / GPI are fixed by hardware and cannot be swapped by software; the table below lists system-side GPIO numbers, which are a different concept from terminal pin numbers. 
 + 
 +**System GPIO Numbers** 
 + 
 +^ Purpose ^ System GPIO Numbers ^ 
 +| GPO (Digital Output) | 95, 94, 21, 22, 140, 141 | 
 +| GPO / GPI (Output / Input) | 13, 14, 96, 93, 108, 107 | 
 + 
 +GPIO numbers are kernel gpiochip global numbers and may shift as a whole across firmware versions; unexported pins must be exported before use.
  
 +==== 2.4 Mechanical Dimensions ====
 ^ Model ^ Unit size W×H×D (mm) ^ Cutout (mm) ^ Net weight ^ ^ Model ^ Unit size W×H×D (mm) ^ Cutout (mm) ^ Net weight ^
 | sTPC-S101-3568B | 255.5 × 174 × 41 | 251.5 × 170 | 1kg | | sTPC-S101-3568B | 255.5 × 174 × 41 | 251.5 × 170 | 1kg |
行 641: 行 789:
   * Cooling: natural convection; leave ventilation space behind the unit   * Cooling: natural convection; leave ventilation space behind the unit
  
-===== 3 Product Development Resources =====+===== 3 Quick Start ===== 
 +==== 3.1 System Download ==== 
 +**Android System**
  
-Datasheets, drivers, SDK, firmware and flashing tools are published per model; the entry point is:+  * Android 11 firmware (with root access): contact Sales / Technical Support for the download link
  
-**Resources:** [[https://www.showdoc.com.cn/nodka01/11559011770088384|sTPC-SXXX-3568B product development resources]] — ShowDoc online documentation+**Linux System**
  
-**Note:** These resources are authoritative; fetch the latest files there after a version update. Flashing, ADB, serial and GPIO procedures are covered in the model manual.+  * Ubuntu 20.04 firmware (with Qt 5.12.8, GStreamer): contact Sales / Technical Support for the download link 
 +  * Debian 11 firmware: provided separately per project requirements 
 + 
 +==== 3.2 Flashing Tool Download ==== 
 +Both tools are official Rockchip releases, uploaded as attachments on this site; download links are at the end of each item: 
 + 
 +  * **USB Driver**: After extraction, double-click DriverInstall.exe to complete the installation: {{wiki:driverassitant_v5.11.zip|DriverAssitant_v5.11 Driver Installation Package (9.4 MB)}} 
 +  * **Flashing Tool**: After extraction, double-click RKDevTool.exe to launch the tool: {{wiki:rkdevtool_release_v3.32.zip|RKDevTool_Release_v3.32 Flashing Tool (5.5 MB)}} 
 + 
 +**Note:** If the driver is not installed successfully, an unknown device appears in Device Manager; reinstall the driver before flashing. 
 + 
 +==== 3.3 System Flashing ==== 
 +Linux and Android use the same Rockchip tools for flashing; the unit requires no disassembly: connect via the **USB3.0 port** (lower row) and enter flashing mode via the **Recover pinhole**. 
 + 
 +**① Connect the USB3.0 Port** 
 + 
 +Take a USB3.0 male-to-male cable; connect one end to the blue **USB3.0** port in the lower row of the rear interface area and the other end to a PC USB port: 
 + 
 +{{wiki:burn_otg_v2.png?560}} 
 + 
 +**② Install the Rockchip USB Driver** 
 + 
 +Enter the driver package directory and double-click DriverInstall.exe: 
 + 
 +{{wiki:flash2.png?560}} 
 + 
 +When the "Rockchip Driver Assistant" dialog appears, click "Install Driver" and wait for the progress bar to complete: 
 + 
 +{{wiki:flash3.png?560}} 
 + 
 +**Note:** If the device is not recognized due to a driver error or after switching PCs, click "Uninstall Driver" in Driver Assistant first, then click "Install Driver" again. 
 + 
 +**③ Open the Flashing Tool** 
 + 
 +Extract the tool package and double-click RKDevTool.exe: 
 + 
 +{{wiki:flash4.png?560}} 
 + 
 +**④ Put the Unit into Loader Mode** 
 + 
 +Power off the unit first, hold the rear **Recover** hole with a pin without releasing, then connect DC 12V to power on, and release after about 2 seconds: 
 + 
 +{{wiki:burn_recover_v2.png?560}} 
 + 
 +**⑤ Confirm the Device Is Recognized** 
 + 
 +After entering Loader mode, check the status bar at the bottom of RKDevTool: **No Devices Found** means the unit is not recognized yet, while **Found One LOADER Device** means it is ready to flash: 
 + 
 +{{wiki:en_flash_select_firmware.png?560}} 
 + 
 +If "No Devices Found" keeps showing, go back to step ④ and re-enter, or change the USB port and data cable. 
 + 
 +**⑥ Select Firmware and Upgrade** 
 + 
 +Switch to the "Upgrade Firmware" tab, first click "Firmware" to select update.img, then click "Upgrade": 
 + 
 +{{wiki:en_flash_loader_found.png?560}} 
 + 
 +After flashing reaches 100%, the device reboots automatically; first boot takes about 30 ~ 60 seconds. 
 + 
 +**Note:** 
 + 
 +  - If the device is not recognized when switching from Android to Linux (or vice versa), run "Enter Maskrom" in "Advanced Features" and re-flash 
 +  - Do not cut power or unplug the cable during flashing; otherwise the unit may fail to boot and must be re-flashed after re-entering Loader 
 + 
 +==== 3.4 Android System Upgrade ==== 
 +There are two upgrade paths; pick one according to site conditions: **local upgrade via USB drive** (offline, no network needed) and **OTA online update** (downloaded and installed by the preinstalled app once the unit is online). Both upgrade the full system image and reboot the unit automatically afterwards. 
 + 
 +^ Path ^ Applies to ^ Prerequisites ^ Steps ^ 
 +| **Local upgrade via USB drive** | Android (Linux: see 5.10) | update.img + FAT32 USB drive | 3.4.3 | 
 +| **OTA online update** | Android | Unit online + preinstalled update app | 3.4.4 | 
 + 
 +=== 3.4.1 Before You Start === 
 +  - Confirm the firmware matches the unit model and SoC (naming rules in 1.3) 
 +  - Back up on-site data: the upgrade rewrites the system partition, so apps and settings may be reset 
 +  - Keep the power supply stable; **never cut power or unplug** during the upgrade 
 +  - The first boot after upgrading takes about 30 ~ 60 s, which is normal 
 + 
 +=== 3.4.2 Prepare update.img === 
 +Choose one of the two firmware sources: 
 + 
 +  - Obtain a ready-made update.img from SmartInc (see 3.1 for how to get it) 
 +  - Build it yourself with the SDK: run a full build in the SDK root directory to generate the rockdev/Image-xxx/ directory, then run ./mkupdate.sh (or make otapackage) 
 + 
 +<code bash> 
 +# Build the full image 
 +./build.sh updateimg 
 +ls -lh rockdev/update.img 
 +</code> 
 + 
 +USB drive requirements: FAT32 format, available capacity ≥ 4GB (≤ 32GB recommended), place update.img in the root directory with the filename unchanged. 
 + 
 +=== 3.4.3 Local Upgrade via USB Drive === 
 +  - Copy update.img to the root directory of the USB drive 
 +  - Insert the USB drive into a USB port on the unit (either USB3.0 / USB2.0 port works) 
 +  - After the system detects the update package, confirm as prompted in the pop-up; keep the power supply on during the update, and the unit reboots automatically when done 
 + 
 +**Note:** If no upgrade prompt appears after inserting the USB drive, first check the filename and USB drive format, then reboot the unit and retry; for online update see 3.4.4. 
 + 
 +=== 3.4.4 OTA Update (Android) === 
 +OTA update on Android is performed by the preinstalled **update** app; the unit must be connected to the Internet first. 
 + 
 +  - Open the app list and find "update" 
 +  - Tap "UPDATE NOW" and follow the prompts to download and install 
 +  - Keep the power supply and network connected during the update; the unit reboots automatically when done 
 + 
 +The update icon in the app list: 
 + 
 +{{wiki:ota_app_drawer.jpg?560}} 
 + 
 +SmartInc OTA update interface: 
 + 
 +{{wiki:ota_updater.png?560}} 
 + 
 +**Note:** This section covers Android online OTA update; for offline USB drive upgrade see 3.4.3; for Linux OTA update see 5.10. 
 + 
 +===== 4 Android System Usage ===== 
 +This chapter **applies only to the Android system** (Android 11). Equivalent functions under Linux (Ubuntu / Debian) are grouped in Chapter 5; interfaces, tools and commands are not mixed between the two chapters; Android application-layer API calls are all documented in 4.12. 
 + 
 +==== 4.1 Enable ADB Debugging ==== 
 +=== 4.1.1 USB ADB Usage === 
 +  - Use a USB data cable to connect the **USB3.0 port** of the unit (blue port on the lower row) to the PC 
 +  - Under "Settings → About tablet", tap "Build number" 7 times consecutively to enable Developer options 
 +  - Enter "Settings → System → Advanced → Developer options" and enable "USB debugging" 
 +  - On the PC, run adb devices; on first connection, tap "Allow" in the pop-up on the unit 
 + 
 +<code bash> 
 +adb devices 
 +# List of devices attached 
 +# 0123456789ABCDEF device 
 +</code> 
 + 
 +=== 4.1.2 Network ADB Usage === 
 +When the unit and PC are on the same network segment, debug wirelessly without a data cable. 
 + 
 +<code bash> 
 +adb connect 192.168.8.55:5555 
 +adb devices 
 +</code> 
 + 
 +==== 4.2 WiFi Usage ==== 
 +  - Go to "Settings → Network & Internet → WLAN" and turn on the switch 
 +  - Select the target hotspot and enter the password (onboard 2.4G/5G dual-band, 802.11 a/b/g/n/ac) 
 +  - After connecting, check the IP address in "Network details" 
 +  - If the signal is weak, adjust the angle of the rear **Wi-Fi/BT** SMA antenna, or use a suction-cup antenna instead 
 + 
 +<code bash> 
 +adb shell dumpsys wifi | grep -i "curState" 
 +adb shell ifconfig wlan0 
 +</code> 
 + 
 +==== 4.3 Ethernet Usage ==== 
 +The unit has a single network port (LAN, Gigabit auto-negotiation); under Android the device name is **eth0**. All commands below run in adb shell; changing settings requires su privileges. 
 + 
 +**View Device** 
 + 
 +<code bash> 
 +ip link show 
 +</code> 
 + 
 +**Usage (Dynamic IP)** 
 + 
 +<code bash> 
 +su 
 +ifconfig eth0 up 
 +ifconfig eth0 dhcp      # Some firmware requires dhcpcd eth0 instead 
 +</code> 
 + 
 +**Usage (Static IP)** 
 + 
 +<code bash> 
 +su 
 +ifconfig eth0 down 
 +ifconfig eth0 192.168.8.55 netmask 255.255.255.0 
 +ifconfig eth0 up 
 +</code> 
 + 
 +**Test** 
 + 
 +<code bash> 
 +ping -c 4 192.168.8.1 
 +</code> 
 + 
 +**Note:** To make a static IP take effect automatically at boot, configure a static eth0 address in the system, or set the Ethernet static IP via ConnectivityManager at the application layer. 
 + 
 +==== 4.4 4G Module Usage ==== 
 +The unit's 4G uses a Quectel EG800AK-C module (mounted on the 6A12-J carrier board); the system dials automatically after power-on, with no manual configuration required. 
 + 
 +=== 4.4.1 Support List === 
 +The unit supports only the 4G modules listed below; the USB ID is used to confirm in the board-side lsusb output whether the module is recognized: 
 + 
 +^ Module Model ^ Standard ^ USB ID ^ 
 +| Quectel EG800AK-C | LTE 4G | 2c7c:6002 | 
 + 
 +=== 4.4.2 Steps === 
 +**4G Module** 
 + 
 +  - Attach the 4G antenna, and insert the SIM card into the socket with the notch facing outward and the chip facing the board 
 +  - After power-on, confirm the SIM card is recognized in "Settings → Network & Internet → Mobile network" 
 +  - Turn on mobile data; once the 4G icon appears in the status bar, you can access the Internet 
 + 
 +<code bash> 
 +adb shell lsusb 
 +# Bus 002 Device 002: ID 2c7c:6002 Quectel Wireless Solutions Co., Ltd. EG800AK-C 
 +</code> 
 + 
 +**Check Signal and Network Registration (AT Commands)** 
 + 
 +The module AT port is generally /dev/ttyUSB2 and requires root privileges: 
 + 
 +<code bash> 
 +echo -e "AT+CPIN?\r\n"   > /dev/ttyUSB2   # Check whether the SIM card is inserted properly 
 +echo -e "AT+CSQ\r\n"     > /dev/ttyUSB2   # Signal strength, 0~99 is normal 
 +echo -e "AT+COPS?\r\n"   > /dev/ttyUSB2   # Whether registered on the carrier network 
 +echo -e "AT+CGREG?\r\n"  > /dev/ttyUSB2   # Whether the data network is ready 
 +</code> 
 + 
 +**Note:** Insert or remove the SIM card only **with power off**; hot-plugging may cause the module to be unrecognized, requiring a power cycle. 
 + 
 +==== 4.5 Serial Port Usage ==== 
 +The unit provides 2 × RS485 and 2 × RS232; Android node and terminal definitions are as follows (the rear silkscreen label takes precedence): 
 + 
 +^ Interface ^ Device Node ^ Pin Definition ^ 
 +| RS485-1 | /dev/ttyS1 | A1 / B1 / G1 | 
 +| RS485-2 | /dev/ttyS3 | A3 / B3 / G3 | 
 +| RS232-1 | /dev/ttyS2 | R2 / T2 / G2 | 
 +| RS232-2 | /dev/ttyS4 | R4 / T4 / G4 | 
 + 
 +=== 4.5.1 Test Tool ComAssistant === 
 +Serial port testing under Android uses **ComAssistant** (a serial assistant app) throughout: 
 + 
 +  - Install and open ComAssistant; on first run, grant storage and serial port device permissions 
 +  - Select the target node in the device list: RS485 uses /dev/ttyS1 or /dev/ttyS3; RS232 uses /dev/ttyS2 or /dev/ttyS4 
 +  - Set the parameters to 115200, 8 data bits, 1 stop bit, no parity (8N1) 
 +  - Tap "Open serial port", enter content in the send area and tap "Send"; during loopback or mutual transmission, observe the receive area at the same time 
 + 
 +**Note:** ComAssistant requires Root privileges to access /dev/ttyS*; if opening fails, first run su and ls -l /dev/ttyS* in adb shell to check node permissions. 
 + 
 +=== 4.5.2 Test Method === 
 +  - RS232 loopback: short R and T of the same 232 node with a jumper cap 
 +  - RS232 — RS232 mutual transmission: cross wiring (R↔T, common GND) 
 +  - RS232 — RS485 mutual transmission: via a 232-to-485 converter module 
 +  - RS232 — RS232-to-USB — serial port assistant on the PC 
 +  - RS485 — RS485-to-USB — serial port assistant on the PC 
 + 
 +**Precautions** 
 + 
 +  - The unit has a 2.5mm 3P pluggable terminal (no DB9); use a crimp terminal or adapter cable. Adapter cable pinouts may differ between manufacturers; reversing A / B or R / T directly causes communication failure 
 +  - RS485 is half-duplex; direction is switched automatically by hardware, so observe the frame interval when switching between transmit and receive 
 + 
 +=== 4.5.3 Application-Layer Calls === 
 +Do not open nodes directly via shell in the app; use the NodkaAPI uart_ interface (see 4.12.5): 
 + 
 +<code java> 
 +NodkaAPI api = NodkaAPI.nodkaAPICreate(context); 
 +api.uart_open("/dev/ttyS2", 115200); 
 +api.uart_send("/dev/ttyS2", "hello".getBytes()); 
 +api.uart_receive("/dev/ttyS2", new UartReceiveDataCallback() { 
 +    @Override 
 +    public void onReceiveData(byte[] data) { 
 +        // Process the received data 
 +    } 
 +}); 
 +api.uart_close("/dev/ttyS2"); 
 +</code> 
 + 
 +==== 4.6 USB and SD Card ==== 
 +The unit provides 2 × USB3.0 (lower row supports Device mode) and 2 × USB2.0, plus SD card support. 
 + 
 +**USB Drive** 
 + 
 +  - Insert the USB drive; "USB storage device" appears on the left side of the file manager 
 +  - If you can browse the USB drive contents after opening it, the drive is recognized correctly 
 +  - Before unplugging, unmount it in "Settings → Storage" to avoid data corruption 
 + 
 +<code bash> 
 +adb shell ls /storage          # Mount points such as udisk0 or 91A3-2B1C are visible 
 +adb shell lsusb 
 +</code> 
 + 
 +**SD Card** 
 + 
 +<code bash> 
 +adb shell ls /storage          # SD card mount points such as xxxx-xxxx are visible 
 +adb shell dumpsys mount | grep -i mmc 
 +</code> 
 + 
 +**Note:** The lower-row USB3.0 port in Device mode (flashing / ADB) cannot act as Host at the same time; before inserting a USB drive, confirm the system has exited flashing mode. For manual mounting under Linux see 5.5. 
 + 
 +==== 4.7 Audio Test ==== 
 +Unit audio is output via **SPK (PH2.0-4P, 8Ω 6W)** and input via **MIC (Ø3.5)**; connect an external speaker when no built-in speaker is present. 
 + 
 +**Speaker Output Test** 
 + 
 +  - Connect an 8Ω speaker to the SPK terminal (L+ / L- / R+ / R-) 
 + 
 +**Microphone Recording Test** 
 + 
 +  - Insert a Ø3.5 microphone or use the onboard MIC 
 +  - Open the built-in "Recorder" app, record about 5 seconds and play it back to confirm the audio is clear with no noise 
 + 
 +**View Audio Path** 
 + 
 +<code bash> 
 +adb shell dumpsys media.audio_flinger | grep -i "Output thread" 
 +adb shell getprop | grep -i audio 
 +</code> 
 + 
 +**Note:** If there is no sound, first confirm the SPK terminals L+ / L- / R+ / R- match the speaker wire sequence, then use adb shell tinymix to check whether the amplifier path is open. Under Linux, use aplay / arecord (see 5.1). 
 + 
 +==== 4.8 HDMI and Dual Display ==== 
 +The unit supports simultaneous output to the internal screen + HDMI, up to 3840 × 2160 on HDMI. 
 + 
 +**Set HDMI Output** 
 + 
 +  - Connect an HDMI monitor and go to "Settings → Display → HDMI" 
 +  - Select the resolution and refresh rate (1920 × 1080 @ 60Hz recommended) and confirm the image is stable with no flicker 
 +  - Select the display mode: Mirror (Clone) or Extended (Expand) 
 + 
 +^ Mode ^ Description ^ 
 +| Mirror (Clone) | The internal screen and HDMI show the same image, with the lower resolution of the two | 
 +| Extended (Expand) | The two screens show independent images; the app must specify DisplayId | 
 + 
 +**View via Command Line** 
 + 
 +<code bash> 
 +adb shell wm size 
 +adb shell wm density 
 +adb shell dumpsys display | grep -i "mDisplayId" 
 +</code> 
 + 
 +**Note:** In the app, use interfaces such as display_setScreenRotation / display_setScreenBrightness to control the display (see 4.12.3). Under Linux, use xrandr or weston.ini (see 5.6). 
 + 
 +==== 4.9 Button and Indicator LED Test ==== 
 +^ Item ^ Location ^ Phenomenon / Action ^ Verdict ^ 
 +| PWR Indicator LED | Left of the interface area | Solid green after DC 12V is connected | LED on indicates normal power supply | 
 +| SYS Indicator LED | Right of PWR | Blinking blue after system boot completes | Blinking LED indicates the system is running | 
 +| Recover | Pinhole right of the indicator LED | Hold with power off + release 2 seconds after power-on | RKDevTool detects the LOADER device | 
 +| Return | Right of Recover | Press to go back one level; hold and power on for 3s to enter flashing mode | UI returns / Enters Loader | 
 + 
 +**Return Button Test (getevent)** 
 + 
 +<code bash> 
 +adb shell getevent -l 
 +# /dev/input/event2: EV_KEY       KEY_BACK         DOWN 
 +# /dev/input/event2: EV_SYN       SYN_REPORT       00000000 
 +# /dev/input/event2: EV_KEY       KEY_BACK         UP 
 +</code> 
 + 
 +Pressing Return produces DOWN; releasing it produces UP, indicating that the button and driver are normal. 
 + 
 +**Return Button: Enter Flashing Mode** 
 + 
 +Hold the Return button, power on and release after 3 seconds to enter flashing mode, without using the Recover pinhole. 
 + 
 +**Recover Quick Self-Test** 
 + 
 +Hold the Recover pinhole with power off, then power on; a LOADER device appearing in RKDevTool indicates normal operation (see 3.3 for flashing steps). 
 + 
 +**Note:** Recover is a pinhole structure; use a needle with diameter ≤ 1.5mm to avoid damaging the internal tact switch. 
 + 
 +==== 4.10 Touch Screen Test ==== 
 +The unit has a multi-touch capacitive touch screen; the controller connects to the system via USB. 
 + 
 +**View Touch Device** 
 + 
 +<code bash> 
 +adb shell getevent -pl /dev/input/event* 
 +adb shell dumpsys input | grep -i -A2 "touch" 
 +</code> 
 + 
 +**Line Drawing and Multi-Touch Detection** 
 + 
 +  - In "Settings → System → Advanced → Developer options → Pointer location", swipe a finger to see the X / Y coordinates and trace 
 +  - Press and hold five fingers on the screen simultaneously and check whether multiple touch points are reported at the same time (multi-touch) 
 +  - Tap once on each of the four corners and the center to confirm there is no offset and no dead zone (touch calibration data is written at the factory, so recalibration is generally unnecessary) 
 + 
 +**Note:** If touch does not respond, first confirm the touch USB cable is connected to the mainboard, then use adb shell lsusb to check whether the touch controller device exists. 
 + 
 +==== 4.11 GPIO Usage ==== 
 +The unit's GPIO is **an optional breakout** (rear GPIO socket / internal pin header). For the odd/even pin orientation of the 16-pin terminal, system GPIO numbers and terminal mapping, see **2.3**; these details are not repeated in this section. 
 + 
 +Android apps operate via the NodkaAPI gpio_ interface without shell (see 4.12.4): 
 + 
 +<code java> 
 +NodkaAPI api = NodkaAPI.nodkaAPICreate(context); 
 +api.gpio_export(95);                  // Export the pin 
 +api.gpio_direction(95, "out");        // Set as output 
 +api.gpio_write(95, 1);                // Output high level 
 +int v = api.gpio_read(95);            // Read back the level 
 +api.gpio_unExport(95);                // Unexport the pin 
 +</code> 
 + 
 +**Note:** GPIO numbers are global kernel gpiochip numbers and may shift as a whole across firmware versions; run gpio_export first on unexported pins before operating. For Linux command-line (/sys/class/gpio) operations see 5.4. 
 + 
 +==== 4.12 API Reference and Usage ==== 
 +For Android app development, hardware and system capabilities are wrapped as Java interfaces, so apps need not directly read/write /dev and /sys nodes. The Linux side does not provide this set of interfaces; use the command-line approach in Chapter 5. 
 + 
 +**Interface Source Package Download** 
 + 
 +{{wiki:androidapi1.5.zip|AndroidAPI 1.5 Interface Source Package (18.7 MB)}} 
 + 
 +The package contains AndroidAPI.jar, libandroid-jni.so, AndroidAPI-sources.jar, Javadoc documentation, the AndroidAPIDemo sample project and APK, the platform.jks signing file and readme.txt. Serial port, GPIO and system control interfaces require system signature or Root privileges. 
 + 
 +=== 4.12.1 Usage Instructions === 
 +**Interface Categories** 
 + 
 +^ Prefix ^ Category ^ Description ^ 
 +| devinfo_ | Hardware and system information query | System version, CPU, memory, storage, SN, etc. | 
 +| display_ | Display control | Brightness, rotation, resolution, navigation bar and status bar | 
 +| gpio_ | GPIO control | Export, direction, read/write level | 
 +| uart_ | Serial port control | Open, send/receive, close serial port | 
 +| sysctrl_ | System control | Scheduled power on/off, immediate reboot, silent install | 
 + 
 +**1. Create the instance in Application's onCreate** 
 + 
 +<code java> 
 +public class APIApplication extends Application { 
 + 
 +    private NodkaAPI mNodkaAPI; 
 + 
 +    @Override 
 +    public void onCreate() { 
 +        super.onCreate(); 
 +        mNodkaAPI = NodkaAPI.nodkaAPICreate(this); 
 +    } 
 + 
 +    public NodkaAPI getNodkaAPI() { 
 +        return mNodkaAPI; 
 +    } 
 +} 
 +</code> 
 + 
 +**2. Retrieve it in an Activity or Fragment** 
 + 
 +<code java> 
 +private NodkaAPI mNodkaAPI = APIApplication.getApplication().getNodkaAPI(); 
 +</code> 
 + 
 +**Note:** Set android:name to APIApplication in AndroidManifest.xml; serial port, GPIO and system control interfaces require system signature or Root privileges. 
 + 
 +=== 4.12.2 Hardware and System Information Query === 
 +^ Method Name ^ Method Description ^ 
 +| devinfo_getAndroidVersion() | Get Android system version information | 
 +| devinfo_getAvailMem() | Get available memory capacity | 
 +| devinfo_getBuildNumber() | Get system build number information | 
 +| devinfo_getCpuCores() | Get CPU core count | 
 +| devinfo_getCPUCurFreqKHz() | Get current CPU frequency | 
 +| devinfo_getCPUMaxFreqKHz() | Get maximum CPU frequency | 
 +| devinfo_getCPUMinFreqKHz() | Get minimum CPU frequency | 
 +| devinfo_getCPUTemp() | Get CPU temperature | 
 +| devinfo_getDeviceModel() | Get device model information | 
 +| devinfo_getKernelVersion() | Get kernel version information | 
 +| devinfo_getSerialNum() | Get device SN | 
 +| devinfo_getStorageAvailableSize() | Get available local storage capacity | 
 +| devinfo_getStorageTotalSize() | Get local storage capacity (excluding system partition) | 
 +| devinfo_getTotalMem() | Get total memory capacity | 
 + 
 +=== 4.12.3 Display Control (display_) === 
 +^ Method Name ^ Method Description ^ 
 +| display_getNavBar() | Get whether the navigation bar and status bar are shown | 
 +| display_getScreenBrightness() | Get screen brightness | 
 +| display_getScreenRotation() | Get screen rotation direction | 
 +| display_getWindowHeight() | Get screen resolution height | 
 +| display_getWindowWidth() | Get screen resolution width | 
 +| display_setNavBar(Boolean enable) | Set whether to show the navigation bar and status bar | 
 +| display_setNavBarSlideShow(Boolean enable) | Set whether to show the navigation bar and status bar when sliding | 
 +| display_setScreenBrightness(int screenBrightness) | Set screen brightness | 
 +| display_setScreenRotation(int rotation) | Set screen rotation direction | 
 + 
 +=== 4.12.4 GPIO Control (gpio_) === 
 +^ Method Name ^ Method Description ^ 
 +| gpio_direction(int gpioNumber, String direction) | Set the direction of the specified GPIO (input / output) | 
 +| gpio_export(int gpioNumber) | Export the specified GPIO pin | 
 +| gpio_read(int gpioNumber) | Read the level of the specified GPIO | 
 +| gpio_unExport(int gpioNumber) | Unexport the specified GPIO pin | 
 +| gpio_write(int gpioNumber, int value) | Set the output level of the specified GPIO | 
 + 
 +See 4.11 for pin numbers. 
 + 
 +=== 4.12.5 Serial Port Control (uart_) === 
 +^ Method Name ^ Method Description ^ 
 +| uart_close(String uartNode) | Close the uart device, e.g. /dev/ttyS2 | 
 +| uart_getAvailableDevices() | Get available UART device nodes (returns a List<String>) | 
 +| uart_IsOpen(String uartNode) | Check whether the uart device is open | 
 +| uart_open(String uartNode, int baudrate) | Open the uart device and set the baud rate | 
 +| uart_receive(String uartNode, UartReceiveDataCallback callback) | Receive serial port data, returned via data callback | 
 +| uart_send(String uartNode, byte[] buffer) | Send serial port data | 
 +| uart_stopReceive(String uartNode) | Stop receiving data; no more callbacks after this call | 
 + 
 +See 4.5 for nodes and test methods. 
 + 
 +=== 4.12.6 System Control (sysctrl_) === 
 +^ Method Name ^ Method Description ^ 
 +| sysctrl_cancelReboot() | Cancel device reboot | 
 +| sysctrl_cancelShutdown() | Cancel scheduled shutdown | 
 +| sysctrl_powerOn(String time, boolean repeat) | Set the device power-on time | 
 +| sysctrl_reboot(String time, boolean repeat) | Set the device reboot time | 
 +| sysctrl_rebootNow() | Reboot the device immediately | 
 +| sysctrl_shutdown(String time, boolean repeat) | Set the device shutdown time | 
 +| sysctrl_shutdownNow() | Shut down immediately | 
 +| sysctrl_installApk(String apkPath) | Silently install an application | 
 + 
 +===== 5 Linux System Usage ===== 
 +This chapter **applies only to Linux systems** (Ubuntu 20.04 / Debian 11, Buildroot for some projects). For the corresponding functions on Android, see Chapter 4. 
 + 
 +Except for **5.11 Cross-compilation** and **5.12.1 Docker Compilation**, which run on the **development host**, all commands in this chapter are executed in the on-board terminal or via SSH. The criteria for buttons, indicator LEDs and the touch screen are the same as in Chapter 4 (see 4.9, 4.10) and are not repeated here. Sections from 5.8 onward are system customization items commonly used for factory projects. 
 + 
 +==== 5.1 Sound Card Usage ==== 
 +<code bash> 
 +aplay -l                                    # List sound cards and devices 
 +aplay /nodka_test/LR_audio.wav -D hw:0,0    # Play via the specified sound card device 
 +arecord -d 5 -f cd -r 44100 -c 2 -t wav test.wav 
 +aplay test.wav 
 +</code> 
 + 
 +Volume adjustment: 
 + 
 +<code bash> 
 +alsamixer 
 +amixer -c 0 set 'Playback' 80% 
 +</code> 
 + 
 +**Note:** Unit playback outputs from the SPK terminal (PH2.0-4P); connect an external 8Ω speaker. MIC uses the Ø3.5 interface. 
 + 
 +==== 5.2 Network Usage ==== 
 +=== 5.2.1 Ethernet === 
 +**View network ports** 
 + 
 +<code bash> 
 +ifconfig -a 
 +ip link show 
 +</code> 
 + 
 +**Set a static IP via command line** 
 + 
 +1. Open the network configuration file with vim: vim /etc/network/interfaces 
 + 
 +2. Modify the IP, netmask and gateway according to the on-site network (the unit has a single network port; configure only eth0) 
 + 
 +<code bash> 
 +auto lo 
 +iface lo inet loopback 
 + 
 +auto eth0 
 +iface eth0 inet static 
 + address 192.168.2.110 
 + netmask 255.255.255.0 
 + gateway 192.168.2.1 
 +</code> 
 + 
 +3. Save and exit (press Esc in vim, type :wq), then reboot the system for the configuration to take effect. 
 + 
 +**Note:** On Ubuntu 20.04, NetworkManager manages the network by default, so the configuration in /etc/network/interfaces may not take effect; in this case use the nmcli method in 5.2.2, or disable NetworkManager first and then use the method in this section. 
 + 
 +**Set DNS** 
 + 
 +<code bash> 
 +vi /etc/resolv.conf 
 +nameserver 114.114.114.114 
 +</code> 
 + 
 +**Network priority** 
 + 
 +<code bash> 
 +# Temporary change; the smaller the value, the higher the priority 
 +sudo ifmetric eth0 100 
 + 
 +# Permanent modification 
 +sudo nmcli connection modify "Wired connection name" connection.autoconnect-priority 1 
 +sudo nmcli connection modify "Wired connection name" ipv4.route-metric 100 
 +sudo nmcli connection modify "Wired connection name" connection.autoconnect yes 
 +sudo systemctl restart NetworkManager 
 +</code> 
 + 
 +**Verification** 
 + 
 +<code bash> 
 +ping -c 4 192.168.2.1 
 +ping -c 4 www.baidu.com 
 +</code> 
 + 
 +**Note:** In the graphical interface (Debian desktop), set the IP, netmask and gateway directly in "About NetworkManager Applet → Edit Connections…"; when no existing connection is available, click + in the bottom right to create one. 
 + 
 +=== 5.2.2 WiFi === 
 +**Query and enable the wireless NIC** 
 + 
 +<code bash> 
 +ifconfig -a          # Wireless NIC is usually wlan0 
 +ifconfig wlan0 up    # Enable the wireless NIC 
 +iw dev wlan0 scan    # Scan for hotspots to get SSID, signal strength, and encryption method 
 +</code> 
 + 
 +**Connect to a wireless network** 
 + 
 +<code bash> 
 +nmcli d wifi connect "SSID" password "PASSWORD" 
 +</code> 
 + 
 +**Static IP** 
 + 
 +<code bash> 
 +sudo nmcli connection modify NODKA ipv4.addresses 172.10.21.111/24                  # IP / subnet mask 
 +sudo nmcli connection modify NODKA ipv4.gateway 172.10.21.1                         # Gateway 
 +sudo nmcli connection modify NODKA ipv4.dns "114.114.114.114,61.177.7.1,8.8.8.8"    # DNS 
 +sudo nmcli connection modify NODKA ipv4.method manual                               # Static 
 +sudo nmcli device disconnect wlan0 
 +sudo nmcli device connect wlan0 
 +</code> 
 + 
 +**Dynamic IP (DHCP)** 
 + 
 +<code bash> 
 +sudo nmcli connection modify NODKA ipv4.method auto 
 +sudo nmcli connection modify NODKA ipv4.addresses ""    # Clear the static IP 
 +sudo nmcli connection modify NODKA ipv4.gateway ""      # Clear the gateway 
 +sudo nmcli connection modify NODKA ipv4.dns ""          # Clear DNS (optional) 
 +sudo nmcli connection down NODKA 
 +sudo nmcli connection up NODKA 
 +</code> 
 + 
 +**Configure as an AP hotspot** 
 + 
 +<code bash> 
 +IFNAME="wlan0"    # Wireless NIC node 
 +CON_NAME="One"    # Hotspot name 
 + 
 +nmcli con add type wifi ifname $IFNAME con-name $CON_NAME autoconnect yes ssid $CON_NAME 
 +nmcli con modify $CON_NAME 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared 
 +nmcli con up $CON_NAME 
 +</code> 
 + 
 +**Note:** If the signal is weak, adjust the angle of the rear Wi-Fi/BT antenna or use a suction-cup antenna instead; after connecting, use ip addr show wlan0 to view the assigned address. 
 + 
 +==== 5.3 Serial Port Usage (Linux) ==== 
 +On Linux, the serial port nodes are the same as on Android: RS485 is /dev/ttyS1 or /dev/ttyS3; RS232 is /dev/ttyS2 or /dev/ttyS4 (refer to the rear silkscreen label). 
 + 
 +**Test tools** 
 + 
 +  - GUI: CuteCom (sudo apt install cutecom); select /dev/ttyS2, 115200, 8N1, then open 
 +  - Command line: built-in com_send / com_recv 
 + 
 +<code bash> 
 +# Send 
 +com_send /dev/ttyS2 115200 
 +# Receive (open another terminal) 
 +com_recv /dev/ttyS2 115200 
 +</code> 
 + 
 +**Read/write nodes directly** 
 + 
 +<code bash> 
 +stty -F /dev/ttyS2 115200 cs8 -cstopb -parenb 
 +echo "hello" > /dev/ttyS2     # Send 
 +cat /dev/ttyS2                # Receive 
 +</code> 
 + 
 +**Test method** 
 + 
 +For loopback, peer-to-peer and adapter wiring, see **4.5.2**; these are OS-independent and are not repeated in this section. 
 + 
 +**Precautions** 
 + 
 +  - The unit uses a 2.5mm 3P pluggable terminal (no DB9); use with crimp terminals or an adapter cable; reversing the wire order (A / B, R / T) will directly cause communication failure 
 +  - RS485 is half-duplex; direction is switched automatically by hardware, so observe the frame interval when switching between transmit and receive 
 +  - If permission is denied, add the current user to the dialout group: sudo usermod -aG dialout $USER (takes effect after re-login) 
 + 
 +==== 5.4 GPIO Usage (sysfs) ==== 
 +On Linux, access is unified through /sys/class/gpio. For terminal pin assignment rules and system GPIO numbers, see **2.3**; this section only provides the operation commands. 
 + 
 +**1. Check whether the relevant IO is exported** 
 + 
 +<code bash> 
 +cd /sys/class/gpio 
 +ls 
 +</code> 
 + 
 +**2. Configure GPO (system configuration)** 
 + 
 +<code bash> 
 +for i in {95,94,21,22,140,141}; do echo out >gpio$i/direction; done 
 +for i in {13,14,96,93,108,107}; do echo out >gpio$i/direction; done 
 +</code> 
 + 
 +**3. Set GPO high / low** 
 + 
 +Output high level: 
 + 
 +<code bash> 
 +for i in {95,94,21,22,140,141}; do echo 1 >gpio$i/value; done 
 +for i in {13,14,96,93,108,107}; do echo 1 >gpio$i/value; done 
 +</code> 
 + 
 +Read back the current level: 
 + 
 +<code bash> 
 +for i in {95,94,21,22,140,141}; do cat /sys/class/gpio/gpio$i/value; done 
 +</code> 
 + 
 +Output low level: 
 + 
 +<code bash> 
 +for i in {95,94,21,22,140,141}; do echo 0 >gpio$i/value; done 
 +for i in {13,14,96,93,108,107}; do echo 0 >gpio$i/value; done 
 +</code> 
 + 
 +**4. Configure GPI (system configuration)** 
 + 
 +<code bash> 
 +for i in {13,14,96,93,108,107}; do echo in >gpio$i/direction; done 
 +</code> 
 + 
 +**5. Get GPI value** 
 + 
 +<code bash> 
 +for i in {13,14,96,93,108,107}; do cat /sys/class/gpio/gpio$i/value; done 
 +for i in {95,94,21,22,140,141,13,14,96,93,108,107}; do cat /sys/class/gpio/gpio$i/direction; done 
 +</code> 
 + 
 +**Note:** GPIO numbers follow the kernel's global gpiochip numbering and may shift as a whole across firmware versions; if the corresponding node does not exist under /sys/class/gpio, first run echo NUMBER > /sys/class/gpio/export to export it, then proceed. 
 + 
 +==== 5.5 USB and SD Card Mounting ==== 
 +**USB drive detection** 
 + 
 +<code bash> 
 +dmesg | tail -20     # After insertion, kernel messages show the device name sda / sda1 
 +lsblk                # List block devices and mount points 
 +</code> 
 + 
 +**Mount and unmount** 
 + 
 +<code bash> 
 +mkdir -p /mnt/USB1 
 +mount /dev/sda1 /mnt/USB1 
 +df -h 
 +umount /mnt/USB1 
 +</code> 
 + 
 +**SD Card** 
 + 
 +<code bash> 
 +fdisk -l                        # SD card device name is usually /dev/mmcblk1p1 
 +mount /dev/mmcblk1p1 /mnt/sdcard 
 +umount /mnt/sdcard 
 +</code> 
 + 
 +**Note:** ext4 / vfat can be mounted directly; NTFS requires ntfs-3g, exFAT requires exfat-fuse. See 4.6 for how to view the drives on Android. 
 + 
 +==== 5.6 Resolution and HDMI ==== 
 +The internal screen resolution is fixed by the model (see 1.3 Model and Configuration); HDMI external output can be adjusted with xrandr. 
 + 
 +**X11 desktop** 
 + 
 +<code bash> 
 +xrandr                                             # List outputs and available modes 
 +xrandr --output HDMI-1 --mode 1920x1080 --rate 60 
 +xrandr -o left        # Rotate left 90° 
 +xrandr -o right       # Rotate right 90° 
 +xrandr -o inverted    # Flip 180° 
 +xrandr -o normal      # Restore 
 +</code> 
 + 
 +**Temporarily add a custom resolution** 
 + 
 +<code bash> 
 +cvt 800 750 
 +# 800x750 59.86 Hz (CVT) ... Modeline "800x750_60.00" 48.50 800 840 920 1040 750 753 763 779 -hsync +vsync 
 +xrandr --newmode "800x750_60.00" 48.50 800 840 920 1040 750 753 763 779 -hsync +vsync 
 +xrandr --addmode HDMI-1 800x750_60.00 
 +xrandr --output HDMI-1 --mode 800x750_60.00 
 +</code> 
 + 
 +**Wayland / Weston (when using a Wayland session)** 
 + 
 +Ubuntu 20.04 uses Xorg by default, so the xrandr method applies; if you switch to a Wayland session, xrandr is not supported under Wayland — edit /etc/xdg/weston/weston.ini: 
 + 
 +<code bash> 
 +[output] 
 +name=HDMI-A-1 
 +mode=1920x1080 
 +</code> 
 + 
 +Reboot the system or restart the weston service for the changes to take effect. 
 + 
 +**Dual display mode** 
 + 
 +For the definitions of the clone (mirror) and extended modes, see **4.8**. On Linux, use the desktop display settings or xrandr to control the on/off and position of the two outputs. 
 + 
 +==== 5.7 Remote Access and File Transfer ==== 
 +<code bash> 
 +sudo apt update && sudo apt install -y openssh-server 
 +sudo systemctl enable --now ssh 
 +ip addr show 
 +</code> 
 + 
 +Transfer from a PC: 
 + 
 +<code bash> 
 +scp ./update.img root@192.168.8.55:/home/root/ 
 +</code> 
 + 
 +Graphical tools: WinSCP / FileZilla, protocol SFTP, port 22. 
 + 
 +==== 5.8 Auto-run Programs at Boot ==== 
 +There are three methods, grouped by startup timing; choose as needed, and the methods can be combined: **before login → at login → after entering the graphical interface**. Place the same program in only one of them. 
 + 
 +=== 5.8.1 Execute Before Login === 
 +Suitable for background services that do not depend on the desktop and must run at boot. 
 + 
 +  - Edit the /etc/rc.local file 
 +  - Add the program call before exit 0 
 +  - Save and exit (press Esc, type :wq and press Enter) 
 + 
 +<code bash> 
 +sudo vim /etc/rc.local 
 + 
 +# Add before exit 0 
 +/path/to/myprogram & 
 +exit 0 
 +</code> 
 + 
 +**Note:** /path/to/myprogram is the full program path; the trailing & runs the program in the background; otherwise, it blocks the subsequent login process. The last line of the file must be exit 0 for the script to be executed. 
 + 
 +**Note:** Ubuntu 20.04 does not enable /etc/rc.local by default; make sure rc-local.service is enabled. For systemd-only setups, use a custom service or the startup script in 5.8.3 instead. 
 + 
 +=== 5.8.2 Execute After Login === 
 +It applies only to the current user and runs once the user has logged in. 
 + 
 +  - Edit the user profile file ~/.profile 
 +  - Append the startup command at the end of the file 
 +  - Save and exit 
 +  - Run source ~/.profile to apply the changes immediately 
 + 
 +<code bash> 
 +vim ~/.profile 
 + 
 +# Append at the end of the file 
 +/path/to/myprogram & 
 + 
 +source ~/.profile 
 +</code> 
 + 
 +**Note:** ~/.profile applies only to the current user; to apply to all users, use /etc/profile instead. 
 + 
 +=== 5.8.3 Execute After Entering the Graphical Interface === 
 +Use this for applications that need to display a UI only after the desktop is up (e.g. a full-screen main program). 
 + 
 +**Debian (LXDE)** 
 + 
 +  - Edit the autostart file 
 +  - Append the startup command at the end 
 +  - Save and exit; reboot or re-login for the changes to take effect 
 + 
 +<code bash> 
 +vim /root/.config/lxsession/LXDE/autostart 
 + 
 +# Append at the end 
 +/path/to/myprogram > /dev/null 2>&1 & 
 +</code> 
 + 
 +**Ubuntu** 
 + 
 +On Ubuntu, this is handled uniformly by a startup script; write the command into /nodka_test/autorun.sh (this script runs automatically after the desktop starts). 
 + 
 +<code bash> 
 +sudo vim /nodka_test/autorun.sh 
 + 
 +# Append at the end 
 +/path/to/myprogram > /dev/null 2>&1 & 
 +</code> 
 + 
 +**Note:** > /dev/null 2>&1 discards program output to avoid filling the partition with logs; & ensures background execution. 
 + 
 +==== 5.9 UI and Display Customization ==== 
 +=== 5.9.1 Status Bar Customization === 
 +The LXDE panel (taskbar / menu bar) configuration is stored in: 
 + 
 +<code> 
 +$HOME/.config/lxpanel/LXDE/panels/panel 
 +</code> 
 + 
 +Open it with a text editor to add/remove plugins and adjust position and size; after editing, run lxpanelctl restart or log in again for the changes to take effect. 
 + 
 +=== 5.9.2 Disable the Desktop Environment === 
 +Default contents of the desktop autostart file /root/.config/lxsession/LXDE/autostart: 
 + 
 +<code> 
 +@lxpanel --profile LXDE 
 +@pcmanfm --desktop --profile LXDE 
 +@xscreensaver -no-splash 
 +pulseaudio -D 
 +/nodka_test/autorun.sh 
 +</code> 
 + 
 +^ Line ^ Function ^ 
 +| @lxpanel --profile LXDE | Start the LXDE panel (taskbar and menu) | 
 +| @pcmanfm --desktop --profile LXDE | Let PCManFM manage the desktop, handling wallpaper and icons | 
 +| @xscreensaver -no-splash | Screen saver | 
 +| pulseaudio -D | Start the audio service | 
 +| /nodka_test/autorun.sh | Autostart script executed after the desktop is up | 
 + 
 +To disable the desktop and show only the application UI, simply comment out the first three lines: 
 + 
 +<code> 
 +#@lxpanel --profile LXDE 
 +#@pcmanfm --desktop --profile LXDE 
 +#@xscreensaver -no-splash 
 +pulseaudio -D 
 +/nodka_test/autorun.sh 
 +</code> 
 + 
 +**Note:** After commenting out the panel and PCManFM, the desktop has no taskbar and no wallpaper icons, showing only the autostart program window; this is suitable for units shipped with a full-screen application. 
 + 
 +=== 5.9.3 Replace the Boot LOGO === 
 +The boot LOGO is stored in the resource partition. Execute steps ① ~ ⑥ in order in the Linux terminal on the unit (root privileges required): for steps requiring commands, the description corresponds to the code block immediately following; see the table below for the file location in step ④. 
 + 
 +**① Prepare the BMP image** 
 + 
 +Prepare a BMP image and set its size to the screen resolution (e.g. HDMI 1920×1080). 
 + 
 +**② Copy the bmpconvert tool and grant execute permission** 
 + 
 +{{wiki:bmpconvert.zip|Download the bmpconvert conversion tool (2.3 KB, unzip to get the script)}}. Then unzip the tool and copy it to /usr/bin: 
 + 
 +<code bash> 
 +sudo cp bmpconvert /usr/bin/ 
 +sudo chmod +x /usr/bin/bmpconvert 
 +</code> 
 + 
 +**③ Mount the resource partition** 
 + 
 +<code bash> 
 +sudo mount /dev/block/by-name/resource /mnt 
 +</code> 
 + 
 +**④ Place the boot LOGO file** 
 + 
 +Place the BMP image into /mnt with the file name corresponding to the screen type: 
 + 
 +^ Screen Type ^ File Location ^ 
 +| HDMI / eDP / LVDS | /mnt/logo.bmp, /mnt/logo_kernel.bmp | 
 +| MIPI | /mnt/logo_mipi.bmp, /mnt/logo_kernel_mipi.bmp | 
 + 
 +**⑤ Convert Images with bmpconvert** 
 + 
 +For HDMI / eDP / LVDS screens, run: 
 + 
 +<code bash> 
 +sudo bmpconvert /mnt/logo.bmp 
 +sudo bmpconvert /mnt/logo_kernel.bmp 
 +</code> 
 + 
 +For MIPI screens, use the corresponding file name instead: 
 + 
 +<code bash> 
 +sudo bmpconvert /mnt/logo_mipi.bmp 
 +sudo bmpconvert /mnt/logo_kernel_mipi.bmp 
 +</code> 
 + 
 +**Error handling:** If step ⑤ produces the following output, the system only has python3 and lacks the python command: 
 + 
 +<code> 
 +root@rk3568: bmpconvert /mnt/logo.bmp 
 +/usr/bin/env: 'python': No such file or directory 
 +root@rk3568: bmpconvert /mnt/logo_kernel.bmp 
 +/usr/bin/env: 'python': No such file or directory 
 +</code> 
 + 
 +Create the python symlink first, then rerun the two commands in step ⑤: 
 + 
 +<code bash> 
 +sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 
 +sudo bmpconvert /mnt/logo.bmp 
 +sudo bmpconvert /mnt/logo_kernel.bmp 
 +</code> 
 + 
 +**⑥ Reboot the system** 
 + 
 +<code bash> 
 +sudo reboot 
 +</code> 
 + 
 +**Note:** logo.bmp is displayed during the U-Boot stage and logo_kernel.bmp during the kernel boot stage; replace both. Back up the original files under /mnt before making changes. 
 + 
 +=== 5.9.4 Switching Between Different LCD Displays === 
 +**HDMI**: Supported by default; default output 1920×1080, no configuration needed. 
 + 
 +**eDP / LVDS**: The display parameters must match the panel. Run dis in the terminal to open the display settings interface, select the matching parameters and click Save; reboot to apply. 
 + 
 +<code bash> 
 +dis 
 +</code> 
 + 
 +{{wiki:cm_lcd_sml.png?620}} 
 + 
 +Display Settings interface: Select parameters matching the panel and click Save. 
 + 
 +=== 5.9.5 Screen Rotation === 
 +**Debian: Modify the Xorg Configuration** 
 + 
 +  - First use xrandr to check the screen node name (e.g. eDP-1, HDMI-1) 
 +  - Edit /etc/X11/xorg.conf.d/20-modesetting.conf 
 +  - Change the Option "Rotate" value and reboot 
 + 
 +<code> 
 +Section "Monitor" 
 +    Identifier "eDP-1"              # Screen node name, query with xrandr 
 +    Option "Rotate" "inverted"      # Rotation direction, see the table below 
 +EndSection 
 +</code> 
 + 
 +^ Value ^ Rotation Angle ^ 
 +| normal | 0° (default) | 
 +| right | 90° clockwise | 
 +| inverted | 180° clockwise | 
 +| left | 270° clockwise | 
 + 
 +**Ubuntu: Use xrandr** 
 + 
 +<code bash> 
 +xrandr --output HDMI-1 --rotate left       # Rotate left 90° 
 +xrandr --output HDMI-1 --rotate right      # Rotate right 90° 
 +xrandr --output HDMI-1 --rotate inverted   # Rotate 180° 
 +xrandr --output HDMI-1 --rotate normal     # Restore default 
 +</code> 
 + 
 +**Note:** Add the rotation command to the end of /nodka_test/autorun.sh to apply it automatically at boot. 
 + 
 +**Touch Rotation** 
 + 
 +After screen rotation, touch coordinates will be misaligned; modify CalibrationMatrix in /usr/share/X11/xorg.conf.d/40-libinput.conf accordingly: 
 + 
 +<code> 
 +Section "InputClass" 
 +    Identifier "libinput touchscreen catchall" 
 +    Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1" 
 +    MatchIsTouchscreen "on" 
 +    MatchDevicePath "/dev/input/event*" 
 +    Driver "libinput" 
 +EndSection 
 +</code> 
 + 
 +^ Screen Orientation ^ CalibrationMatrix ^ 
 +| 0° (default) | 1 0 0 0 1 0 0 0 1 | 
 +| 90° (clockwise) | 0 1 0 -1 0 1 0 0 1 | 
 +| 180° (upside down) | -1 0 1 0 -1 1 0 0 1 | 
 +| 270° (90° counterclockwise) | 0 -1 1 1 0 0 0 0 1 | 
 + 
 +==== 5.10 OTA Firmware Update ==== 
 +=== 5.10.1 OTA over Network === 
 +The upgrade is performed by the on-board /usr/bin/ota script. Edit the script as needed, set the FTP address and account, place the corresponding firmware at the FTP download location, then run ota. The files to modify and the corresponding code are as follows. 
 + 
 +**① Edit the upgrade script /usr/bin/ota** 
 + 
 +<code bash> 
 +sudo vim /usr/bin/ota 
 +</code> 
 + 
 +**② Set the following three items in the script** 
 + 
 +<code> 
 +URL=ftp://<firmware server address> 
 +USERNAME=<username> 
 +PASSWORD=<password> 
 +</code> 
 + 
 +**③ Save and run the upgrade** 
 + 
 +<code bash> 
 +ota 
 +</code> 
 + 
 +Follow the prompts to complete the upgrade. 
 + 
 +**Note:** The server address, account and firmware directory are provided by us; do not power off during the upgrade; the device reboots automatically when complete. 
 + 
 +=== 5.10.2 OTA Update via USB Drive === 
 +Under Linux, the on-board /usr/bin/ota script performs the OTA update, with the USB drive as temporary firmware storage. Follow steps ① ~ ⑤ in order: for steps requiring commands, the description corresponds one-to-one with the code block immediately following it; ③④ are condition checks and require no commands. 
 + 
 +**① Unmount the USB drive** 
 + 
 +<code bash> 
 +sudo umount /dev/sdb 
 +</code> 
 + 
 +**② Format the USB drive as ext4** 
 + 
 +<code bash> 
 +sudo mkfs.ext4 /dev/sdb 
 +</code> 
 + 
 +**③ Confirm the system supports OTA update** 
 + 
 +The board must already have the /usr/bin/ota script (see 5.10.1 for script configuration). 
 + 
 +**④ Confirm USB drive specifications** 
 + 
 +The USB drive must be formatted as Linux ext4 with more than 8G of free space; otherwise the upgrade package cannot be written. 
 + 
 +**⑤ Plug in the network cable and USB drive, then run the upgrade** 
 + 
 +<code bash> 
 +ota 
 +</code> 
 + 
 +Follow the prompts to complete the upgrade; do not power off during the process; the device reboots automatically when complete. 
 + 
 +**Note:** /dev/sdb is a common device node for USB drives; the actual node depends on the lsblk output. This section describes the Linux OTA update (ext4, ≥8G, ota command); it is a separate process from the Android USB drive upgrade in 3.4 (FAT32, update.img) and the Android OTA update in 3.4.4; do not mix them. 
 + 
 +==== 5.11 Cross-Compilation Environment ==== 
 +=== 5.11.1 Install the Cross-Compilation Environment via apt === 
 +On a Debian / Ubuntu host, a single command installs the aarch64 cross toolchain; then confirm the version with -v: 
 + 
 +<code bash> 
 +sudo apt install -y crossbuild-essential-arm64 
 +aarch64-linux-gnu-gcc -v 
 +</code> 
 + 
 +=== 5.11.2 Download a Specific Toolchain Version === 
 +For a specific version, download the corresponding toolchain from ARM (developer.arm.com/downloads/-/gnu-a), extract it, then add the bin directory to PATH: 
 + 
 +<code bash> 
 +export PATH=$PATH:/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/ 
 +aarch64-none-linux-gnu-gcc --version 
 +</code> 
 + 
 +**Note:** Write it to ~/.bashrc or /etc/profile to make it permanent; replace the path with the actual extraction directory. 
 + 
 +=== 5.11.3 Toolchain Downloads === 
 +Common cross-compilation toolchains and how to obtain them: 
 + 
 +  * **aarch64-linux-gnu-gcc cross toolchain**: Provided in the SDK prebuilts directory 
 +  * **arm-linux-gnueabihf cross toolchain**: For compiling 32-bit user-space programs 
 +  * **x86 host arm64 cross-compilation toolchain**: Released by ARM, for compiling aarch64 (arm64) programs on an x86_64 host 
 + 
 +**Download:** [[https://pan.baidu.com/s/1OjJVuzDB3hFMgO6yS3EAZw|gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz]] — Baidu Netdisk, <html><span class="sml-code">extraction code hkku</span></html> 
 + 
 +**Note:** This toolchain requires no installation; extract it and add the bin directory inside the archive to PATH; call aarch64-none-linux-gnu-gcc when compiling. 
 + 
 +==== 5.12 Qt Application Development ==== 
 +Preinstalled environments: **Debian 11 → Qt 5.15.2**, **Ubuntu 20.04 → Qt 5.12.8**. Choose between the two methods as applicable. 
 + 
 +=== 5.12.1 Import a Docker Image for Compilation === 
 +Use a ready-made build image; the host does not need Qt installed, isolation is good, and it suits batch compilation. 
 + 
 +**Download:** [[ftp://drv.nodka.com/arm_download/nodka_docker_qt_build_20230223.tar|nodka_docker_qt_build_20230223.tar]] — company FTP (drv.nodka.com) 
 + 
 +  - Import the image 
 +  - Start the container and mount the application directory to /mnt (replace source with the actual path) 
 +  - Inside the container, enter /mnt and run qmake and make 
 + 
 +<code bash> 
 +sudo docker load < nodka_docker_qt_build_20230223.tar 
 + 
 +sudo docker run --rm --mount type=bind,source=/home/APP_PATH,target=/mnt/ -i -t 09a37c1b2fc3 /bin/bash 
 + 
 +cd /mnt 
 +qmake 
 +make 
 +</code> 
 + 
 +**Note:** The image is large; after import the image and the original tar each take a copy, so reserve at least 10 GB of free disk. Chrome / Edge no longer open ftp links directly — use Windows Explorer, FileZilla or a download manager instead. The container ID (09a37c1b2fc3) is taken from the actual docker images output. 
 + 
 +=== 5.12.2 Set Up the Qt Build Environment on the Board === 
 +**1. Install Qt Creator** 
 + 
 +<code bash> 
 +sudo apt-get install qtcreator 
 +sudo apt-get install qt5-default 
 +</code> 
 + 
 +If qt5-default has been removed from the official repository, use the following set of dependencies instead: 
 + 
 +<code bash> 
 +sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtcreator 
 +</code> 
 + 
 +**2. Add qmake** 
 + 
 +Qt Creator → Tools → Options → Kits → Qt Versions → Add, select the on-board qmake: 
 + 
 +<code> 
 +/usr/local/qt5.12-arm/bin/qmake 
 +</code> 
 + 
 +{{wiki:qt_set_qmake.png?620}} 
 + 
 +Add the on-board qmake path in Qt Versions. 
 + 
 +**3. Configure the Cross-Compiler** 
 + 
 +In the same window, switch to Compilers → Add → GCC and add g++ and gcc respectively: 
 + 
 +<code> 
 +g++: /usr/bin/aarch64-linux-gnu-g++ 
 +gcc: /usr/bin/aarch64-linux-gnu-gcc 
 +</code> 
 + 
 +g++ compiler location: 
 + 
 +{{wiki:qt_set_compiler_gpp.png?620}} 
 + 
 +gcc compiler location: 
 + 
 +{{wiki:qt_set_compiler_gcc.png?620}} 
 + 
 +Add the cross-compiler; when the host has crossbuild-essential-arm64 installed, the compiler is under /usr/bin; with a third-party toolchain, enter its installation path. 
 + 
 +**4. Configure the Debugger (optional, for online debugging)** 
 + 
 +<code bash> 
 +sudo apt install -y gdb-multiarch 
 +</code> 
 + 
 +The board must have /usr/bin/gdbserver; if not, install gdbserver (included in Buildroot, no installation needed). Add /usr/bin/gdb-multiarch in Debuggers in Qt Creator. 
 + 
 +{{wiki:qt_set_debugger.png?620}} 
 + 
 +**5. Configure Devices** 
 + 
 +Enter the board IP and username root; set a static IP for the board to avoid disconnections during debugging. 
 + 
 +{{wiki:qt_set_device.png?620}} 
 + 
 +**6. Configure Kits** 
 + 
 +Combine the Qt version, compiler, debugger and device above into one Kit. When the target system is Ubuntu, also fill in the sysroot path in the Kit. 
 + 
 +{{wiki:qt_set_kits_std.png?620}} 
 + 
 +In Kits, combine the Qt version, compiler, debugger and device. 
 + 
 +==== 5.13 Video Hardware Codec Support ==== 
 +The on-board VPU supports H.264 / H.265 hardware encoding and decoding; the system ships with GStreamer plugins and OpenGL ES / OpenCL runtime libraries. 
 + 
 +**GStreamer Encoding/Decoding** 
 + 
 +The system includes test scripts; run them directly to verify hardware decoding and encoding: 
 + 
 +<code bash> 
 +/rockchip-test/video/test_dec-gst.sh    # Hardware decode test 
 +/rockchip-test/video/test_enc-gst.sh    # Hardware encode test 
 +</code> 
 + 
 +**OpenGL ES** 
 + 
 +Use glmark2 to benchmark and verify the GPU: 
 + 
 +<code bash> 
 +glmark2-es2 
 +</code> 
 + 
 +**WebGL** 
 + 
 +Open Chromium, enter the following address in the address bar, and check WebGL and hardware acceleration status: 
 + 
 +<code> 
 +chrome://gpu 
 +</code> 
 + 
 +**OpenCL** 
 + 
 +<code bash> 
 +clinfo 
 +</code> 
 + 
 +{{wiki:cm_clinfo.png?620}} 
 + 
 +clinfo output: confirm platform, device and OpenCL version information. 
 + 
 +===== 6 General Methods ===== 
 +This chapter covers query commands, which are basically the same under Android (adb shell) and in the Linux terminal; differences are noted in individual entries where applicable. 
 + 
 +==== 6.1 Check CPU Temperature ==== 
 +<code bash> 
 +cat /sys/class/thermal/thermal_zone0/temp 
 +# Output is in millidegrees Celsius; 45200 means 45.2℃ 
 +</code> 
 + 
 +==== 6.2 Check the CPU Serial Number ==== 
 +<code bash> 
 +cat /proc/device-tree/serial-number 
 +# On Android 
 +getprop ro.serialno 
 +</code> 
 + 
 +==== 6.3 Check CPU Frequency ==== 
 +<code bash> 
 +cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
 +cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 
 +</code> 
 + 
 +==== 6.4 Check Memory Capacity ==== 
 +<code bash> 
 +free -h 
 +cat /proc/meminfo | head -3 
 +</code> 
 + 
 +==== 6.5 Check Storage Capacity ==== 
 +<code bash> 
 +df -h 
 +lsblk 
 +</code> 
 + 
 +==== 6.6 Network Ping Test ==== 
 +<code bash> 
 +ping -c 4 192.168.8.1 
 +ping -c 4 www.baidu.com 
 +ping -c 1 -W 1 8.8.8.8 
 +</code> 
 + 
 +==== 6.7 Set System Time and Save to the RTC Chip ==== 
 +<code bash> 
 +# Check the system time 
 +date 
 +# Set the system time and write it to the RTC chip 
 +sudo date -s "2025-04-08 17:01:01" 
 +sudo hwclock -w 
 +sudo hwclock -r 
 +</code> 
 + 
 +**Verification**: Power off and disconnect power for more than 5 seconds, then power on and use date to check whether the time is retained. 
 + 
 +**Note:** Network time synchronization is enabled by default; perform the RTC test with the external network disconnected. 
 + 
 +**Time Zone Settings** 
 + 
 +<code bash> 
 +ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
 +reboot 
 +</code> 
 + 
 +In the GUI, select the time zone under "Preferences → Time and Date"; to set another time zone, replace Asia/Shanghai in the command with the corresponding city. 
 + 
 +===== 7 Appendix ===== 
 +==== 7.1 FAQ Troubleshooting ==== 
 +^ Symptom ^ Possible Cause ^ Solution ^ 
 +| The flashing tool keeps showing "No device found" | Not in Loader mode / USB driver error / cable issue | Follow step ④ in 3.3 to re-enter Loader mode; uninstall and reinstall the driver; change the USB port and data cable | 
 +| Unknown device appears in Device Manager | Rockchip USB driver not installed properly | See 3.2; reinstall DriverInstall | 
 +| ADB cannot connect | USB debugging not enabled / wrong USB port | See 4.1; confirm connection to the blue USB3.0 lower port | 
 +| The serial port cannot be opened or returns no data | Wrong node / no permission / A-B or R-T reversed | See 4.5, 5.3; check the node and wiring against the silkscreen label | 
 +| GPIO read/write no response | Not exported / numbering offset varies with firmware | See 2.3, 5.4; export first, then operate | 
 +| Touch not responding or coordinates misaligned | Loose touch USB cable / CalibrationMatrix not updated after rotation | See 4.10, 5.9.5 | 
 +| After screen rotation the UI is normal but touch is reversed | libinput calibration matrix not updated | See the touch rotation table in 5.9.5 | 
 +| Boot LOGO not applied | Only one of the images replaced / bmpconvert not run | See 5.9.3; replace and convert both logo images | 
 +| Static IP configuration not effective | NetworkManager and ifupdown coexist | See the note in 5.2.1 | 
 +| No prompt during USB drive upgrade | File name is not update.img / format is not FAT32 | See 3.4.2; rename and reformat as FAT32 | 
 + 
 +==== 7.2 Document Information and Revision History ==== 
 +^ Item ^ Content ^ 
 +| Applicable Products | sTPC-S101 / S156 / S215-3568B | 
 +| Main Control Platform | Rockchip RK3568 (4 × Cortex-A55 @2.0GHz, 1 TOPS NPU) | 
 +| Applicable Systems | Android 11, Ubuntu 20.04 (Debian 11 per project configuration) | 
 +| Document Version | v1.4 | 
 +| Update Date | 2026-11-11 | 
 + 
 +^ Version ^ Date ^ Revision Details ^ 
 +| v1.4 | 2026-11-11 | Aligned wording throughout: unified serial port count and silkscreen labels, power supply range, system range and interface/port count conventions; removed duplicates in GPIO and OTA; added SD card / GPIO / codec specifications; added 4.13 and the Chapter 7 appendix | 
 + 
 +For previous versions, contact Technical Support. 
 + 
 +==== 7.3 Technical Support ==== 
 +  * Firmware, flashing tools, SDK and specifications: contact Sales or Technical Support 
 +  * When reporting an issue, provide: unit SN (see 6.2 for how to view it), system version, reproduction steps and screenshots 
 +  * If an exception occurs after modifying the system yourself, reflash the factory firmware first (see 3.3) before deciding whether it is a hardware issue 
 + 
 +==== 7.4 Development Resources ==== 
 +Datasheets, drivers, SDK, firmware and flashing tools are maintained per model; contact Sales or Technical Support to obtain them. 
 + 
 +**Note:** Flashing, ADB, serial and GPIO procedures are described in chapters 3–7 of this page; for interface count and location see 2.2.
  
 <html><style> <html><style>
行 655: 行 2174:
 #sml-lang:focus{outline:2px solid #36c;outline-offset:1px;} #sml-lang:focus{outline:2px solid #36c;outline-offset:1px;}
 </style></html> </style></html>
 +
 <html><script> <html><script>
 (function(){ (function(){
行 855: 行 2375:
 } }
 </style></html> </style></html>
 +<html><script>
 +/* sTPC 3D 拆解查看器(嵌入版,无外部依赖)
 +   用法:SML3D(hostElement, {url:'...zip', lang:'zh', ...}) */
 +window.SML3D = (function(){
 +"use strict";
 +
 +/* ===== 默认零件表(仅 sTPC-S156-3568B;其它机型由 cfg.parts 传入) ===== */
 +var PARTS_S156 = [
 +  /* 0 */ {n:'机身中框',   e:'Mid Frame',        col:'#b8c2cd', k:0.00, d:[0,0,0]},
 +  /* 1 */ {n:'视窗玻璃',   e:'Front Glass',      col:'#1e2a36', k:1.55, d:[0,0,1]},
 +  /* 2 */ {n:'显示模组',   e:'Display Module',   col:'#3f4d5c', k:1.05, d:[0,0,1]},
 +  /* 3 */ {n:'后盖',       e:'Rear Cover',       col:'#d4dae1', k:1.45, d:[0,0,-1]},
 +  /* 4 */ {n:'主板载板',   e:'Carrier Board',    col:'#2f6f59', k:0.55, d:[0,0,1]},
 +  /* 5 */ {n:'屏线组件',   e:'Panel Cable',      col:'#c9a227', k:0.55, d:[0,0,1]},
 +  /* 6 */ {n:'天线/顶条',  e:'Antenna Bar',      col:'#7b5ea7', k:0.60, d:[0,0,-1]},
 +  /* 7 */ {n:'固定卡扣',   e:'Clip',             col:'#8e99a6', k:0.30, d:[0,0,-1]},
 +  /* 8 */ {n:'固定卡扣',   e:'Clip',             col:'#8e99a6', k:0.30, d:[0,0,-1]},
 +  /* 9 */ {n:'紧固件',     e:'Fastener',         col:'#8e99a6', k:0.30, d:[0,0,-1]},
 +  /*10 */ {n:'下侧接口座', e:'I/O Block',        col:'#a45a52', k:0.45, d:[0,0,-1]},
 +  /*11 */ {n:'接地弹片',   e:'Ground Spring',    col:'#9aa4b0', k:0.20, d:[0,0,-1]},
 +  /*12 */ {n:'竖向排线',   e:'Vertical FPC',     col:'#c9a227', k:0.45, d:[0,0,-1]},
 +  /*13 */ {n:'接地弹片',   e:'Ground Spring',    col:'#9aa4b0', k:0.20, d:[0,0,-1]},
 +  /*14 */ {n:'喇叭',       e:'Speaker',          col:'#a45a52', k:0.45, d:[0,0,-1]},
 +  /*15 */ {n:'主板组件',   e:'Main Board',       col:'#2f6f5c', k:0.75, d:[0,0,-1]},
 +  /*16 */ {n:'前面框',     e:'Front Bezel',      col:'#cbd3dc', k:1.75, d:[0,0,1]}
 +];
 +var REAR_S156 = 3;                  /* 后盖索引 */
 +
 +var UI = {
 +  zh:{open:'打开后盖', close:'装回后盖', xray:'透视', parts:'零件', front:'前视', back:'后视',
 +      side:'侧视', iso:'等轴', reset:'重置', exp:'拆解', hint:'拖拽旋转 · 滚轮缩放 · 点击零件查看',
 +      load:'加载 3D 模型', loading:'正在载入 3D 模型…', size:'约 1.3 MB', all:'全部显示',
 +      faces:'面数', dim:'尺寸', err:'模型载入失败', sorry:'当前浏览器不支持 WebGL,请用 Chrome / Edge 打开'},
 +  en:{open:'Open cover', close:'Close cover', xray:'X-ray', parts:'Parts', front:'Front', back:'Rear',
 +      side:'Side', iso:'Iso', reset:'Reset', exp:'Explode', hint:'Drag to orbit · Scroll to zoom · Click a part',
 +      load:'Load 3D model', loading:'Loading 3D model…', size:'about 1.3 MB', all:'Show all',
 +      faces:'Faces', dim:'Size', err:'Failed to load model', sorry:'WebGL is not available; please use Chrome or Edge'}
 +};
 +
 +var CSS = ''
 ++ '.v3d{position:absolute;inset:0;overflow:hidden;background:radial-gradient(120% 105% at 50% 0%,#fdfefe 0%,#eaeef3 52%,#d9dfe7 100%);font:400 12px/1.45 "Segoe UI","Microsoft YaHei",sans-serif;}'
 ++ '.v3d canvas{display:block;width:100%;height:100%;cursor:grab;touch-action:none;}'
 ++ '.v3d canvas:active{cursor:grabbing;}'
 ++ '.v3d .tbar{position:absolute;left:9px;top:9px;display:flex;gap:5px;flex-wrap:wrap;max-width:calc(100% - 18px);}'
 ++ '.v3d .tb{font:inherit;font-size:11.5px;padding:3px 9px;border:1px solid #c6d0da;background:rgba(255,255,255,.94);color:#26313c;border-radius:3px;cursor:pointer;white-space:nowrap;}'
 ++ '.v3d .tb:hover{background:#eef6fd;border-color:#84aede;}'
 ++ '.v3d .tb.on{background:#0b5394;border-color:#0b5394;color:#fff;}'
 ++ '.v3d .tb.hot{border-color:#0b7a75;color:#0b7a75;}'
 ++ '.v3d .tb.hot.on{background:#0b7a75;color:#fff;}'
 ++ '.v3d .ebar{position:absolute;left:9px;right:9px;bottom:8px;display:flex;align-items:center;gap:8px;padding:5px 9px;background:rgba(255,255,255,.9);border:1px solid #dbe2ea;border-radius:3px;}'
 ++ '.v3d .ebar input{flex:1;height:3px;-webkit-appearance:none;appearance:none;background:#cfd8e2;border-radius:2px;outline:none;}'
 ++ '.v3d .ebar input::-webkit-slider-thumb{-webkit-appearance:none;width:13px;height:13px;border-radius:50%;background:#0b5394;cursor:pointer;box-shadow:0 1px 3px rgba(0,0,0,.25);}'
 ++ '.v3d .ebar .lb{font-size:11px;color:#4a5765;white-space:nowrap;}'
 ++ '.v3d .ebar .pv{font-size:11px;color:#0b5394;font-variant-numeric:tabular-nums;min-width:30px;text-align:right;}'
 ++ '.v3d .hint{position:absolute;right:9px;bottom:44px;font-size:10.5px;color:#6b7681;background:rgba(255,255,255,.82);padding:2px 7px;border-radius:2px;}'
 ++ '.v3d .plist{position:absolute;right:9px;top:44px;width:150px;max-height:calc(100% - 96px);overflow:auto;background:rgba(255,255,255,.96);border:1px solid #cbd4de;border-radius:4px;padding:5px;display:none;box-shadow:0 6px 18px rgba(20,40,60,.14);}'
 ++ '.v3d .plist.on{display:block;}'
 ++ '.v3d .pi{display:flex;align-items:center;gap:6px;padding:3px 5px;border-radius:3px;cursor:pointer;font-size:11.5px;color:#26313c;}'
 ++ '.v3d .pi:hover{background:#eef6fd;}'
 ++ '.v3d .pi.sel{background:#dbeafb;box-shadow:inset 2px 0 0 #0b5394;}'
 ++ '.v3d .pi.off{opacity:.36;}'
 ++ '.v3d .pi i{width:9px;height:9px;border-radius:2px;flex:0 0 9px;border:1px solid rgba(0,0,0,.2);}'
 ++ '.v3d .pi span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}'
 ++ '.v3d .tip{position:absolute;padding:5px 9px;background:rgba(23,32,42,.92);color:#fff;font-size:11px;border-radius:3px;pointer-events:none;display:none;max-width:190px;line-height:1.5;}'
 ++ '.v3d .tip.on{display:block;}'
 ++ '.v3d .tip b{color:#8fc2ff;font-weight:600;}'
 ++ '.v3d .cover{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:9px;background:rgba(255,255,255,.92);}'
 ++ '.v3d .cover .b{font:inherit;font-size:12.5px;padding:7px 16px;border:1px solid #0b5394;background:#0b5394;color:#fff;border-radius:3px;cursor:pointer;}'
 ++ '.v3d .cover .b:hover{background:#0a4880;}'
 ++ '.v3d .cover .s{font-size:11px;color:#78838f;}'
 ++ '.v3d .bar{width:150px;height:3px;background:#dde4ec;border-radius:2px;overflow:hidden;}'
 ++ '.v3d .bar>i{display:block;height:100%;width:6%;background:#0b5394;transition:width .18s;}';
 +
 +/* ===== 数学 ===== */
 +function persp(f,a,n,r){var t=1/Math.tan(f/2),d=1/(n-r);return new Float32Array([t/a,0,0,0,0,t,0,0,0,0,(r+n)*d,-1,0,0,2*r*n*d,0]);}
 +function look(e,c,u){
 +  var zx=e[0]-c[0],zy=e[1]-c[1],zz=e[2]-c[2],zl=Math.hypot(zx,zy,zz)||1;zx/=zl;zy/=zl;zz/=zl;
 +  var xx=u[1]*zz-u[2]*zy,xy=u[2]*zx-u[0]*zz,xz=u[0]*zy-u[1]*zx,xl=Math.hypot(xx,xy,xz)||1;xx/=xl;xy/=xl;xz/=xl;
 +  var yx=zy*xz-zz*xy,yy=zz*xx-zx*xz,yz=zx*xy-zy*xx;
 +  return new Float32Array([xx,yx,zx,0,xy,yy,zy,0,xz,yz,zz,0,
 +    -(xx*e[0]+xy*e[1]+xz*e[2]),-(yx*e[0]+yy*e[1]+yz*e[2]),-(zx*e[0]+zy*e[1]+zz*e[2]),1]);
 +}
 +function mmul(a,b){var o=new Float32Array(16);for(var c=0;c<4;c++)for(var r=0;r<4;r++){var s=0;for(var k=0;k<4;k++)s+=a[k*4+r]*b[c*4+k];o[c*4+r]=s;}return o;}
 +function nmat(n){
 +  if(n.matrix)return new Float32Array(n.matrix);
 +  var t=n.translation||[0,0,0],q=n.rotation||[0,0,0,1],s=n.scale||[1,1,1];
 +  var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;
 +  return new Float32Array([(1-(yy+zz))*s[0],(xy+wz)*s[0],(xz-wy)*s[0],0,(xy-wz)*s[1],(1-(xx+zz))*s[1],(yz+wx)*s[1],0,(xz+wy)*s[2],(yz-wx)*s[2],(1-(xx+yy))*s[2],0,t[0],t[1],t[2],1]);
 +}
 +function ap(m,v){return [m[0]*v[0]+m[4]*v[1]+m[8]*v[2]+m[12],m[1]*v[0]+m[5]*v[1]+m[9]*v[2]+m[13],m[2]*v[0]+m[6]*v[1]+m[10]*v[2]+m[14]];}
 +function hex(h){return [parseInt(h.slice(1,3),16)/255,parseInt(h.slice(3,5),16)/255,parseInt(h.slice(5,7),16)/255];}
 +
 +/* ===== 载入 ===== */
 +function unzip(ab){
 +  var d=new DataView(ab);
 +  if(d.getUint32(0,true)!==0x04034b50)throw new Error('zip');
 +  if(d.getUint16(8,true)!==0)throw new Error('zip mode');
 +  var cs=d.getUint32(18,true),nl=d.getUint16(26,true),el=d.getUint16(28,true),st=30+nl+el;
 +  return ab.slice(st,st+cs);
 +}
 +function parseGLB(ab){
 +  var d=new DataView(ab);
 +  if(d.getUint32(0,true)!==0x46546C67)throw new Error('glb');
 +  var len=d.getUint32(8,true),o=12,j=null,b=null;
 +  while(o<len){
 +    var cl=d.getUint32(o,true),ct=d.getUint32(o+4,true);o+=8;
 +    var c=ab.slice(o,o+cl);
 +    if(ct===0x4E4F534A)j=JSON.parse(new TextDecoder().decode(c));
 +    else if(ct===0x004E4942)b=c;
 +    o+=cl;
 +  }
 +  return {json:j,bin:b};
 +}
 +var CT={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};
 +function acc(g,i){
 +  var a=g.json.accessors[i],v=g.json.bufferViews[a.bufferView],T=CT[a.componentType];
 +  var it=a.type==='VEC3'?3:a.type==='VEC2'?2:a.type==='SCALAR'?1:4;
 +  var off=(v.byteOffset||0)+(a.byteOffset||0),st=v.byteStride||0;
 +  if(st&&st!==it*T.BYTES_PER_ELEMENT){
 +    var o=new T(a.count*it);
 +    for(var k=0;k<a.count;k++)o.set(new T(g.bin,off+k*st,it),k*it);
 +    return o;
 +  }
 +  return new T(g.bin,off,a.count*it);
 +}
 +function build(g){
 +  var ps=[],pos=[],nrm=[],idx=[],vb=0,ib=0;
 +  var sc=g.json.scenes[g.json.scene||0],stack=[];
 +  (sc.nodes||[]).forEach(function(n){stack.push([n,new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])]);});
 +  while(stack.length){
 +    var cur=stack.pop(),ni=g.json.nodes[cur[0]],M=mmul(cur[1],nmat(ni));
 +    if(ni.mesh!==undefined){
 +      g.json.meshes[ni.mesh].primitives.forEach(function(p){
 +        var P=acc(g,p.attributes.POSITION),N=p.attributes.NORMAL!==undefined?acc(g,p.attributes.NORMAL):null,
 +            I=p.indices!==undefined?acc(g,p.indices):null;
 +        var start=ib,vc=P.length/3,i,mn=[1e9,1e9,1e9],mx=[-1e9,-1e9,-1e9];
 +        for(i=0;i<P.length;i+=3){
 +          var v=ap(M,[P[i],P[i+1],P[i+2]]);
 +          pos.push(v[0],v[1],v[2]);
 +          for(var a=0;a<3;a++){if(v[a]<mn[a])mn[a]=v[a];if(v[a]>mx[a])mx[a]=v[a];}
 +        }
 +        for(i=0;i<vc;i++){
 +          if(N){var w=ap(M,[N[i*3],N[i*3+1],N[i*3+2]]),l=Math.hypot(w[0],w[1],w[2])||1;nrm.push(w[0]/l,w[1]/l,w[2]/l);}
 +          else nrm.push(0,1,0);
 +        }
 +        if(I)for(i=0;i<I.length;i++)idx.push(I[i]+vb);
 +        else for(i=0;i<vc;i++)idx.push(i+vb);
 +        ps.push({pi:ps.length,start:start,count:idx.length-start,mn:mn,mx:mx,
 +          c:[(mn[0]+mx[0])/2,(mn[1]+mx[1])/2,(mn[2]+mx[2])/2],
 +          size:[mx[0]-mn[0],mx[1]-mn[1],mx[2]-mn[2]],vis:true});
 +        vb+=vc;ib=idx.length;
 +      });
 +    }
 +    (ni.children||[]).forEach(function(ch){stack.push([ch,M]);});
 +  }
 +  var box=[1e9,1e9,1e9,-1e9,-1e9,-1e9];
 +  ps.forEach(function(p){for(var a=0;a<3;a++){box[a]=Math.min(box[a],p.mn[a]);box[a+3]=Math.max(box[a+3],p.mx[a]);}});
 +  return {parts:ps,pos:new Float32Array(pos),nrm:new Float32Array(nrm),idx:new Uint32Array(idx),box:box,
 +    center:[(box[0]+box[3])/2,(box[1]+box[4])/2,(box[2]+box[5])/2],
 +    diag:Math.hypot(box[3]-box[0],box[4]-box[1],box[5]-box[2])};
 +}
 +
 +/* ===== 主函数 ===== */
 +return function(host,cfg){
 +  cfg=cfg||{};
 +  var L=UI[cfg.lang==='en'?'en':'zh'];
 +  var PARTS=cfg.parts||PARTS_S156, REAR=cfg.rear!==undefined?cfg.rear:REAR_S156;
 +  if(!document.getElementById('sml3d-css')){
 +    var st=document.createElement('style');st.id='sml3d-css';st.textContent=CSS;document.head.appendChild(st);
 +  }
 +  var root=document.createElement('div');root.className='v3d';
 +  root.innerHTML=''
 +   +'<canvas></canvas>'
 +   +'<div class="tbar">'
 +   +'<button class="tb" data-v="front">'+L.front+'</button>'
 +   +'<button class="tb" data-v="back">'+L.back+'</button>'
 +   +'<button class="tb" data-v="side">'+L.side+'</button>'
 +   +'<button class="tb on" data-v="iso">'+L.iso+'</button>'
 +   +'<button class="tb hot" data-a="cover">'+L.open+'</button>'
 +   +'<button class="tb" data-a="xray">'+L.xray+'</button>'
 +   +'<button class="tb" data-a="parts">'+L.parts+'</button>'
 +   +'</div>'
 +   +'<div class="plist"></div>'
 +   +'<div class="hint">'+L.hint+'</div>'
 +   +'<div class="ebar"><span class="lb">'+L.exp+'</span><input type="range" min="0" max="100" value="0"><span class="pv">0%</span></div>'
 +   +'<div class="tip"></div>'
 +   +'<div class="cover"><button class="b">'+L.load+'</button><span class="s">'+(cfg.size||L.size)+'</span></div>';
 +  host.appendChild(root);
 +
 +  var cv=root.querySelector('canvas');
 +  var gl=cv.getContext('webgl2',{antialias:true,alpha:true,premultipliedAlpha:false});
 +  if(!gl){root.querySelector('.cover').innerHTML='<span class="s">'+L.sorry+'</span>';return {};}
 +
 +  var VS=['#version 300 es','in vec3 aP;in vec3 aN;uniform mat4 uP,uV;uniform vec3 uO;out vec3 vP;out vec3 vN;',
 +    'void main(){vec3 p=aP+uO;vP=p;vN=aN;gl_Position=uP*uV*vec4(p,1.0);}'].join('\n');
 +  var FS=['#version 300 es','precision highp float;in vec3 vP;in vec3 vN;uniform vec3 uC,uE;uniform float uS,uD,uX,uA;uniform mat4 uV;out vec4 f;',
 +    'void main(){vec3 N=normalize(vN),V=normalize(uE-vP);if(dot(N,V)<0.0)N=-N;',
 +    'mat3 R=mat3(uV);vec3 Nv=normalize(R*N),Vv=normalize(R*V);vec3 L1=normalize(vec3(-0.42,0.58,0.70)),L2=normalize(vec3(0.60,-0.30,0.74));',
 +    'float k1=max(dot(Nv,L1),0.0),k2=max(dot(Nv,L2),0.0);vec3 H=normalize(L1+Vv);',
 +    'float sp=pow(max(dot(Nv,H),0.0),46.0)*0.30;float rm=pow(1.0-max(dot(Nv,Vv),0.0),3.0)*0.20;',
 +    'vec3 c=uC*(0.34+0.52*k1+0.20*k2)+vec3(sp)+vec3(rm)*0.55;',
 +    'if(uS>0.5)c=mix(c,vec3(0.12,0.40,0.85),0.34);if(uX>0.5)c=mix(c,vec3(0.40,0.48,0.58),0.55);else if(uD>0.5)c=mix(c,vec3(0.72,0.76,0.81),0.62);',
 +    'float a=1.0;if(uD>0.5)a*=mix(0.40,1.0,uX);f=vec4(c,a*uA);}'].join('\n');
 +  function sh(t,s){var o=gl.createShader(t);gl.shaderSource(o,s);gl.compileShader(o);
 +    if(!gl.getShaderParameter(o,gl.COMPILE_STATUS))throw new Error(gl.getShaderInfoLog(o));return o;}
 +  var pr=gl.createProgram();
 +  gl.attachShader(pr,sh(gl.VERTEX_SHADER,VS));gl.attachShader(pr,sh(gl.FRAGMENT_SHADER,FS));
 +  gl.bindAttribLocation(pr,0,'aP');gl.bindAttribLocation(pr,1,'aN');gl.linkProgram(pr);gl.useProgram(pr);
 +  var U={};['uP','uV','uO','uC','uE','uS','uD','uX','uA'].forEach(function(n){U[n]=gl.getUniformLocation(pr,n);});
 +
 +  var cam={th:0.60,ph:0.19,dist:3,tgt:[0,0,0],fov:34*Math.PI/180};
 +  var model=null,explode=0,sel=-1,xray=false,coverHidden=false;
 +  var buf={};
 +
 +  function eye(){var cp=Math.cos(cam.ph);return [cam.tgt[0]+cam.dist*cp*Math.sin(cam.th),cam.tgt[1]+cam.dist*Math.sin(cam.ph),cam.tgt[2]+cam.dist*cp*Math.cos(cam.th)];}
 +  function fitDist(){
 +    var w=cv.clientWidth||1,h=cv.clientHeight||1,as=w/h;
 +    var fv=cam.fov,fh=2*Math.atan(Math.tan(fv/2)*as),R=model.diag/2*1.06;
 +    return R/Math.sin(Math.min(fv,fh)/2);
 +  }
 +  /* 视角平滑过渡 */
 +  var tw=null;
 +  function tween(to){
 +    var from={th:cam.th,ph:cam.ph,dist:cam.dist};
 +    var t0=performance.now();
 +    if(to.th!==undefined&&Math.abs(to.th-cam.th)>Math.PI)cam.th+=(cam.th>to.th?1:-1)*2*Math.PI;
 +    from.th=cam.th;
 +    tw={from:from,to:to,t0:t0,dur:420};
 +    if(!tw.run){tw.run=true;(function step(){ if(!tw){return;}
 +      var k=Math.min(1,(performance.now()-tw.t0)/tw.dur),e=k<0.5?2*k*k:1-Math.pow(-2*k+2,2)/2;
 +      cam.th=tw.from.th+(tw.to.th-tw.from.th)*e;
 +      cam.ph=tw.from.ph+(tw.to.ph-tw.from.ph)*e;
 +      cam.dist=tw.from.dist+(tw.to.dist-tw.from.dist)*e;
 +      draw();
 +      if(k<1)requestAnimationFrame(step);else tw=null;
 +    })();}
 +  }
 +  function off(p){
 +    var m=PARTS[p.pi]||{k:0.5,d:[0,0,1]};
 +    var g=explode*model.diag*0.20*(m.k===undefined?0.5:m.k);
 +    return [m.d[0]*g,m.d[1]*g,m.d[2]*g];
 +  }
 +  function col(p){return (PARTS[p.pi]&&PARTS[p.pi].col)||'#9aa4b0';}
 +
 +  function draw(){
 +    var dpr=Math.min(window.devicePixelRatio||1,2),w=cv.clientWidth||1,h=cv.clientHeight||1;
 +    if(cv.width!==w*dpr||cv.height!==h*dpr){cv.width=w*dpr;cv.height=h*dpr;}
 +    gl.viewport(0,0,cv.width,cv.height);
 +    gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);
 +    if(xray){gl.disable(gl.DEPTH_TEST);}else{gl.enable(gl.DEPTH_TEST);}gl.disable(gl.CULL_FACE);gl.enable(gl.BLEND);
 +    gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA);
 +    var e=eye();
 +    gl.uniformMatrix4fv(U.uP,false,persp(cam.fov,w/h,model.diag*0.01,model.diag*12));
 +    gl.uniformMatrix4fv(U.uV,false,look(e,cam.tgt,[0,1,0]));
 +    gl.uniform3fv(U.uE,e);
 +    gl.bindBuffer(gl.ARRAY_BUFFER,buf.p);gl.enableVertexAttribArray(0);gl.vertexAttribPointer(0,3,gl.FLOAT,false,0,0);
 +    gl.bindBuffer(gl.ARRAY_BUFFER,buf.n);gl.enableVertexAttribArray(1);gl.vertexAttribPointer(1,3,gl.FLOAT,false,0,0);
 +    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,buf.i);
 +    var any=sel>=0;
 +    model.parts.forEach(function(p){
 +      if(!p.vis)return;
 +      var c=hex(col(p));
 +      gl.uniform3f(U.uC,c[0],c[1],c[2]);
 +      gl.uniform3fv(U.uO,off(p));
 +      gl.uniform1f(U.uS,p.pi===sel?1:0);
 +      gl.uniform1f(U.uD,(any&&p.pi!==sel)?1:0);
 +      gl.uniform1f(U.uA, xray ? (p.pi===sel ? 1.0 : (Math.max(p.size[0],p.size[1],p.size[2])>0.075?0.20:0.62)) : 1.0);
 +      gl.uniform1f(U.uX,xray&&p.pi!==sel?1:0);
 +      gl.drawElements(gl.TRIANGLES,p.count,gl.UNSIGNED_INT,p.start*4);
 +    });
 +  }
 +
 +  /* 交互 */
 +  var drag=null;
 +  cv.addEventListener('pointerdown',function(e){cv.setPointerCapture(e.pointerId);drag={x:e.clientX,y:e.clientY,m:0,b:e.button};});
 +  cv.addEventListener('pointermove',function(e){
 +    if(!drag)return;
 +    var dx=e.clientX-drag.x,dy=e.clientY-drag.y;drag.x=e.clientX;drag.y=e.clientY;drag.m+=Math.abs(dx)+Math.abs(dy);
 +    if(drag.b===2||e.shiftKey){
 +      var k=cam.dist*0.0016;
 +      cam.tgt[0]-=Math.cos(cam.th)*dx*k;cam.tgt[2]+=Math.sin(cam.th)*dx*k;cam.tgt[1]+=dy*k;
 +    }else{
 +      cam.th-=dx*0.008;cam.ph=Math.max(-1.45,Math.min(1.45,cam.ph+dy*0.006));
 +    }
 +    draw();
 +  });
 +  cv.addEventListener('pointerup',function(e){if(drag&&drag.m<6&&drag.b===0)pick(e);drag=null;});
 +  cv.addEventListener('contextmenu',function(e){e.preventDefault();});
 +  cv.addEventListener('wheel',function(e){
 +    e.preventDefault();
 +    cam.dist*=1+Math.sign(e.deltaY)*0.09;
 +    cam.dist=Math.max(model.diag*0.3,Math.min(model.diag*3.2,cam.dist));
 +    draw();
 +  },{passive:false});
 +
 +  function pick(e){
 +    var r=cv.getBoundingClientRect();
 +    var nx=((e.clientX-r.left)/r.width)*2-1,ny=1-((e.clientY-r.top)/r.height)*2;
 +    var o=eye(),f=[cam.tgt[0]-o[0],cam.tgt[1]-o[1],cam.tgt[2]-o[2]],fl=Math.hypot(f[0],f[1],f[2]);
 +    f=[f[0]/fl,f[1]/fl,f[2]/fl];
 +    var rt=[f[1]*0-f[2]*1,f[2]*0-f[0]*0,f[0]*1-f[1]*0],rl=Math.hypot(rt[0],rt[1],rt[2])||1;
 +    rt=[rt[0]/rl,rt[1]/rl,rt[2]/rl];
 +    var up=[rt[1]*f[2]-rt[2]*f[1],rt[2]*f[0]-rt[0]*f[2],rt[0]*f[1]-rt[1]*f[0]];
 +    var hh=Math.tan(cam.fov/2),hw=hh*(r.width/r.height);
 +    var d=[f[0]+rt[0]*nx*hw+up[0]*ny*hh,f[1]+rt[1]*nx*hw+up[1]*ny*hh,f[2]+rt[2]*nx*hw+up[2]*ny*hh];
 +    var dl=Math.hypot(d[0],d[1],d[2]);d=[d[0]/dl,d[1]/dl,d[2]/dl];
 +    var best=-1,bt=1e12;
 +    model.parts.forEach(function(p){
 +      if(!p.vis)return;
 +      var of=off(p),cx=p.c[0]+of[0],cy=p.c[1]+of[1],cz=p.c[2]+of[2];
 +      var oc=[cx-o[0],cy-o[1],cz-o[2]],tca=oc[0]*d[0]+oc[1]*d[1]+oc[2]*d[2];
 +      var rad=Math.hypot(p.size[0],p.size[1],p.size[2])/2;
 +      if(tca<0)return;
 +      if((oc[0]*oc[0]+oc[1]*oc[1]+oc[2]*oc[2])-tca*tca>rad*rad)return;
 +      for(var i=p.start;i<p.start+p.count;i+=3){
 +        var a=model.idx[i]*3,b=model.idx[i+1]*3,c=model.idx[i+2]*3;
 +        var t=rt3(o,d,
 +          [model.pos[a]+of[0],model.pos[a+1]+of[1],model.pos[a+2]+of[2]],
 +          [model.pos[b]+of[0],model.pos[b+1]+of[1],model.pos[b+2]+of[2]],
 +          [model.pos[c]+of[0],model.pos[c+1]+of[1],model.pos[c+2]+of[2]]);
 +        if(t>0&&t<bt){bt=t;best=p.pi;}
 +      }
 +    });
 +    select(best,e);
 +  }
 +  function rt3(o,d,a,b,c){
 +    var e1=[b[0]-a[0],b[1]-a[1],b[2]-a[2]],e2=[c[0]-a[0],c[1]-a[1],c[2]-a[2]];
 +    var p=[d[1]*e2[2]-d[2]*e2[1],d[2]*e2[0]-d[0]*e2[2],d[0]*e2[1]-d[1]*e2[0]];
 +    var det=e1[0]*p[0]+e1[1]*p[1]+e1[2]*p[2];
 +    if(Math.abs(det)<1e-9)return -1;
 +    var iv=1/det,t=[o[0]-a[0],o[1]-a[1],o[2]-a[2]];
 +    var u=(t[0]*p[0]+t[1]*p[1]+t[2]*p[2])*iv;
 +    if(u<0||u>1)return -1;
 +    var q=[t[1]*e1[2]-t[2]*e1[1],t[2]*e1[0]-t[0]*e1[2],t[0]*e1[1]-t[1]*e1[0]];
 +    var v=(d[0]*q[0]+d[1]*q[1]+d[2]*q[2])*iv;
 +    if(v<0||u+v>1)return -1;
 +    return (e2[0]*q[0]+e2[1]*q[1]+e2[2]*q[2])*iv;
 +  }
 +
 +  var plist=root.querySelector('.plist'),tip=root.querySelector('.tip');
 +  function nm(p){var m=PARTS[p.pi];if(!m)return (cfg.lang==='en'?'Part ':'零件 ')+(p.pi+1);return cfg.lang==='en'?m.e:m.n;}
 +  function buildList(){
 +    plist.innerHTML='';
 +    model.parts.slice().sort(function(a,b){return b.size[0]*b.size[1]-a.size[0]*a.size[1];}).forEach(function(p){
 +      var el=document.createElement('div');
 +      el.className='pi';el.dataset.pi=p.pi;
 +      el.innerHTML='<i style="background:'+col(p)+'"></i><span>'+nm(p)+'</span>';
 +      el.addEventListener('click',function(ev){
 +        if(ev.altKey){p.vis=!p.vis;sync();draw();return;}
 +        select(p.pi===sel?-1:p.pi);
 +      });
 +      el.addEventListener('dblclick',function(){p.vis=!p.vis;sync();draw();});
 +      plist.appendChild(el);
 +    });
 +    sync();
 +  }
 +  function sync(){
 +    plist.querySelectorAll('.pi').forEach(function(el){
 +      var p=model.parts[+el.dataset.pi];
 +      el.classList.toggle('off',!p.vis);el.classList.toggle('sel',p.pi===sel);
 +    });
 +  }
 +  function select(pi,e){
 +    sel=pi;sync();draw();
 +    if(pi<0||!e){tip.classList.remove('on');return;}
 +    var p=model.parts[pi],s=p.size.map(function(v){return Math.round(v*1000);});
 +    tip.innerHTML='<b>'+nm(p)+'</b><br>'+L.dim+' '+s[0]+' × '+s[1]+' × '+s[2]+' mm<br>'+L.faces+' '+(p.count/3|0);
 +    var r=host.getBoundingClientRect();
 +    tip.style.left=Math.min(r.width-200,e.clientX-r.left+12)+'px';
 +    tip.style.top=Math.min(r.height-70,e.clientY-r.top+12)+'px';
 +    tip.classList.add('on');
 +  }
 +
 +  /* 工具栏 */
 +  root.querySelectorAll('.tb').forEach(function(b){
 +    b.addEventListener('click',function(){
 +      var v=b.dataset.v,a=b.dataset.a;
 +      if(v){
 +        root.querySelectorAll('.tb[data-v]').forEach(function(x){x.classList.remove('on');});
 +        b.classList.add('on');
 +        var to={ph:v==='iso'?0.28:0.02,dist:fitDist()};
 +        if(v==='front')to.th=0;
 +        if(v==='back')to.th=Math.PI;
 +        if(v==='side')to.th=-Math.PI/2;
 +        if(v==='iso')to.th=0.60;
 +        cam.tgt=[model.center[0],model.center[1],model.center[2]];
 +        tween(to);return;
 +      }
 +      if(a==='parts'){plist.classList.toggle('on');b.classList.toggle('on');return;}
 +      if(a==='xray'){xray=!xray;b.classList.toggle('on',xray);draw();return;}
 +      if(a==='cover'){
 +        coverHidden=!coverHidden;
 +        model.parts[REAR].vis=!coverHidden;
 +        b.classList.toggle('on',coverHidden);
 +        b.textContent=coverHidden?L.close:L.open;
 +        if(coverHidden){
 +          explode=0.5;root.querySelector('.ebar input').value=50;root.querySelector('.pv').textContent='50%';
 +          tween({th:Math.PI*0.80,ph:0.24,dist:fitDist()*1.02});
 +        }else{
 +          explode=0;root.querySelector('.ebar input').value=0;root.querySelector('.pv').textContent='0%';
 +          tween({th:0.60,ph:0.28,dist:fitDist()});
 +        }
 +        sync();draw();return;
 +      }
 +    });
 +  });
 +  var sld=root.querySelector('.ebar input');
 +  sld.addEventListener('input',function(){
 +    explode=+sld.value/100;root.querySelector('.pv').textContent=sld.value+'%';
 +    if(coverHidden&&explode<0.15){coverHidden=false;model.parts[REAR].vis=true;
 +      var cb=root.querySelector('.tb[data-a=cover]');cb.classList.remove('on');cb.textContent=L.open;}
 +    draw();
 +  });
 +
 +  /* 加载 */
 +  var started=false;
 +  function start(){
 +    if(started)return;started=true;
 +    var cover=root.querySelector('.cover');
 +    cover.innerHTML=L.loading+'<div class="bar"><i></i></div>';
 +    var bar=cover.querySelector('.bar>i');
 +    fetch(cfg.url).then(function(r){
 +      if(!r.ok)throw new Error('HTTP '+r.status);
 +      var tot=+r.headers.get('content-length')||0,got=0,ch=[],rd=r.body.getReader();
 +      return (function pump(){
 +        return rd.read().then(function(x){
 +          if(x.done)return;
 +          ch.push(x.value);got+=x.value.length;
 +          if(tot)bar.style.width=Math.min(94,6+90*got/tot)+'%';
 +          return pump();
 +        });
 +      })().then(function(){
 +        var b=new Uint8Array(got),o=0;ch.forEach(function(c){b.set(c,o);o+=c.length;});
 +        return b.buffer;
 +      });
 +    }).then(function(ab){
 +      model=build(parseGLB(unzip(ab)));
 +      buf.p=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf.p);gl.bufferData(gl.ARRAY_BUFFER,model.pos,gl.STATIC_DRAW);
 +      buf.n=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf.n);gl.bufferData(gl.ARRAY_BUFFER,model.nrm,gl.STATIC_DRAW);
 +      buf.i=gl.createBuffer();gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,buf.i);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,model.idx,gl.STATIC_DRAW);
 +      bar.style.width='100%';
 +      cover.style.display='none';
 +      cam.tgt=[model.center[0],model.center[1],model.center[2]];
 +      cam.dist=fitDist();
 +      window.__parts=model.parts;
 +      if(cfg.only!==undefined){model.parts.forEach(function(q){q.vis=q.pi===cfg.only;});}
 +      buildList();draw();
 +      if(cfg.boom!==undefined){
 +        explode=cfg.boom;
 +        root.querySelector('.ebar input').value=Math.round(explode*100);
 +        root.querySelector('.pv').textContent=Math.round(explode*100)+'%';
 +      }
 +      if(cfg.hideCover){
 +        coverHidden=true;model.parts[REAR].vis=false;
 +        var cb=root.querySelector('.tb[data-a=cover]');
 +        cb.classList.add('on');cb.textContent=L.close;
 +        sync();
 +      }
 +      if(cfg.view){cam.th=cfg.view==='back'?Math.PI:cfg.view==='side'?-Math.PI/2:0.60;
 +        cam.ph=cfg.view==='iso'?0.28:0.02;}
 +      draw();
 +    }).catch(function(err){
 +      cover.innerHTML='<span class="s">'+L.err+':'+err.message+'</span>';
 +    });
 +  }
 +  root.querySelector('.cover .b').addEventListener('click',start);
 +  host.__sml3dStart=start;
 +  window.addEventListener('resize',function(){if(model)draw();});
 +  return {start:start,ondraw:draw};
 +};
 +})();
 +
 +</script></html>
 +<html><script>
 +/* 3D 拆解视角:捕获阶段接管图库按钮,不改动本页原有的切换脚本 */
 +(function () {
 +  var host = document.getElementById('sml-3d');
 +  if (!host) return;
 +  var stage = host.parentNode, side = document.querySelector('.sml-g-side');
 +  var v3 = null, on = false;
 +  function parseParts(btn) {
 +    try {
 +      var a = JSON.parse(btn.getAttribute('data-parts') || '[]');
 +      return a.map(function (r) { return {n: r[0], e: r[1], col: r[2], k: r[3], d: [0, 0, r[4]]}; });
 +    } catch (e) { return null; }
 +  }
 +  function enter(btn) {
 +    on = true;
 +    stage.className = 'sml-g-stage on3d';
 +    if (side) side.className = 'sml-g-side on3d';
 +    if (!v3) {
 +      if (!window.SML3D) return;
 +      v3 = window.SML3D(host, {
 +        url: btn.getAttribute('data-zip'),
 +        lang: btn.getAttribute('data-lang'),
 +        size: btn.getAttribute('data-size'),
 +        parts: parseParts(btn),
 +        rear: +btn.getAttribute('data-rear')
 +      });
 +      v3.start();
 +    }
 +  }
 +  function leave() {
 +    if (!on) return;
 +    on = false;
 +    stage.className = 'sml-g-stage';
 +    if (side) side.className = 'sml-g-side';
 +  }
 +  document.addEventListener('click', function (e) {
 +    var t = e.target;
 +    while (t && t !== document && !(t.tagName === 'BUTTON' && /sml-g-thumb/.test(t.className))) t = t.parentNode;
 +    if (!t || t === document) return;
 +    if (t.hasAttribute('data-3d')) {
 +      e.preventDefault();
 +      e.stopPropagation();
 +      var bs = document.querySelectorAll('button.sml-g-thumb');
 +      for (var i = 0; i < bs.length; i++) bs[i].className = (bs[i] === t ? 'sml-g-thumb on' : 'sml-g-thumb');
 +      var cap = document.getElementById('sml-g-cap'), cnt = document.getElementById('sml-g-count');
 +      if (cnt) cnt.textContent = t.getAttribute('data-idx') + ' / ' + (bs.length < 10 ? '0' + bs.length : bs.length);
 +      if (cap) cap.textContent = t.getAttribute('data-cap');
 +      enter(t);
 +    } else {
 +      leave();
 +    }
 +  }, true);
 +})();
 +</script></html>
  
导航

首页
帮助
联系我们

打印/导出