devicely 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/bin/devicely.js +105 -1
  2. package/lib/androidDeviceDetection.js +276 -1
  3. package/lib/appMappings.js +337 -1
  4. package/lib/deviceDetection.js +394 -1
  5. package/lib/devices.js +54 -1
  6. package/lib/doctor.js +94 -1
  7. package/lib/executor.js +104 -1
  8. package/lib/logger.js +35 -1
  9. package/lib/scriptLoader.js +75 -0
  10. package/lib/server.js +3483 -1
  11. package/package.json +3 -12
  12. package/scripts/compile-shell-scripts.js +208 -0
  13. package/scripts/encrypt-shell-simple.js +75 -0
  14. package/scripts/obfuscate-shell.js +160 -0
  15. package/scripts/shell/android_device_control +0 -0
  16. package/scripts/shell/android_device_control.sh +848 -0
  17. package/scripts/shell/apps_presets.conf +271 -0
  18. package/scripts/shell/connect_android_usb +0 -0
  19. package/scripts/shell/connect_android_usb_multi_final +0 -0
  20. package/scripts/shell/connect_android_usb_multi_final.sh +289 -0
  21. package/scripts/shell/connect_android_wireless +0 -0
  22. package/scripts/shell/connect_android_wireless.sh +58 -0
  23. package/scripts/shell/connect_android_wireless_multi_final +0 -0
  24. package/scripts/shell/connect_android_wireless_multi_final.sh +476 -0
  25. package/scripts/shell/connect_ios_usb +0 -0
  26. package/scripts/shell/connect_ios_usb_multi_final +0 -0
  27. package/scripts/shell/connect_ios_usb_multi_final.sh +4225 -0
  28. package/scripts/shell/connect_ios_wireless_multi_final +0 -0
  29. package/scripts/shell/connect_ios_wireless_multi_final.sh +4167 -0
  30. package/scripts/shell/create_production_scripts +0 -0
  31. package/scripts/shell/create_production_scripts.sh +38 -0
  32. package/scripts/shell/devices.conf +24 -0
  33. package/scripts/shell/diagnose_wireless_ios +0 -0
  34. package/scripts/shell/find_element_coordinates +0 -0
  35. package/scripts/shell/find_wda +0 -0
  36. package/scripts/shell/install_uiautomator2 +0 -0
  37. package/scripts/shell/install_uiautomator2.sh +93 -0
  38. package/scripts/shell/ios_device_control +0 -0
  39. package/scripts/shell/ios_device_control.sh +220 -0
  40. package/scripts/shell/organize_project +0 -0
  41. package/scripts/shell/organize_project.sh +59 -0
  42. package/scripts/shell/pre-publish-check +0 -0
  43. package/scripts/shell/pre-publish-check.sh +238 -0
  44. package/scripts/shell/publish +0 -0
  45. package/scripts/shell/publish-to-npm +0 -0
  46. package/scripts/shell/publish-to-npm.sh +366 -0
  47. package/scripts/shell/publish.sh +100 -0
  48. package/scripts/shell/setup +0 -0
  49. package/scripts/shell/setup.sh +121 -0
  50. package/scripts/shell/setup_android +0 -0
  51. package/scripts/shell/start +0 -0
  52. package/scripts/shell/start.sh +59 -0
  53. package/scripts/shell/sync-to-npm-package-final +0 -0
  54. package/scripts/shell/sync-to-npm-package-final.sh +60 -0
  55. package/scripts/shell/test-local-package.sh +95 -0
  56. package/scripts/shell/test_android_locators +0 -0
  57. package/scripts/shell/test_connect +0 -0
  58. package/scripts/shell/test_device_detection +0 -0
  59. package/scripts/shell/test_fixes +0 -0
  60. package/scripts/shell/test_getlocators_fix +0 -0
  61. package/scripts/shell/test_recording_feature +0 -0
  62. package/scripts/shell/verify-shell-protection +0 -0
  63. package/scripts/shell/verify-shell-protection.sh +73 -0
  64. package/scripts/shell/verify_distribution +0 -0
  65. package/lib/package-lock.json +0 -1678
  66. package/lib/package.json +0 -30
  67. package/lib/screenshots/screenshot_ios_iPhone17_20260205_225900.png +0 -0
  68. package/lib/screenshots/screenshot_ios_iPhone17_20260205_225942.png +0 -0
  69. package/lib/screenshots/screenshot_ios_iPhone17_20260205_231101.png +0 -0
  70. package/lib/screenshots/screenshot_ios_iPhone17_20260205_232911.png +0 -0
  71. package/lib/screenshots/screenshot_ios_iPhone17_20260208_095103.png +0 -0
  72. package/lib/screenshots/screenshot_ios_iPhone17_20260208_095720.png +0 -0
  73. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_115040.png +0 -0
  74. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_115047.png +0 -0
  75. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_115118.png +0 -0
  76. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_115125.png +0 -0
  77. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_115143.png +0 -0
  78. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_120107.png +0 -0
  79. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_120118.png +0 -0
  80. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_120137.png +0 -0
  81. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_120201.png +0 -0
  82. package/lib/screenshots/screenshot_ios_iPhoneXR17x_20260206_134529.png +0 -0
  83. package/scripts/shell/android_device_control.enc +0 -1
  84. package/scripts/shell/connect_android_usb_multi_final.enc +0 -1
  85. package/scripts/shell/connect_android_wireless.enc +0 -1
  86. package/scripts/shell/connect_android_wireless_multi_final.enc +0 -1
  87. package/scripts/shell/connect_ios_usb_multi_final.enc +0 -1
  88. package/scripts/shell/connect_ios_wireless_multi_final.enc +0 -1
  89. package/scripts/shell/ios_device_control.enc +0 -1
