Diskussions- und Newsboard des DARC-Ortsverbandes I40
allgemeine Kategorie => UHSDR Firmware => Message started by: F4HTX on 28. July 2018, 09:30:22

Title: [solved] unable to perform Configuration File Backup
Post by: F4HTX on 28. July 2018, 09:30:22

Hello Friends,

Easier to say than to do...

I am unable to perform the Configuration File Backup : I tried to follow those instructions ( https://github.com/df8oe/UHSDR/wiki/Backup-and-Restore ) and I ended with :

landsofmordor:Desktop francois$ python uhsdr_tool.py
Traceback (most recent call last):
File "uhsdr_tool.py", line 144, in <module>
backupRestoreApp()
File "uhsdr_tool.py", line 51, in backupRestoreApp
import serial
ImportError: No module named serial

I use a Mac computer, Python 2.7.10 and the mchf cat is working fine with wsjtx (usb cable in the DFU socket).


I am really not a code guy, thank you in advance for your understanding :(


Best Regards,

François

[size=1]edit by Mod:
moved to the right category [/size] ;)

Title: Re:unable to perform Configuration File Backup
Post by: DF8OE on 28. July 2018, 10:05:20

You need python serial module. At all my Debian based installations this is installed default and named "python-serial". Because Mac OSX is a cloned Unix/Linux in my eyes it may be that your installation missed this package.

vy 73
Andreas

Title: Re:unable to perform Configuration File Backup
Post by: F4HTX on 28. July 2018, 11:52:54

Hi Andreas,

Thanks for the clue, it helped to go forward.

For OSX users, I installed pyserial using : sudo easy_install pyserial

Then :

francois$ python uhsdr_tool.py
This program backups and restores the configuration of UHSDR TRX via USB
Use -h to get more information

List of detected UHSDR TRX
[u'/dev/cu.usbmodem1D151']
Please specify valid UHSDR TRX serial port number(!) with -p / --port


so I guessed :

francois$ python uhsdr_tool.py -p /dev/cu.usbmodem1D151 -b
usage: uhsdr_tool.py [-h] [-b] [-r] [-p PORT] [-f FILE]
uhsdr_tool.py: error: argument -p/--port: invalid int value: '/dev/cu.usbmodem1D151'



Closer, but not yet...

ioreg gives this (extract) :
| +-o USB Interface mchf@1d150000 <class AppleUSBDevice, id 0x10000ea57, registered, matched, active, busy 0 (14 ms), retain 22>
| "PortNum" = 5
| "USB Serial Number" = "00000000002A"


and :
ls /dev/tty.usb*
/dev/tty.usbmodem1D151


I am not sure what would be the correct syntax for PORT

73's

François

Title: Re:unable to perform Configuration File Backup
Post by: F4HTX on 28. July 2018, 15:14:31

Hi Andreas and Friends,

Success !!

Well almost success, I had to do some tweak that Danilo will not approve...

OSX name the usb devices like /dev/cu.usbmodem1D151, so the script do not know how to handle that. I, brutally and inelegantely, hard coded my device name in the script and the backup performed.

Line 88 of the script : " comPort= ("COM" if os.name == "nt" else "/dev/cu.usbmodem1D151")"


As it already exists for the eeprom, could it be possible to add a backup/restore function for the usb key ?

Thanks for helping ;)

Best Regards,

François

Title: Re:unable to perform Configuration File Backup
Post by: DF8OE on 28. July 2018, 15:49:10

Hi François,
thats the advantage of an interpreter language ::) I think we can improve here something in the script.

Backup via USB key is in our todo list but we do not want to do a simple "binary backup" - it is not robust if you are swapping between different UHSDR versions. So not very simple task.

vy 73
Andreas

Title: Re:unable to perform Configuration File Backup
Post by: F4HTX on 28. July 2018, 16:00:04

Hi Andreas,

You are right about modern language, and thank you for the clean programming.

About the robustness of a backup/restore on key, an intermediary step might be to set an intermediary dialog saying "this is a version x file and you are running a version y code, are you really sure you want to do this ?).

This is absolutely not perfect, bu t this might save a lot of time when testing, experimenting or bug hunting.

Best Regards,

François

Title: Re:[solved] unable to perform Configuration File Backup
Post by: DB4PLE on 28. July 2018, 21:13:41

Hi Francois,

I think, it should be not a problem to
a) support OSX
b) teach -p to accept full device names.

since b) includes a) we should work on b).

Please replace the line "comPort = ...."
with

Code:

try:
int(args.port);
comPort= ("COM" if os.name == "nt" else "/dev/ttyACM") + str(args.port)
except:
comPort = args.port


Now you can pass full device names as well as numbers (numbers will work only on Linux and Windows).

Please test, report and I'll update the code (or you create a pull request on GitHub).

73
Danilo


Title: Re:[solved] unable to perform Configuration File Backup
Post by: F4HTX on 29. July 2018, 06:39:55

Hi Danilo,

Thank you for the code, it runs fine. But I needed to change the type of the port argument from int to str (line 66).

Hope that is clean to do that.

73's

François

Title: Re:[solved] unable to perform Configuration File Backup
Post by: DB4PLE on 29. July 2018, 08:50:46

Hi Francois,

you're right, then it is a string ;D .

Good, but the idea works and has the benefit of being compatible with the existing approach.

I will introduce the necessary changes in the code and publish a pull request soon.

73
Danilo


Diskussions- und Newsboard des DARC-Ortsverbandes I40 | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.