openairplay / airplay2-receiver

AirPlay 2 Receiver - Python implementation
2.12k stars 131 forks source link

Fix pin logic #63

Closed jacobericson closed 2 years ago

jacobericson commented 2 years ago

getDevicePassword() is an object of DeviceProperties and not Hap.

My solution is just to pass it through the calls since the DeviceProperties instance is scoped to ap2-receiver and has no visibly to Hap, but regardless it should be fixed.

patrice-guillemette commented 2 years ago

Tested it and it works fine. Thanks for your mod !

systemcrash commented 2 years ago

If I recall my review correctly, there is at least one case where the pin logic is broken.

TheSpookyCat commented 2 years ago

If I recall my review correctly, there is at least one case where the pin logic is broken.

With a basic use case I was able to confirm this PR works fine. Do you remember any details of the broken case?

systemcrash commented 2 years ago

Not at the computer, but I recall something somewhere which does not account for something.

The following signature has changed. I think it's called elsewhere using the old signature. This is the new signature:

def pair_setup_m1_m2(self, pw)

TheSpookyCat commented 2 years ago

Not at the computer, but I recall something somewhere which does not account for something. The following signature has changed. I think it's called elsewhere using the old signature. This is the new signature: def pair_setup_m1_m2(self, pw)

I couldn't find more than 1 usage of pair_setup_m1_m2. pair_setup (which calls ...m1_m2) does have an extra usage which doesn't fulfill all args but this is part of request(self, req), which isn't used anywhere at all. Changing the signature of both pair_setup and pair_setup_m1_m2 to default pw to None looks like an acceptable solution though.

I wasn't able to initiate a request for the setup pin or streaming pin, so can't test if there is any broken logic anywhere.