mrene / minidsp-rs

MiniDSP Controller
http://minidsp-rs.pages.dev
Apache License 2.0
98 stars 15 forks source link

PWR-ICE125 / PWR-ICE250 device support? #245

Open SamHawkens opened 2 years ago

SamHawkens commented 2 years ago

Do you expect the PWR-ICE plate amplifiers to be supported?

https://www.minidsp.com/products/plate-amplifiers/pwr-ice125 https://www.minidsp.com/products/plate-amplifiers/pwr-ice250

They have a LAN control interface, no USB. The datasheet states ADAU1445 SigmaDSP is used internally.

mrene commented 2 years ago

At first glance the plugins look prety similar to some other product so it looks possible to add it.

I don't see a field to connect to a specific IP directly, so I'd need a packet capture to see the kind of advertisements the device is sending out in order to be able to simulate it.

SamHawkens commented 2 years ago

Sounds good. I have not bought the plate amps yet since I am also considering hypex fusion amps. But there does not seem to be any linux support at all. About the PWR-ICE I would guess they use zeroconf for detection. Or maybe they even use UDP for everything. At least they must have added some (most likely simple) uC to the ADAU1445. It comes a bit as a surprise that the plate amps do not have USB.

mrene commented 2 years ago

Most of their devices use some rudimentary USB HID over TCP (on port 5333). The advertisement packets didn't look like anything to me (it's not mdns, and there's some kind of checksum I haven't figured out yet since I don't have a TCP only device)

m-diers commented 2 years ago

I am currently also looking for a simple variant to volume control via lan for the PWR-ICE.My goal is to extend the alsa output in LibreELEC with it. There is an android app for the minidsp. https://m.apkpure.com/de/minidsp-controller/com.dsp4you.minidsp What I saw at first sight is that written in js with angular and cordova. Just unzip the apk then there are the sources. I have already noticed the following: The pwr-ice also regularly gives a sign of life

Frame 2356: 116 bytes on wire (928 bits), 116 bytes captured (928 bits) on interface any, id 0
    Interface id: 0 (any)
        Interface name: any
    Encapsulation type: Linux cooked-mode capture v1 (25)
    Arrival Time: Jan 23, 2022 12:15:58.777236657 CET
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1642936558.777236657 seconds
    [Time delta from previous captured frame: 0.280376643 seconds]
    [Time delta from previous displayed frame: 5.654376924 seconds]
    [Time since reference or first frame: 334.732787291 seconds]
    Frame Number: 2356
    Frame Length: 116 bytes (928 bits)
    Capture Length: 116 bytes (928 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: sll:ethertype:ip:udp:data]
    [Coloring Rule Name: UDP]
    [Coloring Rule String: udp]
Linux cooked capture v1
    Packet type: Broadcast (1)
    Link-layer address type: Ethernet (1)
    Link-layer address length: 6
    Source: DSP4YOU_07:26 (00:50:c2:d4:37:26)
    Unused: 0000
    Protocol: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.178.120, Dst: 255.255.255.255
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x23d1 (9169)
    Flags: 0x00
        0... .... = Reserved bit: Not set
        .0.. .... = Don't fragment: Not set
        ..0. .... = More fragments: Not set
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 100
    Protocol: UDP (17)
    Header Checksum: 0xbf97 [validation disabled]
    [Header checksum status: Unverified]
    Source Address: 192.168.178.120
    Destination Address: 255.255.255.255
User Datagram Protocol, Src Port: 3999, Dst Port: 3999
    Source Port: 3999
    Destination Port: 3999
    Length: 80
    Checksum: 0xe529 [unverified]
    [Checksum Status: Unverified]
    [Stream index: 0]
    [Timestamps]
        [Time since first frame: 333.620134327 seconds]
        [Time since previous frame: 5.654376924 seconds]
    UDP payload (72 bytes)
Data (72 bytes)
    Data: 801205a000000050c2d437260000c0a8b2780003003300b60000000000005b0000000010…
    [Length: 72]
