bitfocus / companion-module-requests

Repository for tracking module requests
102 stars 11 forks source link

Module Request: Decimator Designs UCP Control #83

Open aaronkothe opened 5 years ago

aaronkothe commented 5 years ago

Describe the feature Decimator Designs manufactures a variety of converters, splitters, and multi-viewers for video production. Their products are widely regarded as some of the most capable and reliable in the industry.

Most of Decimator's products are controlled by a single, simple (at least for the user) software program, called UCP (current version 2.0.11). Plug in one of their products via USB, 'scan' for hardware, and the options for your Decimator device are displayed.

It would be amazing if Companion could enable Streamdeck to control the UCP software!

Is this platform dependent (windows, mac, ..)? I don't believe so - the software is available for Mac & Windows.

If documentation is required to implement, do you know where to find it? Unfortunately, I know next to nothing about coding, so I don't know what might be helpful for the devs. Here's the link to the download page for UCP: http://decimator.com/DOWNLOADS/DOWNLOADS.html

Usecases The specific use case I envision is with a multi-viewer. Decimator's DMON-QUAD allows customizable presets for multi-view layouts, i.e. having three video inputs displayed one way with another input displayed a different way. The ability to live-switch between these presets using the Streamdeck would be immensely powerful, basically making a super advanced feature only available on very expensive (five figures plus) replicable with something like a basic BMD ATEM, a computer, and a Streamdeck.

This is far from the only use case, though. Decimator makes their products very configurable, so control commands could be created to do all sorts of things depending on the product.

Thank you guys for all you do!

Keksstar commented 5 years ago

Helpful would be a control protocol - but sadly there isn´t one in the decimators (except TSL for Tally Stuff - but that´s on the Companion list for ages now...). So, sadly the commands had to be reverse engineered.

hadphild commented 5 years ago

Have you tried to contact decimator about this? They might get UCP with and API if there is a demand for it.

aaronkothe commented 5 years ago

I certainly have not tried to contact Decimator. Am I the right person to do that?

JeffreyDavidsz commented 5 years ago

Well you're the one asking for the support. Keep in mind that all work on companion is done in spare time of the programmer's. If they/we need to search up all API's or contact all manufacturer's because there's a request on GitHub.... So yeah feel free to contact them and ask for the protocol. Happy to implement it for you

Keksstar commented 5 years ago

Good luck with this one.... I never got an direct answer from Decimator when asking things. Only from their distributor Symbiosis - which wasn´t helpfull. But give it a try! :-)

hadphild commented 5 years ago

Hi Phil,

Currently there is no API for our products.

Best Regards, Edward Wright DECIMATOR DESIGN Phone: +61 (0)2 4577-8725 Any opinions expressed in this

Keksstar commented 5 years ago

Uhm.... which mail address did you used to contact them?

hadphild commented 5 years ago

tech@decimator.com

aaronkothe commented 5 years ago

@JeffreyDavidsz Got it! I'm happy to contact them, I just didn't want to overstep my bounds. I definitely respect the dev team's time!

DeeJayMX commented 5 years ago

There is the UMD TSL Protocol in the Decimator DMON but it's just triggering the Tally boxes and the UMD name...

It's a RS485 connection obviously

Keksstar commented 5 years ago

THAT‘s why bitfocus/companion-module-tslproducts-umd#2 is still open. That‘s the point where it‘s needed for. But no one cares... 👎 I‘m using another Software for TSL now

DeeJayMX commented 5 years ago

But It can be a really change over if we can change PIP source of DMON device, or recall Multiview Layout.

But there is a really reverse enginering to do for the Decimator...

poor situation that there is no API from Decimator...

aaronkothe commented 5 years ago
screen shot 2019-02-07 at 10 21 35 pm
aaronkothe commented 5 years ago

So it seems that Decimator isn't going to be of much help at the moment, unfortunately. Is it possible to reverse engineer their control protocol, etc.? Is this something I could pay someone to work on? Or is it not recommended since the manufacturer doesn't seem intent on supporting it? Or shall I just give it a rest? Haha