@@ -0,0 +1,271 @@
1
+ # Platform-Aware App Presets
2
+ # Format: name.platform,bundle_id
3
+ # Priority: Most commonly used apps first (system apps, then popular apps)
4
+ # All apps support both iOS & Android (cross-platform)
5
+
6
+ # ============================================================================
7
+ # SYSTEM APPS (Highest Priority - Most Frequently Used)
8
+ # ============================================================================
9
+
10
+ # Settings
11
+ settings.ios,com.apple.Preferences
12
+ settings.android,com.android.settings
13
+
14
+ # Camera
15
+ camera.ios,com.apple.camera
16
+ camera.android,com.android.camera2
17
+
18
+ # Photos/Gallery
19
+ photos.ios,com.apple.mobileslideshow
20
+ photos.android,com.google.android.apps.photos
21
+
22
+ # Phone
23
+ phone.ios,com.apple.mobilephone
24
+ phone.android,com.google.android.dialer
25
+
26
+ # Messages/SMS
27
+ messages.ios,com.apple.MobileSMS
28
+ messages.android,com.google.android.apps.messaging
29
+
30
+ # Contacts
31
+ contacts.ios,com.apple.MobileAddressBook
32
+ contacts.android,com.google.android.contacts
33
+
34
+ # Mail/Email (default)
35
+ mail.ios,com.apple.mobilemail
36
+ mail.android,com.google.android.gm
37
+
38
+ # Calendar
39
+ calendar.ios,com.apple.mobilecal
40
+ calendar.android,com.google.android.calendar
41
+
42
+ # Clock/Timer
43
+ clock.ios,com.apple.mobiletimer
44
+ clock.android,com.google.android.deskclock
45
+
46
+ # Calculator
47
+ calculator.ios,com.apple.calculator
48
+ calculator.android,com.google.android.calculator
49
+
50
+ # Notes
51
+ notes.ios,com.apple.mobilenotes
52
+ notes.android,com.google.android.keep
53
+
54
+ # ============================================================================
55
+ # BROWSERS (High Priority)
56
+ # ============================================================================
57
+
58
+ # Chrome
59
+ chrome.ios,com.google.chrome.ios
60
+ chrome.android,com.android.chrome
61
+
62
+ # Safari (iOS only)
63
+ safari.ios,com.apple.mobilesafari
64
+
65
+ # Firefox
66
+ firefox.ios,org.mozilla.ios.Firefox
67
+ firefox.android,org.mozilla.firefox
68
+
69
+ # Edge
70
+ edge.ios,com.microsoft.msedge
71
+ edge.android,com.microsoft.emmx
72
+
73
+ # Brave
74
+ brave.ios,com.brave.ios.browser
75
+ brave.android,com.brave.browser
76
+
77
+ # ============================================================================
78
+ # COMMUNICATION APPS (High Priority - Daily Use)
79
+ # ============================================================================
80
+
81
+ # Gmail
82
+ gmail.ios,com.google.Gmail
83
+ gmail.android,com.google.android.gm
84
+
85
+ # WhatsApp
86
+ whatsapp.ios,net.whatsapp.WhatsApp
87
+ whatsapp.android,com.whatsapp
88
+
89
+ # Telegram
90
+ telegram.ios,ph.telegra.Telegraph
91
+ telegram.android,org.telegram.messenger
92
+
93
+ # Zoom
94
+ zoom.ios,us.zoom.videomeetings
95
+ zoom.android,us.zoom.videomeetings
96
+
97
+ # Skype
98
+ skype.ios,com.skype.skype
99
+ skype.android,com.skype.raider
100
+
101
+ # Microsoft Teams
102
+ teams.ios,com.microsoft.skype.teams
103
+ teams.android,com.microsoft.teams
104
+
105
+ # Slack
106
+ slack.ios,com.tinyspeck.chatlyio
107
+ slack.android,com.Slack
108
+
109
+ # Discord
110
+ discord.ios,com.hammerandchisel.discord
111
+ discord.android,com.discord
112
+
113
+ # ============================================================================
114
+ # SOCIAL MEDIA (High Priority - Very Popular)
115
+ # ============================================================================
116
+
117
+ # Instagram
118
+ instagram.ios,com.burbn.instagram
119
+ instagram.android,com.instagram.android
120
+
121
+ # Twitter/X
122
+ twitter.ios,com.atebits.Tweetie2
123
+ twitter.android,com.twitter.android
124
+
125
+ # Facebook
126
+ facebook.ios,com.facebook.Facebook
127
+ facebook.android,com.facebook.katana
128
+
129
+ # TikTok
130
+ tiktok.ios,com.zhiliaoapp.musically
131
+ tiktok.android,com.zhiliaoapp.musically
132
+
133
+ # Snapchat
134
+ snapchat.ios,com.toyopagroup.picaboo
135
+ snapchat.android,com.snapchat.android
136
+
137
+ # LinkedIn
138
+ linkedin.ios,com.linkedin.LinkedIn
139
+ linkedin.android,com.linkedin.android
140
+
141
+ # Reddit
142
+ reddit.ios,com.reddit.Reddit
143
+ reddit.android,com.reddit.frontpage
144
+
145
+ # ============================================================================
146
+ # MAPS & NAVIGATION (High Priority)
147
+ # ============================================================================
148
+
149
+ # Google Maps
150
+ maps.ios,com.apple.Maps
151
+ maps.android,com.google.android.apps.maps
152
+
153
+ # Uber
154
+ uber.ios,com.ubercab.UberClient
155
+ uber.android,com.ubercab
156
+
157
+ # Lyft
158
+ lyft.ios,com.ubercab.Lyft
159
+ lyft.android,me.lyft.android
160
+
161
+ # ============================================================================
162
+ # ENTERTAINMENT (Medium-High Priority - Daily Use)
163
+ # ============================================================================
164
+
165
+ # YouTube
166
+ youtube.ios,com.google.ios.youtube
167
+ youtube.android,com.google.android.youtube
168
+
169
+ # Netflix
170
+ netflix.ios,com.netflix.Netflix
171
+ netflix.android,com.netflix.mediaclient
172
+
173
+ # Spotify
174
+ spotify.ios,com.spotify.client
175
+ spotify.android,com.spotify.music
176
+
177
+ # Apple Music
178
+ applemusic.ios,com.apple.Music
179
+ applemusic.android,com.apple.android.music
180
+
181
+ # Amazon Music
182
+ amazonmusic.ios,com.amazon.mp3
183
+ amazonmusic.android,com.amazon.mp3
184
+
185
+ # Hulu
186
+ hulu.ios,com.hulu.plus
187
+ hulu.android,com.hulu.plus
188
+
189
+ # Disney+
190
+ disneyplus.ios,com.disney.disneyplus
191
+ disneyplus.android,com.disney.disneyplus
192
+
193
+ # Prime Video
194
+ primevideo.ios,com.amazon.aiv.AIVApp
195
+ primevideo.android,com.amazon.avod.thirdpartyclient
196
+
197
+ # ============================================================================
198
+ # PRODUCTIVITY (Medium Priority)
199
+ # ============================================================================
200
+
201
+ # Microsoft Outlook
202
+ outlook.ios,com.microsoft.Office.Outlook
203
+ outlook.android,com.microsoft.office.outlook
204
+
205
+ # Google Drive
206
+ googledrive.ios,com.google.Drive
207
+ googledrive.android,com.google.android.apps.docs
208
+
209
+ # Dropbox
210
+ dropbox.ios,com.getdropbox.Dropbox
211
+ dropbox.android,com.dropbox.android
212
+
213
+ # OneDrive
214
+ onedrive.ios,com.microsoft.skydrive
215
+ onedrive.android,com.microsoft.skydrive
216
+
217
+ # Notion
218
+ notion.ios,notion.id
219
+ notion.android,notion.id
220
+
221
+ # Evernote
222
+ evernote.ios,com.evernote.iPhone.Evernote
223
+ evernote.android,com.evernote
224
+
225
+ # ============================================================================
226
+ # SHOPPING (Lower Priority)
227
+ # ============================================================================
228
+
229
+ # Amazon
230
+ amazon.ios,com.amazon.Amazon
231
+ amazon.android,com.amazon.mShop.android.shopping
232
+
233
+ # eBay
234
+ ebay.ios,com.ebay.iphone
235
+ ebay.android,com.ebay.mobile
236
+
237
+ # Walmart
238
+ walmart.ios,com.walmart.groceries
239
+ walmart.android,com.walmart.android
240
+
241
+ # Target
242
+ target.ios,com.target.mobile
243
+ target.android,com.target.ui
244
+
245
+ # ============================================================================
246
+ # TRAVEL (Lower Priority)
247
+ # ============================================================================
248
+
249
+ # Airbnb
250
+ airbnb.ios,com.airbnb.app
251
+ airbnb.android,com.airbnb.android
252
+
253
+ # Booking.com
254
+ booking.ios,com.booking.BookingApp
255
+ booking.android,com.booking
256
+
257
+ # ============================================================================
258
+ # FINANCE (Lower Priority)
259
+ # ============================================================================
260
+
261
+ # PayPal
262
+ paypal.ios,com.yourcompany.PPClient
263
+ paypal.android,com.paypal.android.p2pmobile
264
+
265
+ # Venmo
266
+ venmo.ios,com.venmo.touch.Venmo
267
+ venmo.android,com.venmo
268
+
269
+ # Cash App
270
+ cashapp.ios,com.squareup.cash
271
+ cashapp.android,com.squareup.cash
@@ -0,0 +1,289 @@
1
+ #!/bin/bash
2
+ # Android Multi-Device USB Control Script
3
+ # Complete feature parity with iOS USB multi-device control
4
+
5
+ SCRIPT_DIR="$(dirname "$0")"
6
+ source "$SCRIPT_DIR/android_device_control.sh"
7
+
8
+ # Check for config files in both local and npm package locations
9
+ if [ -f "$SCRIPT_DIR/devices.conf" ]; then
10
+ CONFIG_FILE="$SCRIPT_DIR/devices.conf"
11
+ elif [ -f "$SCRIPT_DIR/../../config/devices.conf" ]; then
12
+ CONFIG_FILE="$SCRIPT_DIR/../../config/devices.conf"
13
+ else
14
+ echo "❌ Required file not found: devices.conf"
15
+ exit 1
16
+ fi
17
+
18
+ if [ -f "$SCRIPT_DIR/apps_presets.conf" ]; then
19
+ APPS_PRESETS_FILE="$SCRIPT_DIR/apps_presets.conf"
20
+ elif [ -f "$SCRIPT_DIR/../../config/apps_presets.conf" ]; then
21
+ APPS_PRESETS_FILE="$SCRIPT_DIR/../../config/apps_presets.conf"
22
+ else
23
+ echo "❌ Required file not found: apps_presets.conf"
24
+ exit 1
25
+ fi
26
+
27
+ # Port management (using files for bash 3.2 compatibility)
28
+ UIAUTOMATOR2_PORT_BASE=6790
29
+ DEVICE_PORTS_FILE="/tmp/android_usb_ports.$$"
30
+
31
+ # Color codes
32
+ GREEN='\033[0;32m'
33
+ RED='\033[0;31m'
34
+ YELLOW='\033[1;33m'
35
+ BLUE='\033[0;34m'
36
+ NC='\033[0m'
37
+
38
+ # Load Android devices from config
39
+ load_android_devices() {
40
+ local devices=()
41
+
42
+ if [ -f "$CONFIG_FILE" ]; then
43
+ while IFS=',' read -r name serial ip platform type; do
44
+ # Skip comments and empty lines
45
+ [[ "$name" =~ ^#.*$ ]] && continue
46
+ [ -z "$name" ] && continue
47
+
48
+ # Only load Android devices
49
+ if [ "$platform" = "android" ]; then
50
+ devices+=("$name:$serial:$type")
51
+ fi
52
+ done < "$CONFIG_FILE"
53
+ fi
54
+
55
+ echo "${devices[@]}"
56
+ }
57
+
58
+ # Detect connected Android devices via USB
59
+ detect_usb_devices() {
60
+ echo -e "${BLUE}Detecting USB-connected Android devices...${NC}"
61
+
62
+ local devices=()
63
+ while IFS=$'\t' read -r serial status; do
64
+ if [ "$status" = "device" ]; then
65
+ local model=$(adb -s "$serial" shell getprop ro.product.model | tr -d '\r' | tr ' ' '_')
66
+ devices+=("$model:$serial:usb")
67
+ echo -e "${GREEN}✓ Found: $model ($serial)${NC}"
68
+ fi
69
+ done < <(adb devices | tail -n +2)
70
+
71
+ echo "${devices[@]}"
72
+ }
73
+
74
+ # Select target devices
75
+ select_devices() {
76
+ local all_devices=($1)
77
+ local specified_device=$2
78
+ local selected=()
79
+
80
+ if [ -n "$specified_device" ]; then
81
+ # Find specific device
82
+ for device in "${all_devices[@]}"; do
83
+ local name=$(echo "$device" | cut -d':' -f1)
84
+ local serial=$(echo "$device" | cut -d':' -f2)
85
+
86
+ if [ "$name" = "$specified_device" ] || [ "$serial" = "$specified_device" ]; then
87
+ selected+=("$device")
88
+ break
89
+ fi
90
+ done
91
+
92
+ if [ ${#selected[@]} -eq 0 ]; then
93
+ echo -e "${RED}Device not found: $specified_device${NC}" >&2
94
+ return 1
95
+ fi
96
+ else
97
+ # Use all devices
98
+ selected=("${all_devices[@]}")
99
+ fi
100
+
101
+ echo "${selected[@]}"
102
+ }
103
+
104
+ # Execute command on device
105
+ execute_on_device() {
106
+ local device_info=$1
107
+ local command=$2
108
+
109
+ local name=$(echo "$device_info" | cut -d':' -f1)
110
+ local serial=$(echo "$device_info" | cut -d':' -f2)
111
+ local port=$((UIAUTOMATOR2_PORT_BASE))
112
+
113
+ echo -e "\n${YELLOW}━━━ $name ($serial) ━━━${NC}"
114
+
115
+ # Parse command
116
+ local cmd_parts=($command)
117
+ local main_cmd="${cmd_parts[0]}"
118
+ local cmd_args="${command#* }"
119
+
120
+ # Handle app presets
121
+ if [ "$main_cmd" = "launch" ] && [ -f "$APPS_PRESETS_FILE" ]; then
122
+ local app_name="${cmd_parts[1]}"
123
+ local preset=$(grep "^$app_name=" "$APPS_PRESETS_FILE" 2>/dev/null | cut -d'=' -f2)
124
+ if [ -n "$preset" ]; then
125
+ cmd_args="$preset"
126
+ fi
127
+ fi
128
+
129
+ # Execute via android_device_control.sh
130
+ process_command "$serial" "$port" "$main_cmd" $cmd_args
131
+ }
132
+
133
+ # Execute command on multiple devices in parallel
134
+ execute_parallel() {
135
+ local last_idx=$#
136
+ local command="${!last_idx}"
137
+ set -- "${@:1:$(($#-1))}"
138
+
139
+ local pids=()
140
+
141
+ for device in "${devices[@]}"; do
142
+ execute_on_device "$device" "$command" &
143
+ pids+=($!)
144
+ done
145
+
146
+ # Wait for all to complete
147
+ for pid in "${pids[@]}"; do
148
+ wait $pid
149
+ done
150
+ }
151
+
152
+ # Interactive mode
153
+ interactive_mode() {
154
+ local devices=("$@")
155
+
156
+ echo -e "${BLUE}╔════════════════════════════════════════╗${NC}"
157
+ echo -e "${BLUE}║ Android Multi-Device Control (USB) ║${NC}"
158
+ echo -e "${BLUE}╚════════════════════════════════════════╝${NC}"
159
+ echo ""
160
+ echo -e "${GREEN}Connected Devices:${NC}"
161
+
162
+ for i in "${!devices[@]}"; do
163
+ local name=$(echo "${devices[$i]}" | cut -d':' -f1)
164
+ local serial=$(echo "${devices[$i]}" | cut -d':' -f2)
165
+ echo -e " $((i+1)). $name ($serial)"
166
+ done
167
+
168
+ echo ""
169
+ echo -e "${YELLOW}Commands:${NC}"
170
+ echo " launch <package> - Launch app"
171
+ echo " click <text> - Click element"
172
+ echo " type <text> - Type text"
173
+ echo " swipe <direction> - Swipe (up/down/left/right)"
174
+ echo " screenshot - Take screenshot"
175
+ echo " home - Go to home screen"
176
+ echo " back - Go back"
177
+ echo " getLocators - Get UI elements"
178
+ echo " info - Device info"
179
+ echo " listapps - List installed apps"
180
+ echo " quit - Exit"
181
+ echo ""
182
+
183
+ while true; do
184
+ echo -ne "${BLUE}android>${NC} "
185
+ read -r input
186
+
187
+ [ -z "$input" ] && continue
188
+ [ "$input" = "quit" ] && break
189
+
190
+ execute_parallel "${devices[@]}" "$input"
191
+ done
192
+ }
193
+
194
+ # Show help
195
+ show_help() {
196
+ cat << EOF
197
+ Android Multi-Device USB Control
198
+
199
+ Usage:
200
+ $0 # Interactive mode (all devices)
201
+ $0 "command" # Execute on all devices
202
+ $0 -d <device> "command" # Execute on specific device
203
+
204
+ Commands:
205
+ launch <package> [activity] Launch app
206
+ close <package> Close app
207
+ click <text|x,y> Click element
208
+ type <text> Type text
209
+ swipe <up|down|left|right> Swipe gesture
210
+ screenshot Take screenshot
211
+ getLocators Get UI elements
212
+ home Press home button
213
+ back Press back button
214
+ lock Lock device
215
+ unlock Unlock device
216
+ info Device information
217
+ listapps List installed apps
218
+
219
+ Examples:
220
+ $0 "launch com.android.chrome"
221
+ $0 -d Pixel8 "click 'Search'"
222
+ $0 "screenshot"
223
+ $0 -d Galaxy "getLocators"
224
+
225
+ Device Selection:
226
+ -d <name> Target specific device by name
227
+ -d <serial> Target specific device by serial number
228
+
229
+ Configuration:
230
+ devices.conf Device definitions
231
+ apps_presets.conf App package shortcuts
232
+
233
+ EOF
234
+ }
235
+
236
+ # Main
237
+ main() {
238
+ # Parse arguments
239
+ local specified_device=""
240
+ local command=""
241
+
242
+ while [[ $# -gt 0 ]]; do
243
+ case $1 in
244
+ -h|--help)
245
+ show_help
246
+ exit 0
247
+ ;;
248
+ -d)
249
+ specified_device="$2"
250
+ shift 2
251
+ ;;
252
+ *)
253
+ command="$1"
254
+ shift
255
+ break
256
+ ;;
257
+ esac
258
+ done
259
+
260
+ # Detect devices
261
+ local detected_devices=$(detect_usb_devices)
262
+
263
+ if [ -z "$detected_devices" ]; then
264
+ echo -e "${RED}No Android devices detected via USB${NC}"
265
+ echo "Please ensure:"
266
+ echo " 1. Device is connected via USB"
267
+ echo " 2. USB debugging is enabled"
268
+ echo " 3. Device is authorized (check device screen)"
269
+ exit 1
270
+ fi
271
+
272
+ # Select target devices
273
+ local target_devices=$(select_devices "$detected_devices" "$specified_device")
274
+
275
+ if [ -z "$target_devices" ]; then
276
+ exit 1
277
+ fi
278
+
279
+ local devices_array=($target_devices)
280
+
281
+ # Execute command or enter interactive mode
282
+ if [ -n "$command" ]; then
283
+ execute_parallel "${devices_array[@]}" "$command"
284
+ else
285
+ interactive_mode "${devices_array[@]}"
286
+ fi
287
+ }
288
+
289
+ main "$@"
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+ # Simple Android Wireless Command Wrapper
3
+ # Calls android_device_control.sh directly with wireless device handling
4
+
5
+ SCRIPT_DIR="$(dirname "$0")"
6
+ ANDROID_CONTROL="$SCRIPT_DIR/android_device_control.sh"
7
+
8
+ # Parse arguments
9
+ DEVICE_NAME=""
10
+ COMMAND=""
11
+
12
+ while [[ $# -gt 0 ]]; do
13
+ case $1 in
14
+ -d)
15
+ DEVICE_NAME="$2"
16
+ shift 2
17
+ ;;
18
+ *)
19
+ COMMAND="$*"
20
+ break
21
+ ;;
22
+ esac
23
+ done
24
+
25
+ # Find device serial (wireless devices show as IP:PORT)
26
+ if [ -z "$DEVICE_NAME" ]; then
27
+ SERIAL=$(adb devices | tail -n +2 | grep ":5555" | head -1 | awk '{print $1}')
28
+ if [ -z "$SERIAL" ]; then
29
+ echo "Error: No wireless Android devices found"
30
+ exit 1
31
+ fi
32
+ else
33
+ # Check if it's an IP address
34
+ if [[ "$DEVICE_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35
+ SERIAL="$DEVICE_NAME:5555"
36
+ elif adb devices | grep -q "^$DEVICE_NAME"; then
37
+ SERIAL="$DEVICE_NAME"
38
+ else
39
+ # Try to find by model name in wireless devices
40
+ SERIAL=$(adb devices -l | grep ":5555" | grep "$DEVICE_NAME" | awk '{print $1}')
41
+ if [ -z "$SERIAL" ]; then
42
+ SERIAL=$(adb devices | tail -n +2 | grep ":5555" | head -1 | awk '{print $1}')
43
+ fi
44
+ fi
45
+ fi
46
+
47
+ if [ -z "$SERIAL" ]; then
48
+ echo "Error: Could not find wireless device: $DEVICE_NAME"
49
+ exit 1
50
+ fi
51
+
52
+ if [ -z "$COMMAND" ]; then
53
+ echo "Error: No command specified"
54
+ exit 1
55
+ fi
56
+
57
+ # Execute command directly
58
+ exec "$ANDROID_CONTROL" "$SERIAL" $COMMAND