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

Trying to fix https://github.com/indilib/indi/issues/1580 #1581

Merged
merged 3 commits into from Dec 27, 2021

Conversation

gnthibault
Copy link
Contributor

Trying to fix #1580 I think there was some kind of copy/paste mistake, but I am not 100% sure. However, I tested this solution on my local install, and the behaviour is now the expected one.

@gnthibault
Copy link
Contributor Author

gnthibault commented Dec 26, 2021

Ok nope actually, problem is not solved, there is something else going on I think. The code should be right, but somehow, one of the port cannot be set to the expected value, and that result in a IPS_ALERT in some cases (That might be related to a local problem I will investigate right away).

@gnthibault
Copy link
Contributor Author

gnthibault commented Dec 26, 2021

Ok I narrowed it down to that line:

rc[i] = setUSBPortEnabled(i, USBControlV2S[i].s == ISS_ON);

Il looks like this check s=consistently returns False for rc[0] i.e the first usb port. I think I need to get feedback from someone from pegasus on this, it looks too specific

ADDITIONAL INFO: Detected firmware 2.4

@gnthibault
Copy link
Contributor Author

Ok, going through the documentation, I finally saw that:

USB
Enable or disable the USB hub. This can only control ports 1-5 since port 6 is always on.

From
https://www.indilib.org/devices/auxiliary/pegasus-ultimate-power-box.html

I think index 0 in that case relates to port 6 in the documentation

@gnthibault
Copy link
Contributor Author

Ok I think there is an additional error in the driver. In case you have a UPBV2, the usb from 1 to 6 can be enabled/disabled. However, one of the
setUSBPortEnabled(i, USBControlV2S[i].s == ISS_ON)
Always return False (i.e, value 1), when i == 0
It is not clear for me why it is so ? However I absolutely need any possible call to setSwitch, to return a status of either Idle or Ok, to cope with the overall semantic of the drivers. I think there might be some semantic mismatch with what is done in upbv1 ? Maybe someone from Pegasus can help here.

@gnthibault
Copy link
Contributor Author

This might help, especially for the expected return values:
Ultimate_Powerbox_v2_Serial_Command_Table.pdf

@gnthibault
Copy link
Contributor Author

Ok, after a lot of tinkering, and updating my (now) rusty C++14 knowledges, there was an issue with implicit initialization of array. Commit to come soon. There were 2 bugs in a row, and I was kind of disturbed by this ^^

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

Successfully merging this pull request may close these issues.

auxiliary/pegasus_upb strange behaviour with USB_PORT_CONTROL switch vector
2 participants