icedream / denon-prime4

Fork of @ghuntley's Denon Prime 4 firmware research repository for experimental purposes.
MIT License
14 stars 1 forks source link

Additional info / firmware research #61

Open ounsatn opened 2 months ago

ounsatn commented 2 months ago

Hello,

Discovered this git via another link, great one, i don't know if it's possible to contribute on git, so i put it there. I own myself an akai force & denon prime go.

Concerning Engine, :

it's possible to map/remap keys , led, screen etc ... with qml files assignments , every thing that pass through midi messages/interface.

If you remove ( or rename ) file/usr/Engine/Content/KnownDevices.vfsb, Engine will look for its assignment files and then you can customize assignments. Engine will look for assignment files for each of your midi interface , 2 files by interface are needed : Assignment file and device file.

Below an example :

# amidi -l
Dir Device    Name
IO  hw:0,0,0  PRIME GO Control Surface

Prime will look for :

# ls -l
total 56
-rw-r--r--    1 root     root          4463 Jul 10 22:14 PRIME_GO_Control_Surface_Assignments.qml
-rw-r--r--    1 root     root          3091 May 28 04:49 PRIME_GO_Control_Surface_Device.qml

In Assignment file , you'll put key assignments.

You can find example of usage in all the assignments files already provided by denon but also in the EngineBinary itself.

Open it with 7zip, extract .rodata and search for "ValueCCAssignments" as an example which is one of the keywork used for mapping. (maybe there is other way to extract this data of course).

You can debug some assignments by using a function setValue , as example below :

            ValueNoteAssignment {
                objectName: "FX%1 Selection".arg(2)
                note: 58
                channel: 9
                enabled: Planck.getProperty("/Engine/Mixer/Channel%1/DJFx/Selecting".arg(2)).translator.state
                    output: QtObject {
                        readonly property QObjProperty pSelectionIndex: Planck.getProperty("/Engine/Mixer/Channel%1/DJFx/PreselectIndex".arg(2))
                        function setValue(channel, value, assignmentEnabled) {
                            if(value > 0) { // turn counter clockwise, value normalized
                                pSelectionIndex.translator.unnormalized = 3
                                //console.log("idx:",pSelectionIndex.translator.unnormalized )
                                // Send to device - look at device file
                                device.sendFxColorbuttonD2(4)
                            }
                        }
                    }
                }

In Output there are differents possibilities, look for .rodata for details. In this example , i can ouput information to console by using a setValue function, and i can send information to device via device file in which i have the func :

function sendFxColorbuttonD2(Note)
{
var sysExFxOnDeck2_5 = "F0 47 7F 40 65 00 04 " + d2h(Note) + " 00 3F 00 F7"
Midi.sendSysEx(sysExFxOnDeck2_5)
}

(it's an example for my AkaiForce mapping, but it's similar on prime) 

That's for mapping. Of course it open a large field of possibilities. On my prime go i use an AKAI AMX device. Denon provide a template for P4+AMX, as i own a PGO, i'm currently doing a remap.

Concerning the running version , Engine embed in its binary all the version PrimeGO, prime2, prime4 etc... So it's possible to have other version by changing product-code of your devices.

ex :

cp "/sys/firmware/devicetree/base/inmusic,product-code" "/tmp/product-code"
# edit "/tmp/product-code" , change the product letters by another, ex JC16 to JC11 (keep endind char)
# mount with bind : 
mount -o bind "/tmp/product-code" "/sys/firmware/devicetree/base/inmusic,product-code"

and then you'll have a Prime2 when running engine. 

It's possible to run prime manually , first stop engine.service (systemctl stop engine.service) then do

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/qt/lib
export AIR_SCREEN_ROTATION=-90

# To get console output instead in a log file /media/az.... 
you can do:
/usr/Engine/engine -d0 -dcolor -dcolour, it'will launch prime and debug messages will appears in colour in the console. ( i use putty). 

there a differents env var tha you can put to suit your need ( export VARNAME=...)

found in qml files :

QT_LOGGING_RULES=air.planck.firmware.upgrade=true 
for more QT debug information put 
QT_LOGGING_RULES=air.*=true
found in QT documentation , will zoom in or zoom out the interface.
QT_SCALE_FACTOR 

Concerning embedded linux itself :

You can remount FS with write enable with

mount remount / -o rw,remount

You can activate more debug information by tuning

/sys/kernel/debug/dynamic_debug/control
ex:
echo "i2c-core-base.c +p" > /sys/kernel/debug/dynamic_debug/control
then dmesg or journalctl 

To enable SSH look at this tutorial : SSH activation

It's possible to repack firmware with ssh enabled, see link below (my wiki)

When chrooting in a firmware

# systemctl enable sshd.service
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'

I own a small wiki where i try to put my tutorials. http://dnttalo.cluster029.hosting.ovh.net/doku.php?id=start

Have fun :)