particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

particle serial wifi is broken on 1.23.0 #375

Closed nrobinson2000 closed 7 years ago

nrobinson2000 commented 7 years ago

@monkbroc , @m-mcgowan , @technobly

$ particle serial wifi
? Should I scan for nearby Wi-Fi networks? Yes
? Select the Wi-Fi network with which you wish to connect your device: ROBINSON
? Should I try to auto-detect the wireless security type? Yes
> Detected WPA(PSK/TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP) security
Attempting to configure Wi-Fi on /dev/cu.usbmodem1411
/usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js:1231
                return cb(security + '\n', startTimeout.bind(self, 10000));
                       ^

TypeError: cb is not a function
    at parseSecurityType (/usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js:1231:12)
    at SerialTrigger.serialDataCallback (/usr/local/lib/node_modules/particle-cli/oldlib/SerialTrigger.js:66:5)
    at emitOne (events.js:101:20)
    at SerialPort.emit (events.js:188:7)
    at whenBored (/usr/local/lib/node_modules/particle-cli/oldlib/SerialBoredParser.js:32:12)
    at Timeout._onTimeout (/usr/local/lib/node_modules/particle-cli/oldlib/SerialBoredParser.js:39:5)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
brettski commented 7 years ago

I had the same issue configuring wifi via serial to a WPA2 access point.

Adding values manual produces a slightly different error than @nrobinson2000 Working on MacBook Pro macOS 10.12.5, nodejs 8.1.1, npm 5.0.3

Brettskiworkmbp:~ brettski$ particle serial wifi
? Should I scan for nearby Wi-Fi networks? Yes
? Select the Wi-Fi network with which you wish to connect your device: Treehouse Guest
? Should I try to auto-detect the wireless security type? No
Attempting to configure Wi-Fi on /dev/cu.usbmodem1421
? Security Type WPA2
(node:14114) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: cb is not a function
(node:14114) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Rolled back particle cli to v1.22 setup works as expected.

technobly commented 7 years ago

Thanks for the reports! I'm quite surprised by this as I tested the changes for 1.23.0 and did not see the same behavior. Testing the released 1.23.0 version again I still don't see it. What version of firmware is running on your devices?

$ particle serial wifi
? Should I scan for nearby Wi-Fi networks? Yes
? Select the Wi-Fi network with which you wish to connect your device: iPhoneHotspot
? Should I try to auto-detect the wireless security type? Yes
> Detected WPA2(PSK/AES/AES) security
Attempting to configure Wi-Fi on /dev/cu.usbmodem1411
? Wi-Fi Password ************
Done! Your device should now restart.
$ particle serial wifi
? Should I scan for nearby Wi-Fi networks? Yes
? Select the Wi-Fi network with which you wish to connect your device: iPhoneHotspot
? Should I try to auto-detect the wireless security type? No
Attempting to configure Wi-Fi on /dev/cu.usbmodem1411
? Wi-Fi Password ************
Done! Your device should now restart.
brettski commented 7 years ago

@technobly I am not sure how to verify what the firmware version is. 0.6.2 perhaps?

technobly commented 7 years ago

@brettski you can put the device in listening mode and run particle identify

brettski commented 7 years ago

@technobly, yeah just figured that out. 0.6.2 is the version. Loaded cli 1.23 again, just in case an I get the same error result.

technobly commented 7 years ago

Ok, I have replicated the issue on 0.6.2. It does work fine with 0.7.0-rc.1 firmware though. Not suggesting you move to that unless you want to test a pre-release. Rolling back to version 1.22.0 is recommended, as the changes to 1.23.0 were only to support WPA2 Enterprise setup.

Rolling back to version 1.22.0 is easy with one command:

npm install -g particle-cli@v1.22.0
brettski commented 7 years ago

Yes, rolling back to cli version 1.22 is how continued to work earlier

nrobinson2000 commented 7 years ago

I had to use:

$ sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli@v1.22.0
technobly commented 7 years ago

FYI: v1.23.1 is released that fixes this problem.