add setDeviceEx interface
simplify the logic of save binary
Merge pull request #429 from bitwangyaoyao:2.4_setdevEx