0000   00 01 00 01 00 06 00 50 c2 d4 37 26 00 00 08 00   .......P..7&....
0010   45 00 00 64 23 d1 00 00 64 11 bf 97 c0 a8 b2 78   E..d#...d......x
0020   ff ff ff ff 0f 9f 0f 9f 00 50 e5 29 80 12 05 a0   .........P.)....
0030   00 00 00 50 c2 d4 37 26 00 00 c0 a8 b2 78 00 03   ...P..7&.....x..
0040   00 33 00 b6 00 00 00 00 00 00 5b 00 00 00 00 10   .3........[.....
0050   50 57 52 2d 49 43 45 32 20 20 20 20 20 20 20 00   PWR-ICE2       .
0060   b8 05 d0 f4 4d c2 fa af 77 7c dc 0f 96 f4 b4 a5   ....M...w|......
0070   32 34 e4 87                                       24..

Until now I could always skip js ;-) Maybe we can work on it together.

SamHawkens commented 2 years ago

Cool! I am surprised the sources are not obfuscated in the apk - nice :-) I like the Idea of linking the pwr-ice up with alsa. I must admit I have never written anything in rust, but sooner or later I'll have to get started with it anyway. js is not my world either, but well - there are so many languages around you get in touch with all of them.

For the moment I have got the hypex fusion amp FA123 modules which seem much more popular and have better availablity at least around Europe. The only way to configure these from a linux machine is to use a windows vm with usb passthru in virtualbox. Not my preferred solution. So anything that natively works on linux would be a reason to get the pwr-ice instead. And the pwr-ice also provides much more dsp programming options.

mrene commented 2 years ago

@m-diers these are broadcast packets sent by the devices so you can discover their ip. minidsp probe --net will listen and list them. The code to decode them are in transport/net/discovery. This one expands to: DiscoveryPacket { mac_address: [0, 80, 194, 212, 55, 38], ip_address: 192.168.178.120, hwid: 0, typ: 51, sn: 182, hostname: "PWR-ICE2 \u{0}" }

The official mobile app only does a few basic commands, which are already supported by mindsp-rs - you should be able to use these same commands already, even if the PWR-ICE isn't directly supported.

ex: minidsp --tcp 192.168.178.120 should give you the current master level, and minidsp --tcp 192.168.178.120 probe should tell you what device it's detecting (which would be a special Generic device for partially supported devices like this one).

minidspd will also automatically discover and expose devices that broadcast themselves on the network, this would give you an http api to control things (which will work for source selection, master volume, etc, but not for changing equalizers until the device support is added to the code)

m-diers commented 2 years ago

@mrene This sounds great, I had tested it only once with status, and got no response.

./minidsp --verbose probe --net
Probing for network devices...
Found: tcp://192.168.178.120:5333?name=PWR-ICE2%20%20%20%20%20%20%20%00
./minidsp --verbose --tcp 192.168.178.120
Sent: [31]
Sent: ReadHardwareId
Recv: [31, 03, 00]
Recv: HardwareId { payload: [03, 00] }
Sent: [05, ff, a1, 01]
Sent: ReadMemory { addr: ffa1, size: 01 } 
Error: No devices found
./minidsp --verbose --tcp 192.168.178.120 probe
Sent: [31]
Sent: ReadHardwareId 
Recv: [31, 03, 00]
Recv: HardwareId { payload: [03, 00] }
Sent: [05, ff, a1, 01]
Sent: ReadMemory { addr: ffa1, size: 01 }

Unfortunately it doesn't work yet. I'll check it out now and compile it myself.

mrene commented 2 years ago

I'm guessing it's timing out after that last ReadMemory ?

Any chance you could packet capture the plugin connecting to the device? (it'll be on tcp port 5333)

m-diers commented 2 years ago

Yes it's a timeout. I have wireshark running here. Which format is desired? FYI: The special executable to configure the PWR-ICE has the name PWR_ICE2_2x2.exe

mrene commented 2 years ago

pcap (or pcapng) would be ideal

mrene commented 2 years ago

Just to clarify, a pcap of the plug-in is what I'm looking for (since minidsp-rs apparently doesn't do the right thing)

m-diers commented 2 years ago

Here some captures: ./target/release/minidsp --verbose --tcp 192.168.178.120 https://gist.github.com/m-diers/0b06f05ab6d71a3706be2158c39d63c6#file-capture-001-pcapng ./target/release/minidsp --verbose --tcp 192.168.178.120 probe https://gist.github.com/m-diers/0b06f05ab6d71a3706be2158c39d63c6#file-capture-002-pcapng Connect of PWR_ICE2_2x2.exe https://gist.github.com/m-diers/0b06f05ab6d71a3706be2158c39d63c6#file-capture-003-pcapng

mrene commented 2 years ago

Thanks!

