Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X and Elgato streamdeck #4

Closed
mccordgh opened this issue Apr 20, 2019 · 6 comments
Closed

OS X and Elgato streamdeck #4

mccordgh opened this issue Apr 20, 2019 · 6 comments

Comments

@mccordgh
Copy link

Hi, there! You have some great libraries for the Elgato StreamDeck on Windows.

I am wondering about Mac Support, or if you could point me in the right direction to get something going myself in C# to be able to interact with the StreamDeck (not by making a plugin). I'm trying to make a game for a game jam with the StreamDeck, and hoping to be able to bring something in to use in Unity with C#. Im on OS X.

@wischi-chr
Copy link
Member

Hi. Sure.

You could use the node implamentation (https://github.com/Lange/node-elgato-stream-deck) according to the readme it supports macOS.

If you want to write something in C# you would need a library to communicate to hid devices (with a quick google search I found Device.NET and HidSharp but I've no way of testing them.

After that you just need to send the correct payload to the library.
You can browse this library to find out what you need to send, you could for example start with this files:

Let me know if you need something.

@mccordgh
Copy link
Author

Thanks for the reply! I will try and hack on this during this week / weekend on my mac :)

@david-sharer
Copy link

Hi! I'm working on this now w/ @mccordgh.

We managed to find the device on both windows + mac using a combination of Device.Net/Usb.Net, Hid.Net, and Device.Net.LibUsb. I'll try to get the payloads working sometime in the next few days.

Would you be open to a PR that converts this to using .NET Core/Standard instead of Framework? I'm not 100% that all the current dependencies would work, though.

(I deleted and reposted this because apparently it doesn't produce notifications when you're "flagged"?)

@wischi-chr
Copy link
Member

wischi-chr commented Apr 26, 2019

yea I'm open for PRs but it should still be possible to build the core stuff with .NET 4 (so you'd probably need a shared project because .NET 4.0 does not implement any .net standard.

Update: Or maybe I drop .NET 4 support I'm not sure at the moment. I'll think about it :-)

@wischi-chr
Copy link
Member

Dropped .NET 4 support, switched to HidSharp and netstandard2. I'm not a Mac user, so I can't test it but it should work now (I guess).

@chriskooken
Copy link

chriskooken commented Sep 15, 2021

Has anyone been able to get this to work? I am running this on Xamarin.Mac and getting this error:

It looks like it is related to System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders (). I have the CoreCompat package installed to use libgdiplus on mac, but still getting this error.

System.TypeInitializationException: The type initializer for 'StreamDeckSharp.Hardware' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders () [0x00000] in <ff7780da23244c8b8f75529571e2e4bc>:0 
  at StreamDeckSharp.Internals.StreamDeckJpgHardwareBase..ctor (OpenMacroBoard.SDK.GridKeyPositionCollection keyPositions) [0x00006] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckJpgHardwareBase.cs:25 
  at StreamDeckSharp.Internals.StreamDeckRev2HardwareInfo..ctor () [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckRev2HardwareInfo.cs:10 
  at StreamDeckSharp.Hardware..cctor () [0x0000a] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Hardware.cs:38 
   --- End of inner exception stack trace ---
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetDeviceDetails (System.Int32 vendorId, System.Int32 productId) [0x00033] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:22 
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetHardwareInformation (HidSharp.HidDevice hid) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:9 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>g__MatchingHardware|0 (HidSharp.HidDevice d) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:21 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>b__1 (HidSharp.HidDevice device) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:47 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00036] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Select.cs:131 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Where.cs:696 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:63 
  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:34 
  at StreamDeckSharp.StreamDeck.OpenDevice (StreamDeckSharp.IUsbHidHardware[] hardware) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\StreamDeck.cs:37 
  at SonyPTZ.ViewController.ViewDidLoad () [0x00271] in /Users/chris/projects/SonyPTZ/SonyPTZ/ViewController.cs:60 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00002] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:109 
  at SonyPTZ.MainClass.Main (System.String[] args) [0x00007] in /Users/chris/projects/SonyPTZ/SonyPTZ/Main.cs:7 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'StreamDeckSharp.Hardware' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders () [0x00000] in <ff7780da23244c8b8f75529571e2e4bc>:0 
  at StreamDeckSharp.Internals.StreamDeckJpgHardwareBase..ctor (OpenMacroBoard.SDK.GridKeyPositionCollection keyPositions) [0x00006] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckJpgHardwareBase.cs:25 
  at StreamDeckSharp.Internals.StreamDeckRev2HardwareInfo..ctor () [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckRev2HardwareInfo.cs:10 
  at StreamDeckSharp.Hardware..cctor () [0x0000a] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Hardware.cs:38 
   --- End of inner exception stack trace ---
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetDeviceDetails (System.Int32 vendorId, System.Int32 productId) [0x00033] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:22 
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetHardwareInformation (HidSharp.HidDevice hid) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:9 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>g__MatchingHardware|0 (HidSharp.HidDevice d) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:21 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>b__1 (HidSharp.HidDevice device) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:47 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00036] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Select.cs:131 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Where.cs:696 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:63 
  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:34 
  at StreamDeckSharp.StreamDeck.OpenDevice (StreamDeckSharp.IUsbHidHardware[] hardware) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\StreamDeck.cs:37 
  at SonyPTZ.ViewController.ViewDidLoad () [0x00271] in /Users/chris/projects/SonyPTZ/SonyPTZ/ViewController.cs:60 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00002] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:109 
  at SonyPTZ.MainClass.Main (System.String[] args) [0x00007] in /Users/chris/projects/SonyPTZ/SonyPTZ/Main.cs:7 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants