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

Using PC as an N.MUSIC audio source, possibly with beoported #2

Open
adrianroth10 opened this issue Jun 26, 2021 · 13 comments
Open

Using PC as an N.MUSIC audio source, possibly with beoported #2

adrianroth10 opened this issue Jun 26, 2021 · 13 comments

Comments

@adrianroth10
Copy link

Hi @toresbe,
I very much appreciate you noticing my activity! I want to change our computer running BeoPort from Windows to Linux and this is the only thing left that I need to get it to work. When I found your code I was amazed of your work with the reverse engineering. I managed to compile the program and tried running it by just plugging in usb and aux cord but of course it didn't work with the following output.

$ ./pc2d 1
[2021-06-26 13:17:01.777146] [0x00007ff3b076d4c0] [info]    Found PC2 device
[2021-06-26 13:17:01.777190] [0x00007ff3b076d4c0] [error]   Could not open PC2 device, error:-3
terminate called after throwing an instance of 'eDeviceError'
  what():  Failed to open PC2
Aborted (core dumped)

I feel that my skills in c++ and B&O are limited and I would appreciate some pointers on how to bug search with reverse engineering and stuff. One reason for that it is not working might be that this is a quite old BeoPort system with hardware from 2006ish. The windows BeoPort software working has the version 5.04.00.0031. If you have no clue on this I will still be amazed by that you got it to work for your system in the first hand, well done!

Cheers,
Adrian

@toresbe
Copy link
Owner

toresbe commented Jul 12, 2021

Hey! Sorry for my late reply. I've been on holiday, and I haven't been at my computer.

This is an access denied error. Did you run "make install" and reboot? That will install udev rules which will allow a normal user access to the device. Otherwise, please try running with sudo.

@adrianroth10
Copy link
Author

adrianroth10 commented Jul 17, 2021 via email

@adrianroth10
Copy link
Author

adrianroth10 commented Aug 9, 2021

I have now tested and the sudo tips was useful. The connection seems to work but there is some misscommunication I think. To clarify I am only interested in being able to play aux music from the computer with the N.music mode in B&O.
First I tried with turning on the speakers with N.Music button on the remote and:

$ sudo ./pc2d 1
[2021-08-07 20:14:04.563167] [0x00007fe1ea9474c0] [info]    Found PC2 device
[2021-08-07 20:14:04.563228] [0x00007fe1ea9474c0] [info]    Opened PC2 device
[2021-08-07 20:14:04.563309] [0x00007fe1e993e700] [info]    PC2Device event thread running...
[2021-08-07 20:14:04.563325] [0x00007fe1e993e700] [debug]   Read waiting for semaphore...
[2021-08-07 20:14:04.563342] [0x00007fe1ea9474c0] [debug]   Sent: 60 01 F1 61
[2021-08-07 20:14:04.569258] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.569309] [0x00007fe1ea9474c0] [debug]   Sent: 60 03 80 01 00 61
[2021-08-07 20:14:04.569345] [0x00007fe1ea9474c0] [info]    Setting local output
[2021-08-07 20:14:04.569369] [0x00007fe1ea13f700] [debug]   Read callback invoked
[2021-08-07 20:14:04.569455] [0x00007fe1e993e700] [debug]    Got: FF FF 01 FF FF
[2021-08-07 20:14:04.569475] [0x00007fe1e993e700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:14:04.569492] [0x00007fe1e993e700] [debug]   Read waiting for semaphore...
[2021-08-07 20:14:04.577265] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.577366] [0x00007fe1ea9474c0] [debug]   Sent: 60 02 E7 00 61
[2021-08-07 20:14:04.585296] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.585372] [0x00007fe1ea13f700] [debug]   Read callback invoked
[2021-08-07 20:14:04.585425] [0x00007fe1ea9474c0] [debug]   Sent: 60 05 E5 01 00 00 00 61
[2021-08-07 20:14:04.585559] [0x00007fe1e993e700] [debug]    Got: 60 04 41 01 01 29 61
[2021-08-07 20:14:04.585585] [0x00007fe1e993e700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:14:04.585608] [0x00007fe1e993e700] [debug]   Read waiting for semaphore...
[2021-08-07 20:14:04.593239] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.593288] [0x00007fe1ea13f700] [debug]   Read callback invoked
[2021-08-07 20:14:04.593317] [0x00007fe1ea9474c0] [debug]   Sent: 60 02 EA FF 61
[2021-08-07 20:14:04.593390] [0x00007fe1e993e700] [debug]    Got: 60 05 49 01 30 01 03 61
[2021-08-07 20:14:04.593443] [0x00007fe1e993e700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:14:04.593457] [0x00007fe1e993e700] [debug]   Read waiting for semaphore...
[2021-08-07 20:14:04.601248] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.601325] [0x00007fe1ea9474c0] [debug]   Sent: 60 02 EA 81 61
[2021-08-07 20:14:04.609247] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.609322] [0x00007fe1ea9474c0] [debug]   Sent: 60 05 E3 28 00 00 00 61
[2021-08-07 20:14:04.617300] [0x00007fe1ea13f700] [debug]   Write callback invoked
[2021-08-07 20:14:04.617399] [0x00007fe1ea9474c0] [debug]   Sent: 60 01 A7 61

I might have misunderstood what this command does but it did not enable the aux input.

Then I tried to have the ./pc2d m command running at the time of turning on the N.Music mode with the following output:

$ sudo ./pc2d m
[2021-08-07 20:22:35.147497] [0x00007f88ede244c0] [info]    Found PC2 device
[2021-08-07 20:22:35.147665] [0x00007f88ede244c0] [info]    Opened PC2 device
[2021-08-07 20:22:35.147917] [0x00007f88ece1b700] [info]    PC2Device event thread running...
[2021-08-07 20:22:35.147944] [0x00007f88ece1b700] [debug]   Read waiting for semaphore...
[2021-08-07 20:22:35.147968] [0x00007f88ede244c0] [debug]   Sent: 60 01 F1 61
[2021-08-07 20:22:35.152711] [0x00007f88ed61c700] [debug]   Write callback invoked
[2021-08-07 20:22:35.152757] [0x00007f88ede244c0] [debug]   Sent: 60 03 80 01 00 61
[2021-08-07 20:22:35.152779] [0x00007f88ede244c0] [info]    Waiting on semaphore..
[2021-08-07 20:22:35.160720] [0x00007f88ed61c700] [debug]   Write callback invoked
[2021-08-07 20:22:35.168716] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:35.168961] [0x00007f88ece1b700] [debug]    Got: 60 04 41 01 01 29 61
[2021-08-07 20:22:35.169007] [0x00007f88ece1b700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:22:35.169055] [0x00007f88ece1b700] [debug]   Read waiting for semaphore...
[2021-08-07 20:22:35.169085] [0x00007f88ede244c0] [info]    Waiting on semaphore..
[2021-08-07 20:22:35.176694] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:35.176842] [0x00007f88ece1b700] [debug]    Got: 60 05 49 01 30 01 03 61
[2021-08-07 20:22:35.176877] [0x00007f88ece1b700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:22:35.176911] [0x00007f88ece1b700] [debug]   Read waiting for semaphore...
[2021-08-07 20:22:35.176928] [0x00007f88ede244c0] [info]    Waiting on semaphore..
[2021-08-07 20:22:51.534551] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:51.534720] [0x00007f88ece1b700] [debug]    Got: 60 15 00 C2 C1 01 0B
[2021-08-07 20:22:51.534758] [0x00007f88ece1b700] [info]    Got telegram; signalling semaphore
[2021-08-07 20:22:51.534794] [0x00007f88ece1b700] [debug]   Read waiting for semaphore...
 60 15 00 C2 C1 01 0B.
                              Masterlink telegram                              
    src   |   dest   |  tgram type |    payload type    | pld size |  pld ver  
 A_MASTER |   PC_1   |             |                    |   0 bytes|     0     
                           Unknown telegram, payload                           

[2021-08-07 20:22:51.535113] [0x00007f88ede244c0] [warning] So far I can only handle request telegrams
[2021-08-07 20:22:51.535150] [0x00007f88ede244c0] [info]    Waiting on semaphore..
[2021-08-07 20:22:51.542393] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:51.550483] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:51.550547] [0x00007f88ed61c700] [debug]   Continuation mode...
[2021-08-07 20:22:51.558403] [0x00007f88ed61c700] [debug]   Read callback invoked
[2021-08-07 20:22:51.558427] [0x00007f88ed61c700] [debug]   Continuation mode...

The time 2021-08-07 20:22:35 is before turning on the speakers and the 2021-08-07 20:22:51 is after. Here some message seems to be not supported from the beoport device but I am not sure if that is the problem.

Have you seen this before or have some suggestion of what I can try?

@toresbe
Copy link
Owner

toresbe commented Aug 11, 2021

So if I'm understanding you correctly, what you're after is to be able to use the PC as an N.MUSIC audio source, connected to a B&O system?

@adrianroth10
Copy link
Author

Yes that sounds correct. And we currently have that setup with the B&O BeoPort software in Windows 7.

@adrianroth10 adrianroth10 changed the title Error code -3 when attempt to open PC2 device Using PC as an N.MUSIC audio source, possibly with beoported Aug 11, 2021
@adrianroth10
Copy link
Author

Your formulation was so good that I changed the title of the issue

@toresbe
Copy link
Owner

toresbe commented Aug 15, 2021

Heh, I see! Okay, well. This changes requirements a little bit.

So as of now, there is no functionality for this use case in the code. But it's not impossible, and I'm open to developing this with you further. Unless you were willing to help me by doing annotated captures of USB traffic - I could walk you through that, it's basically monitoring what traffic happens on the USB bus while running the legacy B&O software, and annotating the traffic with describing what you're doing - I would need to find an audio master which allows N. MUSIC - I think grandma's using the one I have that supports it.

@adrianroth10
Copy link
Author

No problem, I will definitely do that capturing. I have started to look at usb sniffers but found different ones. It seems that USBlyzer is recommended by some. Is that the right direction? Which tool do you think I should use?

@toresbe
Copy link
Owner

toresbe commented Aug 17, 2021

Great!

https://desowin.org/usbpcap/ Here is the tool that I have used for all my captures. I then send that right into Wireshark.

Wireshark lets you attach comments to captured packets and save that in the file. You will either want to run it remotely, or figure out how to filter in Wireshark so that you avoid being flooded by packets captured by eg mouse and keyboard :)

@adrianroth10
Copy link
Author

Great I will look into it and hopefully be able to filter correctly. Will get to it hopefully at the end of next week.

@adrianroth10
Copy link
Author

Here are two captures. First is one when starting N.music and the second one is for turning it off. Do they look ok? Are you planning on incorporating this in this software or something else? If I can help in any way I am available!
nmusic_caps.zip

@toresbe
Copy link
Owner

toresbe commented Aug 26, 2021

Excellent! I will look at this file asap

@adrianroth10
Copy link
Author

Have you managed to get any progress on this @toresbe. Are the capture files making any sense?

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

2 participants