It appears that the framing is a bit different as the device sends fixed-sized 70 bytes frames instead of fixed-size 64 bytes frames, which confuses the code handling the transport - there's probably a quick fix for this I'll take a look at it.

mrene commented 2 years ago

@m-diers are you able to try #313 and let me know if it can connect to your device?

m-diers commented 2 years ago

Thanks! the connect works. Now there are probably still problems when reading the appropriate register for the I/O levels. Master Mute is ok:

MasterStatus { preset: 0, source: NotInstalled, volume: Gain(-0.0), mute: false, dirac: false }
#toggled with app
MasterStatus { preset: 0, source: NotInstalled, volume: Gain(-0.0), mute: true, dirac: false }

Master Volume I can not test because it does not work via the app. Maybe it is not supported at all. I have found more information in the logs of the app:

# connect part
2022-01-24T10:33:38.686Z DEBUG Primary IP is 192.168.178.120
2022-01-24T10:33:41.232Z DEBUG No focus oldvalue: 0TO newvalue: 0
2022-01-24T10:33:41.499Z DEBUG ondata153,0,0,0,0,0,0,0
2022-01-24T10:33:41.502Z DEBUG on connect triggered
2022-01-24T10:33:41.503Z DEBUG factory on conect call read flash
2022-01-24T10:33:41.503Z DEBUG TCP write cmd5,5,255,163,48,220
2022-01-24T10:33:41.526Z DEBUG ondata52,5,255,163,14,193,129,1
2022-01-24T10:33:41.560Z DEBUG TCP write cmd2,49,51,0,0,0
2022-01-24T10:33:41.581Z DEBUG ionic view leave
2022-01-24T10:33:41.581Z DEBUG controller call stop mon service
2022-01-24T10:33:41.584Z DEBUG clear devices
2022-01-24T10:33:41.589Z DEBUG ondata4,49,3,0,255,255,255,255
2022-01-24T10:33:41.589Z DEBUG TCP write cmd5,5,255,161,1,171
2022-01-24T10:33:41.627Z DEBUG ondata5,5,255,161,51,255,255,255
2022-01-24T10:33:41.628Z DEBUG TCP write cmd5,5,255,208,48,9
2022-01-24T10:33:41.690Z DEBUG ondata52,5,255,208,0,2,95,147
2022-01-24T10:33:41.706Z DEBUG preset func called
2022-01-24T10:33:41.706Z DEBUG preset current value is 0
2022-01-24T10:33:41.719Z DEBUG factory on read flash done: switch HWCmd Function and called onDSP evt
2022-01-24T10:33:41.720Z DEBUG preset func called
2022-01-24T10:33:41.720Z DEBUG preset current value is 0

# mute on part
2022-01-24T10:33:54.254Z DEBUG TCP write cmd3,23,1,27,0,0
2022-01-24T10:33:54.305Z DEBUG ondata1,255,255,255,255,255,255,255

# mute off part
2022-01-24T10:34:37.052Z DEBUG TCP write cmd3,23,0,26,0,0
2022-01-24T10:34:37.092Z DEBUG ondata1,255,255,255,255,255,255,255

# select preset 1 part
2022-01-24T10:37:23.584Z DEBUG TCP write cmd4,37,0,1,42,0
2022-01-24T10:37:24.391Z DEBUG ondata2,171,255,255,255,255,255,255
2022-01-24T10:37:24.396Z DEBUG TCP write cmd5,5,255,224,1,234
2022-01-24T10:37:24.416Z DEBUG ondata5,5,255,224,1,255,255,255

# select preset 2 part
2022-01-24T10:36:42.680Z DEBUG TCP write cmd4,37,1,1,43,0
2022-01-24T10:36:43.466Z DEBUG ondata2,171,255,255,255,255,255,255
2022-01-24T10:36:43.470Z DEBUG TCP write cmd5,5,255,224,1,234
2022-01-24T10:36:43.488Z DEBUG ondata5,5,255,224,1,255,255,255

#select preset 3 part
2022-01-24T11:15:17.585Z DEBUG TCP write cmd4,37,2,1,44,0
2022-01-24T11:15:18.387Z DEBUG ondata2,171,255,255,255,255,255,255
2022-01-24T11:15:18.391Z DEBUG TCP write cmd5,5,255,224,1,234
2022-01-24T11:15:18.415Z DEBUG ondata5,5,255,224,1,255,255,255