quentinmit commented 5 years ago

I'm working on trying to reverse-engineer the protocol. Unfortunately it looks like they're using an FTDI serial converter chip... in bit-banging mode! No simple ASCII protocols here. I can understand why they don't want to publish documentation. (BTW, their GUI app is written in Delphi Pascal!)

I've actually managed to reverse engineer enough now to read the version number from my MD-HX. You have to write a magic string and then it clocks out 512 bytes of data. Bytes 0-1 are the string "GW" (maybe the config's magic?) then bytes 2-5 are the version number (0x00 0x01 0x00 0x04 in my case, for version 1.4) and then it's followed by packed binary data.

Before I go on to trying to decode the data, I want to figure out what low-level protocol they're speaking. It's almost but not quite I2C - it's some kind of 2 wire synchronous serial protocol.

DeeJayMX commented 5 years ago

Good Work ! Please continue !

aaronkothe commented 5 years ago

@quentinmit brother I have no idea what 90% of that means but I am stoked that you are working on it. Please keep at it.

JeffreyDavidsz commented 5 years ago

@quentinmit TSL protocol?

DeeJayMX commented 5 years ago

Something can be done with TSL but not everything like changing sources for example

quentinmit commented 5 years ago

@JeffreyDavidsz I only have an MD-HX so TSL is not an option for me. (Sounds like it's only available on the DMON?)

aaronkothe commented 5 years ago

I have MD-HX, MD-LX, and DMON-QUAD. Please let me know if there is a way I can help.

quentinmit commented 5 years ago

I've made some great progress reverse engineering the protocol. I can now reliably switch inputs on my MD-HX and read the current state:

bash-3.2$ python3 decimctl.py
[(b'DECIMATOR DESIGN', b'MD-HX', b'CLA42882')]
b'GW\x00\x01\x00\x06\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x03\x85\x06\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\x05\x00\x00\x00\x00\x00 \xff\x00\x01\x00\x00\xff\x01\x01\x00\x00\x05\xff\x00\x07\xff\x102\x102Tv\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfft\xe9\x87\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
struct CPA_Registers {
    magic [c_ubyte_Array_2] = [71, 87];
    version_major [c_ushort_be] = 1;
    version_minor [c_ushort_be] = 6;
    unknown06 [c_ubyte_Array_10] = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255];
    unknown10 [c_ubyte_Array_16] = [0, 3, 133, 6, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255];
    unknown20 [c_ubyte_Array_2] = [0, 255];
    DUCFormat [c_ubyte] = 5;
    unknown23 [c_ubyte_Array_8] = [0, 0, 0, 0, 0, 32, 255, 0];
    Loop_Enable [c_ubyte] = 1;
    unknown2c [c_ubyte_Array_4] = [0, 0, 255, 1];
    HO_Type [c_ubyte] = 1;
    SO_Source [c_ubyte] = 0;
    HO_Source [c_ubyte] = 0;
    unknownDUC [c_ubyte] = 0;
    DUC_Ref [DUC_Ref] = <DUC_Ref.SDI_IN: 2>;
    DUC_Source [DUC_Source] = <DUC_Source.HDMI_IN: 1>;
    unknown34 [c_ubyte] = 255;
    LCDOffTime [LCDOffTime] = <LCDOffTime.OFF_5s: 0>;
};

Let me try to package this up a bit and I can have you test it on your MD-LX and DMON-QUAD. One of the things I haven't figured out yet is how the official software distinguishes between the different models.

DeeJayMX commented 5 years ago

Damn !!!! You are the guy !

DeeJayMX commented 5 years ago

I have DMON 12S and DMON Quad if you need testing !

quentinmit commented 5 years ago

Okay, I've posted my WIP: https://github.com/quentinmit/decimctl

It only really supports the MD-* series right now. After you've installed it, you should be able to run commands like:

