frank26080115
Member
I'm writing some code to control a mirrorless camera using PTP (picture transfer protocol), writing a class to inherit from USBDriver. I own a Beagle USB analyzer and from what I see, the camera gives an annoying amount of NAKs after any command transfer (libusb would timeout/io-error on any single NAK), and the host driver (Sony/Microsoft) on the PC simply does a retry only about 50 microseconds later.
This means that my code for the Teensy must also be able to quickly detect a NAK and then reattempt the transfer.
Once I submit my transfer with queue_Data_Transfer, I am expecting a callback to the pipe->callback_function, with a parameter "const Transfer_t *transfer". I need this callback to indicate if the transfer is NAK'ed.
Looking through the code, there's some magic numbers being checked for the EHCI qTD's token before the callback_function is called. I am lost here, I don't actually think qtd.token is an indicator of the transfer's status.
I need help here... the strategy of using a slow timeout isn't going to work, I actually do need a callback on a NAK so I can implement a retry mechanism.
I believe on a STM32, the correct way to find it is using ???_GetURBState, which can give me one of: URB_IDLE, URB_DONE, URB_NOTREADY, URB_NYET, URB_ERROR, URB_STALL
Thanks
(don't ask me to use a linux/sbc host, libusb has a few problems that causes the camera to internally exception)
(the end result of this project will allow for additional photography features such as focus stacking, more AI driven autofocus, etc)
This means that my code for the Teensy must also be able to quickly detect a NAK and then reattempt the transfer.
Once I submit my transfer with queue_Data_Transfer, I am expecting a callback to the pipe->callback_function, with a parameter "const Transfer_t *transfer". I need this callback to indicate if the transfer is NAK'ed.
Looking through the code, there's some magic numbers being checked for the EHCI qTD's token before the callback_function is called. I am lost here, I don't actually think qtd.token is an indicator of the transfer's status.
I need help here... the strategy of using a slow timeout isn't going to work, I actually do need a callback on a NAK so I can implement a retry mechanism.
I believe on a STM32, the correct way to find it is using ???_GetURBState, which can give me one of: URB_IDLE, URB_DONE, URB_NOTREADY, URB_NYET, URB_ERROR, URB_STALL
Thanks
(don't ask me to use a linux/sbc host, libusb has a few problems that causes the camera to internally exception)
(the end result of this project will allow for additional photography features such as focus stacking, more AI driven autofocus, etc)