# select preset 4 part
2022-01-24T11:13:42.005Z DEBUG TCP write cmd4,37,3,1,45,0
2022-01-24T11:13:42.798Z DEBUG ondata2,171,255,255,255,255,255,255
2022-01-24T11:13:42.799Z DEBUG TCP write cmd5,5,255,224,1,234
2022-01-24T11:13:42.818Z DEBUG ondata5,5,255,224,1,255,255,255

# not working part of slide volume max to min
2022-01-24T11:16:03.239Z DEBUG mouse down
2022-01-24T11:16:03.458Z DEBUG -2sent
2022-01-24T11:16:03.460Z DEBUG TCP write cmd3,66,4,73,0,0
2022-01-24T11:16:03.485Z DEBUG -13sent
2022-01-24T11:16:03.496Z DEBUG -16.5sent
2022-01-24T11:16:03.521Z DEBUG -24sent
2022-01-24T11:16:03.535Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.541Z DEBUG -31sent
2022-01-24T11:16:03.541Z DEBUG TCP write cmd3,66,62,131,0,0
2022-01-24T11:16:03.555Z DEBUG -36sent
2022-01-24T11:16:03.566Z DEBUG -42sent
2022-01-24T11:16:03.574Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.578Z DEBUG -48sent
2022-01-24T11:16:03.579Z DEBUG TCP write cmd3,66,96,165,0,0
2022-01-24T11:16:03.593Z DEBUG -52sent
2022-01-24T11:16:03.600Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.610Z DEBUG -57.5sent
2022-01-24T11:16:03.617Z DEBUG TCP write cmd3,66,115,184,0,0
2022-01-24T11:16:03.631Z DEBUG -63.5sent
2022-01-24T11:16:03.637Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.644Z DEBUG -68sent
2022-01-24T11:16:03.645Z DEBUG TCP write cmd3,66,136,205,0,0
2022-01-24T11:16:03.659Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.662Z DEBUG -73sent
2022-01-24T11:16:03.663Z DEBUG TCP write cmd3,66,146,215,0,0
2022-01-24T11:16:03.676Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.679Z DEBUG -78sent
2022-01-24T11:16:03.679Z DEBUG TCP write cmd3,66,156,225,0,0
2022-01-24T11:16:03.696Z DEBUG -82.5sent
2022-01-24T11:16:03.702Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.714Z DEBUG -88sent
2022-01-24T11:16:03.714Z DEBUG TCP write cmd3,66,176,245,0,0
2022-01-24T11:16:03.729Z DEBUG -93sent
2022-01-24T11:16:03.735Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.745Z DEBUG -96.5sent
2022-01-24T11:16:03.746Z DEBUG TCP write cmd3,66,193,6,0,0
2022-01-24T11:16:03.760Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.763Z DEBUG -101sent
2022-01-24T11:16:03.764Z DEBUG TCP write cmd3,66,202,15,0,0
2022-01-24T11:16:03.777Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.780Z DEBUG -104sent
2022-01-24T11:16:03.780Z DEBUG TCP write cmd3,66,208,21,0,0
2022-01-24T11:16:03.795Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.797Z DEBUG -108.5sent
2022-01-24T11:16:03.798Z DEBUG TCP write cmd3,66,217,30,0,0
2022-01-24T11:16:03.814Z DEBUG -111.5sent
2022-01-24T11:16:03.821Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.830Z DEBUG -115sent
2022-01-24T11:16:03.830Z DEBUG TCP write cmd3,66,230,43,0,0
2022-01-24T11:16:03.847Z DEBUG -118sent
2022-01-24T11:16:03.862Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.865Z DEBUG -121sent
2022-01-24T11:16:03.865Z DEBUG TCP write cmd3,66,242,55,0,0
2022-01-24T11:16:03.881Z DEBUG -123.5sent
2022-01-24T11:16:03.886Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:03.898Z DEBUG -126.5sent
2022-01-24T11:16:03.899Z DEBUG TCP write cmd3,66,253,66,0,0
2022-01-24T11:16:03.915Z DEBUG -127.5sent
2022-01-24T11:16:03.922Z DEBUG ondata0,66,255,255,255,255,255,255
2022-01-24T11:16:04.135Z DEBUG mouse up
2022-01-24T11:16:04.137Z DEBUG TCP write cmd3,66,255,68,0,0
2022-01-24T11:16:04.153Z DEBUG ondata0,66,255,255,255,255,255,255