bash-3.2$ decimctl list
Model: b'MD-HX' Serial: b'CLA42882'
bash-3.2$ decimctl status --serial=CLA42882
struct CPA_Registers {
    magic [c_char_Array_2] = b'GW';
    version_major [c_ushort_be] = 1;
    version_minor [c_ushort_be] = 6;
<snip>
bash-3.2$ decimctl set SO_Source HDMI_IN
bash-3.2$ 

I believe this should work on Mac, Windows, and Linux. If you could test it on your MD-* devices I would appreciate it. For the DMON devices, can you run the "decimctl list" and "decimctl registers" commands and paste the output here?

I really know nothing about how to integrate this with Bitfocus Companion. I'm hoping someone else on this issue can figure out how to do that.

DeeJayMX commented 5 years ago

I can test it on windows today but how ? Do I need a python console ?

quentinmit commented 5 years ago

@DeeJayMX It requires a recent version of Python 3 (maybe 3.6+), pylibftdi, and libftdi. For the former, I think the official package is fine if you don't have it - https://www.python.org/downloads/windows/ For the latter two, see https://pylibftdi.readthedocs.io/en/0.15.0/installation.html#installation

Sorry, I don't really know much about Python on Windows.

haakonnessjoen commented 5 years ago

Quick question: Can you distinguish the Decimator device from a random FTDI device, by reading manufacturer/model from ftdi library? Or is the FTDI chip in it just a normal un-altered ftdi chip?

quentinmit commented 5 years ago

@haakonnessjoen They program a different VID/PID into it, so yes, they're distinguishable and the normal FTDI drivers won't try to claim the device. (Amusingly, they appear to use the same VID/PID for all their devices.)

quentinmit commented 5 years ago

@DeeJayMX @aaronkothe Any luck testing this? I'm specifically looking for the output of decimctl list and decimctl registers on non-MD-HX devices.

aaronkothe commented 5 years ago

@quentinmit man, you would have to walk me through step-by-step. I have no idea how I would go about testing. Also, my MD-LX is not currently in my possession. I do have my DMON-QUAD available, if that would be helpful. Happy to work on testing this weekend if you are able to help me. I'm on a Mac. I've never used Python and honestly don't know the first thing about programming.

quentinmit commented 5 years ago

@aaronkothe Okay, I put together a binary distribution that should run on macOS Mojave (and if we're lucky maybe High Sierra). It includes Python and all the libraries you need.

https://drive.google.com/file/d/1df2M54pLd0o2Yslmldh4MxG2Blfu3Ynx/view?usp=sharing

I'm not sure what your technical level is, but I'll try to walk you through it. Download the zip file and double-click on it to extract it. Open the resulting folder and navigate to bin -> decimctl inside the folder. Open Apple's Terminal.app (in /Applications/Utilities/) and drag + drop the file called decimctl onto the new terminal window.

The Terminal window should show something like ~ aaron$ /Users/aaron/Downloads/decimctl-venv/bin/decimctl. Make sure the Terminal window is focused, and press enter. You should see the help message for decimctl. Press the up arrow and the path to decimctl should again show in the prompt. Type space and list and press enter again. That should print the list of Decimator devices on your system. Then repeat again with registers instead of list. If you have an MD-* you can try repeating yet again with set SO_Source HDMI_IN.

haakonnessjoen commented 5 years ago

So, the biggest issue with this, is how hard it will be to get libftdi to compile/link on all supported OS'es in the companion build environment. I should try to do a cross compile with the current build environment for companion, to check if this is even feasible to make a module for. If it does not work, maybe we could do a two part solution though. A python based executable that gives companion access to the devices via some simple protocol.

quentinmit commented 5 years ago

@haakonnessjoen Yeah, I was afraid of that. Is there any precedent for doing the latter? It would be somewhat annoying for the user, but you could just have the module shell out to the Python code if it's installed (and leave it up to the user to install the code and its dependencies). Obviously the best would be if you could port (the useful bits of) the code I wrote to JS, but then you'd need to figure out how to link libftdi.

aaronkothe commented 5 years ago

I will be attempting to test this tonight with my MD-HX and DMON-Quad

quentinmit commented 5 years ago

@aaronkothe Any luck?

aaronkothe commented 5 years ago

Working on it right now!

aaronkothe commented 5 years ago

I updated the firmware on all devices before running this.

Here is what resulted from running "list" then "registers" then "set SO_Source HDMI_IN" then "status" when BOTH an MD-HX and DMON-QUAD were connected at the same time: https://pastebin.com/nmaJKE24

Results when ONLY DMON-QUAD was connected: https://pastebin.com/eRNEcQch

Results when ONLY MDHX was connected: https://pastebin.com/hhDrHEt6

I have two MD-HX's in my possession at the moment - would it be of any benefit to run on both devices?

Thank you!!

aaronkothe commented 5 years ago

Also, I should have an MD-LX available to test in a few days. I'll post when that's done.

quentinmit commented 5 years ago

@aaronkothe Thanks! It definitely looks like it successfully talked to your MD-HX and was able to control the SDI Out setting on it. Now that I know the DMON-QUAD is a VFA and I have the register map, I will start working on supporting it. You said the thing you're most interested in controlling is switching between pre-defined custom layouts, right?

DeeJayMX commented 5 years ago

And Sources switching please And name of the windows

aaronkothe commented 5 years ago

Awesome! I'm glad I could help. Yes, switching between pre-defined custom layouts via a Companion action would be a dream. Bonus points if you can make switching sources (i.e. change input 1 from being mapped to input 1 to being mapped to input 2) possible as an action. And yes, as @DeeJayMX mentioned, we would need the names or at least input numbers of the inputs to be part of the information Companion receives.

DeeJayMX commented 5 years ago

To set the UMD of each windows. And if possibly, changing color of border...

quentinmit commented 5 years ago

@aaronkothe Here's a new build for OS X: https://drive.google.com/open?id=1Va5QsCtMIhyzBYsb1JaDJ05UoEH7djVQ

It should now recognize the DMON-QUAD and allow you to change the layout, UMD, and border colors (maybe?). I don't have a DMON-QUAD to test it on, unfortunately. Try commands like path/to/decimctl set MVLayout 3 or path/to/decimctl set BorderColour 3 (or other numbers; it looks like custom layouts start at number 8, for instance).

I sure hope it works because it's going to be mighty hard to debug without having one of them in my hands.

aaronkothe commented 5 years ago

@quentinmit here's what I got: https://pastebin.com/aH2aZZBu

Please let me know what else I can do to help.

haakonnessjoen commented 5 years ago

@aaronkothe instead of writing /Users/aaronkothe/Downloads/decimctl-venv/bin/decimctl path/to/decimctl set MVLayout 3 you should try /Users/aaronkothe/Downloads/decimctl-venv/bin/decimctl set MVLayout 3`

aaronkothe commented 5 years ago

@haakonnessjoen thanks. I do believe I tried that. See lines 140 and 151 in the paste.

aaronkothe commented 5 years ago

@quentinmit forgive me if this is silly, but looking at the results, I do notice that at the beginning of this test, when I'm giving the list, registers, and status commands, the file path referenced is /Users/aaronkothe/Downloads/decimctl-venv-2/bin/decimctl

However, at line 137, when I start to enter the new commands, set layout, etc., the file path referenced is /Users/aaronkothe/Downloads/decimctl-venv/bin/decimctl

Could it be that I accidentally directed it back to the first build, hence why it isn't working?

quentinmit commented 5 years ago

@aaronkothe Yep, I think that's exactly what happened, you ran it with the older version that doesn't know how to control DMON devices.

aaronkothe commented 5 years ago

That's weird, I'm not sure how that happened. I used the same process as last time, pressing up arrow then space then the command. Any ideas why it would revert back to the old file path seemingly randomly?

Anyway, I will test again this afternoon and will make sure the file path is correct.