Firmware upgrade with Linux?

User avatar
slinky
Posts: 20
Joined: Wed Sep 12, 2012 11:32 am

Re: Firmware upgrade with Linux?

Postby slinky » Sun Dec 09, 2012 10:59 pm

demcanulty wrote:Hi Slinky, it's probably important, if the bytes get offset in the globals then you might get some periodically weird behavior, but I'll have to look more closely at it. My python is a little rusty, but I should be able to figure it out. Pretty awesome work, thanks for putting the time into this!


Hi Dan, one thing I noticed that in the output generated by qJsonToSyx.js, I can't see those 0x0d. But if I hex dump the resulting file, they're there. The location seems to vary, but they're often accompanied by 0x0a bytes. Also, the last byte offset written is 1112 (decimal), according to the output. But the dump is 1122 (decimal) long. I'll also try to figure this one out. My JavaScript is a bit rusty, maybe we'll meet in the middle :)
jrussell
Posts: 70
Joined: Tue Nov 27, 2012 9:16 pm

Re: Firmware upgrade with Linux?

Postby jrussell » Mon Dec 10, 2012 1:19 am

Here is a funny thing - I thought I was seeing some extra 0x0D before 0x0A myself - so I reextracted the js from the package and reran, and all seemed to go as I expected. There is nowhere in the code to insert those extra 0x0Ds, it drove me crazy for a couple of hours trying to figure it..

So it looks like at least 2 projects for QuNeo preset loader/editor. Mine is in C++, mostly just because I needed an excuse to code C++ again.. which slows me down significantly, I have coded mostly Java for the last decade, but in the end it is what I want to build this tool in.

I am about a day away from being at the same level of functionality as slinky's tool - actually have all the pieces, just too tired right now to wire them together.

Not ready to share the code yet - as I said, my C++ is very rusty, and there is a TON of cleanup to do. If there are any devs interested in early preview, hit me up and we can discuss. In any case, it will be made available as soon as it is worth sharing.
User avatar
slinky
Posts: 20
Joined: Wed Sep 12, 2012 11:32 am

Re: Firmware upgrade with Linux?

Postby slinky » Mon Dec 10, 2012 1:31 pm

slinky wrote:Hi Dan, one thing I noticed that in the output generated by qJsonToSyx.js, I can't see those 0x0d. But if I hex dump the resulting file, they're there.


Replying to myself, in the qJsonToSyx.js, the out stream is opened in "w" mode:

Code: Select all

var out = new Stream("presetSysex.syx", 'w')


This means "open in text mode, for writing". In text mode, a translation for linefeeds is done. Therefore, each 0x0a (LF) will be preceded by 0x0d (CR) since the line separator used will be CRLF i.e. 0x0d0a. If the file is opened 'wb', i.e. binary mode, this problem should disappear.
jrussell
Posts: 70
Joined: Tue Nov 27, 2012 9:16 pm

Re: Firmware upgrade with Linux?

Postby jrussell » Mon Dec 10, 2012 3:34 pm

slinky wrote:Replying to myself, in the qJsonToSyx.js, the out stream is opened in "w" mode:

Code: Select all

var out = new Stream("presetSysex.syx", 'w')


This means "open in text mode, for writing". In text mode, a translation for linefeeds is done. Therefore, each 0x0a (LF) will be preceded by 0x0d (CR) since the line separator used will be CRLF i.e. 0x0d0a. If the file is opened 'wb', i.e. binary mode, this problem should disappear.


That makes a ton of sense.. but somehow it went away for me. I KNOW my code is not generating the extra 0d's and currently the js and my code generate the same output..

I will try a few experiments tonight when I get home to see if I can figure out how this occurred then dissapeared on my machine. Seems that if they are getting there, the output from the js app would be invalid - messages encoded as absolute positions are not very tolerant of extra unexpected bytes :)
demcanulty
Posts: 97
Joined: Thu Jun 16, 2011 11:24 am

Re: Firmware upgrade with Linux?

Postby demcanulty » Mon Dec 10, 2012 8:00 pm

I didn't have time to get to this today, but hopefully tonight or tomorrow. The printout to the screen in the js file might not match up to the file, but your file outputs should ideally match up. If you can open up the output from the two programs in a hex viewer and compare the hex successfully, then you've coded it up right.

On a different note, I posted some sysex commands for changing preset number remotely in a separate thread, I thought you all might be interested too:
http://forum.keithmcmillen.com/viewtopic.php?f=50&t=837&sid=780ca7792b8f0e013df074dfba08053a#p3548
User avatar
slinky
Posts: 20
Joined: Wed Sep 12, 2012 11:32 am

Re: Firmware upgrade with Linux?

Postby slinky » Tue Dec 11, 2012 12:57 pm

jrussell wrote:That makes a ton of sense.. but somehow it went away for me. I KNOW my code is not generating the extra 0d's and currently the js and my code generate the same output..


Hi Jrussell, could you try to use the value 10 (decimal, 0xa hex) somewhere and see if that gets paired with the 0xd?

It might also be dependent on running under Windows vs. Linux systems, since the line endings are different.
jrussell
Posts: 70
Joined: Tue Nov 27, 2012 9:16 pm

Re: Firmware upgrade with Linux?

Postby jrussell » Tue Dec 11, 2012 11:16 pm

Lots of 0x0a's in my generated sysex. no pairings. but I absolutely did see it in a file I had.. not sure how that happened, I ONLY run linux..

Stranger is I cannot now reproduce it.. and cant find the "bad" file.
demcanulty
Posts: 97
Joined: Thu Jun 16, 2011 11:24 am

Re: Firmware upgrade with Linux?

Postby demcanulty » Fri Dec 14, 2012 12:00 pm

Got started looking at it, but realized I may have to test on an actual Linux box rather than on my mac. This is for python2 right? I think that's part of why I put python down a while back, the whole transition from 2 to 3 is so loopy. I figured everything would be in 3 by now. Is it better writing in 2 for general Linux user compatibility? All those great libraries are so cool though.
User avatar
slinky
Posts: 20
Joined: Wed Sep 12, 2012 11:32 am

Re: Firmware upgrade with Linux?

Postby slinky » Sat Dec 15, 2012 4:40 am

demcanulty wrote:Got started looking at it, but realized I may have to test on an actual Linux box rather than on my mac. This is for python2 right? I think that's part of why I put python down a while back, the whole transition from 2 to 3 is so loopy. I figured everything would be in 3 by now. Is it better writing in 2 for general Linux user compatibility? All those great libraries are so cool though.


Yeah, Python 2.7 should work fine. If you just want to write .syx files that should work on a Mac too, not sure if writing directly to the MIDI device will - I don't know how Mac exposes those devices.

Most "normal" people have Python 2 instead of Python 3, due to what distributions package and provide. If you can use Python 3, go for it! It's still a bit transitioning, and some libraries might not yet work for Python 3.

PS. For even more Python future check pypy.org, I think that's super cool.
jrussell
Posts: 70
Joined: Tue Nov 27, 2012 9:16 pm

Re: Firmware upgrade with Linux?

Postby jrussell » Thu Dec 20, 2012 5:59 am

First pass at the command line version of my updater is now working. It will be made available here
https://bitbucket.org/jrussellsmyth/qntools
My goal is multi-platform and multi architecture, but currently I only can guarantee it works on 64 bit linux.

Attached is a 64bit linux binary if anyone is interested in trying it. Use is pretty straight forward

./qn_update --input /path/to/QuNeo.json --presets 0:5 --change-preset 5
--input - JSON file to read. Can e a QuNeo.json style preset set or a .quneopreset style single preset
--presets - if input is a QuNeo.json style set, presets provides a range (can be one #) of presets to update on QuNeo. if input file is a single preset in .quneopreset format, the --presets value must be singular and tells qn_update where to put the preset.
--change-preset (currently required) which preset to switch to after programming. required even if you do not wish to change preset after update.

There are other options, see --help for probably innaccurate documentation, in particular --output does not currently work and --send is not necessary..

I have not selected a license yet, so though I intend to make this fully OSS in the near future, current offering is for personal test use only, does not allow redistribution, and makes no warranty whatsoever.
Attachments
qn_update.zip
(96.47 KiB) Downloaded 208 times

Return to “QuNeo General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest

cron