OpenMacroBoard / StreamDeckSharp

A simple .NET wrapper for Stream Deck
MIT License
356 stars 47 forks source link

Images not working #30

Closed samohd closed 3 years ago

samohd commented 3 years ago

I've been trying to adapt some of this code to c++, which normally is easy enough. I think I have it correct, but I cannot get images to display on the streamdeck. I'm trying this with a v2 15 button unit. Other things (brightness/etc) I have working with it so I know I'm on the right track. As a simple test, I created a green raw buffer like this:

rgbData = gcnew array(72723); for (lp = 0; lp < rgbData->Length; ) { rgbData[lp++] = 0; rgbData[lp++] = 255; rgbData[lp++] = 0; }

and converted it to jpg with EncodeImageToJpg(). The output of that conversion sent with header via hid_write is shown in the image below. I've tried changing the page # from 0 to 1, as in some other code I've found it started counting with 1. Didn't help.

I've also tried loading (File::ReadAllBytes(File)) a JPG saved from a paint program and sending that with the header. No luck. And I understand that GIF (animated?) and maybe PNG are also supported but haven't tried those yet since JPG seems to be the main thing supported... and maybe BMP. I also saw a video on youtube showing that you could replace the default power on image... anyone know how that is done?

I didn't have much success getting this project's source to compile, is someone able to reproduce this green test and compare the generated message to mine below to see if it reveals anything? Or can I get a compiled version that works for someone else somehow to test with my unit?

Image Removed : See below follow-up post

wischi-chr commented 3 years ago

Could you provide the image you've tested it with and the hexdump as text and not as an image.

No luck. And I understand that GIF (animated?) and maybe PNG are also supported

I don't think that's true, do you have a source for that. If you mean the StreamDeck Software by elgato, they are very likely just reencoding the images on the fly.

samohd commented 3 years ago

I was able to get this to work finally on a rev2 15 button stream deck.

Some notes for anyone that stumbes upon this:

This is what an R:0 G:255 B:0 (JPG @ 100% quality) buffer sent to the upper left most key should look like.. only the one report is needed to be sent, and this includes the 8 byte header and then the file contents as is (see below), padded with zereos to fill the report size:

image

And this is what the hex view of the actual file looks like:

image

wischi-chr commented 3 years ago

Do you need any more help with that? What I meant by providing a hexdump as text was something like that:

2c e1 43 09 c0 f1 0c 23 d7 9a 1d 05 e4 3a ad 5e 
55 92 76 3b c7 8f cd 85 70 03 67 af ee ab f6 ef 
1b e3 8c 7d 84 ad bf 5d 66 e0 51 df bb 4d 6d 8b 
d6 7d 23 0e d0 d5 d1 ea fb 90 a3 e7 e3 ee 25 f1 
94 98 97 32 a5 cb d5 06 55 1d 4d a7 be 6b 80 0b 
83 cc de 23 76 83 95 24 1d b3 cb 9f 59 a7 42 95 
be d2 95 a8 41 6c e8 17 fe 89 7d 73 3c a4 eb a7 
6a f5 62 03 f7 fe 91 ab 5c ab 34 91 6e 19 7f a2 
60 ab 07 b8 10 72 79 0c 58 17 8d 4e ae c4 93 5c 
7b cc 21 8d ea b3 7f 99 cc 99 03 4e ca 22 38 57 
73 9e 29 09 83 49 d8 16 bd ff 1f 6d 9c 25 12 4d 
29 b5 53 fd 20 6a 68 e4 4e 8b ed 7d c6 62 a9 61 
9a 01 38 c4 d1 ca df 2c 85 8d 22 7a 84 7a 00 15 
29 5e 20 a7 06 32 f2 b1 f7 f1 ec eb be 36 9d 63 
d2 56 8c 85 88 3c a5 53 45 eb 51 2a b5 05 cf 54 
fa 6e 23 f2 9e db 22 0f 02 04 bc ec e5 d8 40 d8 

You posted a screenshot of a hexdump which makes it really difficult to diagnose things without typing about 1000 bytes by hand.

samohd commented 3 years ago

No further help need, as indicated, I got it all working. And I left info for others to use should they just need a simple comparison... which doesn't require text hex dump. If someone needs a text hex dump, I can generate a new one.