jcrummy / gosqueeze

go package for configuring Logitech SqueezeBox receivers
MIT License
3 stars 1 forks source link

panic: runtime error: index out of range [1] with length 1 #17

Open Moonbase59 opened 3 months ago

Moonbase59 commented 3 months ago

Hi, and thanks for this.

I’m trying to set up my Duet Receiver using sbconfig-linux-amd64 on Linux Mint 21.3.

When trying to select a network interface, I always get this error:

$ sbconfig-linux-amd64 
The following network interfaces were found:
[00] lo - 
[01] eno1 - xx:xx:xx:xx:xx:xx
[02] wwx028037ec0200 - xx:xx:xx:xx:xx:xx
[03] wlp3s0 - xx:xx:xx:xx:xx:xx
[04] docker0 - xx:xx:xx:xx:xx:xx
Select interface to use [0]: 1
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
encoding/binary.bigEndian.Uint16(...)
    /usr/local/go/src/encoding/binary/binary.go:143
github.com/jcrummy/gosqueeze.(*Sb).populateFields(...)
    /home/john/github/gosqueeze/device.go:207
github.com/jcrummy/gosqueeze.Discover.func1(0xc000182050?, 0xc00009ac00?, {0xc00009ac00?, 0x65a820?, 0xc000184720?})
    /home/john/github/gosqueeze/discover.go:46 +0x5c5
github.com/jcrummy/gosqueeze/internal/broadcast.BroadcastReceive(0xc0001f0a40, 0x1?, {0xc0001ca080, 0x1b, 0x20}, 0xb2d05e00, 0xc0001b5dd0)
    /home/john/github/gosqueeze/internal/broadcast/broadcast.go:71 +0x343
github.com/jcrummy/gosqueeze.Discover(0xc0001f0a40)
    /home/john/github/gosqueeze/discover.go:34 +0x13e
main.discover(0xc0001f0a40)
    /home/john/github/gosqueeze/cmd/sbconfig/discover.go:14 +0x27
main.main()
    /home/john/github/gosqueeze/cmd/sbconfig/main.go:15 +0x49

I tried 1 (LAN) and 3 (WiFi).

After the error, the terminal is unresponsive, no keyboard input possible anymore.

jcrummy commented 3 months ago

Hi @Moonbase59, thank you for reporting this. I will dive into this later today to see if I can figure out what is going on.

Moonbase59 commented 3 months ago

Fantastic, appreciate that!

If it helps, I have multiple hardware devices and some SqueezeLite instances, but it’s real hard setting up a Duet Receiver when the Controller is broken…

jcrummy commented 3 months ago

@Moonbase59 sorry for the delay in looking at this, I had to run out of town for work unexpectedly.

I haven't been able to replicate this at all, including in a VM with Mint installed. Can you provide any details on your hardware?

Moonbase59 commented 3 months ago

Well, it’s a Dell Latitude E6510 laptop, Quad Core i7 Q 740, Nvidia GT218M, WiFi+GB-LAN, 16 GB RAM, Linux Mint 21.3. VMs might maybe not expose all faults same as bare metal.

jcrummy commented 3 months ago

Ok, well that's nothing particularly exotic. I will try on various computers I have access to to see if I can discover anything.

jcrummy commented 3 months ago

Looking through this again, the issue seems to be with the response from the Duet Receiver (I was thinking the problem was before that).

How handy are you with Wireshark? Would you be able to capture the interrogation data when you run sbconfig?

Moonbase59 commented 3 months ago

Not at all, I must admit, never used it. If someone takes me by the hand, I might succeed, though… ;.)

Managed to install Wireshark 4.2.5. If we can, please let’s only do non-destructive things, since I managed to borrow a Controller in the meantime and set up my Duet Receiver.

I’d still be interested that the community has/gets a good tool to set up SlimDevices/Logitech hardware like the Receiver (and possibly others). It’s so frustrating when your Controller is broken and the Receiver the good part that goes to the main stereo!

Thanks for your assistance!

jcrummy commented 3 months ago

I'm glad you were able to get it working in the meantime!

There are actually two things I would like to try, if possible:

  1. Have just the Duet Receiver connected over Ethernet, and see if it gives the same problem
  2. Do the same setup as you were doing, but capture the interrogation in Wireshark.

To run the capture in Wireshark, open Wireshark and double-click the interface you are using. It will immediately start capturing. Run sbconfig until it fails, and then click Capture | Stop in Wireshark. You should have a bunch of lines of IP addresses and whatnot. Then go File | Save As..., save the file and attach it here.

Thank you for helping out.

Moonbase59 commented 3 months ago
  1. What do you mean? A direct connection with a crossover cable? Might not work, since it also talks WiFi. And I can’t remove nearly 50 devices from the LAN and WiFi just to have the Duet as only device…
  2. Any way in Wireshark to not record my whole LAN+WiFi traffic? I tried ether host <mac addr> but that doesn’t seem to work, only get a broadcast from time to time. Is there any way to say "I want traffic between this and that MAC over both LAN+WiFi"?
jcrummy commented 3 months ago
  1. The idea is a direct connection with an Ethernet cable. You shouldn't need a crossover cable, though. Pretty much everything from the last ~15 years auto detects if it needs to be crossover or not, so those cables aren't really necessary any more. The fact that it also speaks WiFi doesn't really matter, the idea is to isolate to just the single device (this is normally what I do when set one up, actually). If the computer you are using is also your server, though, this may be difficult. This works best if the computer you use is just a workstation that does nothing else.
  2. Not really.... Wireshark will capture everything.

I have a feeling one of the devices is returning a different response than what I expect. I've only ever tested this with the Duet Receiver, as that is the only device I have. The other thing that could help is a list of what SqueezeBox devices you have - perhaps one (or more) of them responds differently.

Moonbase59 commented 3 months ago
  1. I’m an old man… stuck in past, ha ha! Auto-crossover, neat! I’ll try that whenever I can rip the Duet away from behind all the tech stuff.

SlimDevices currently:

jcrummy commented 3 months ago

Thank you. I can at least test with Squeezelite on the network here, so I will give that a try.