10 Replies Latest reply on Nov 17, 2017 2:32 AM by user_250395407

    Reconnect on Linux

    user_250395407

      I'm looking for a way to send the Reconnect command to a device with the Linux OS.

      I didn't find anything relating that somewhere.

        • 1. Re: Reconnect on Linux
          Madhu Lakshmipathy

          Hi,

           

          If I understood your question correctly, you have connected your USB Device (FX3 / CX3) to a Host with Linux OS.

           

          You want to send a reconnect command from the USB Device to the Host Linux PC. (Please correct me if I understood wrongly).

           

          As per USB Specification, a USB Device is a slave which cannot send a command or data of its own to the host without being asked.

           

          The host has to keep pinging the device asking for a user defined status / data that tells the host that it must disconnect and reconnect. This can be implemented using Vendor Specific Control Request implementation.

           

          Regards,

          -Madhu Sudhan

          • 2. Re: Reconnect on Linux
            user_250395407

            Hello Madhu,

            Yes I have connected my device on Linux

            I'm using the MonoUsbDevice Class with is part of LibUsbDotNet.LudnMonoLibUsb.

            I can remap all the commands that I use on windows and everything's going well included streaming with bulk EP Except the Reconnect.

            In Windows CyUSB.net, The Reconnect command is part of the CyUsbDevice Class.

            My question is : I would like to have the Reconnect available on Linux but it is not included in the MonoUsbDevice.

            Is there a way to implement and add it to Linux OS ?

            NB : I don't want to initiate a Reconnect from the device, only from the host as I do on Windows with CyUsbDevice.Reconnect().

            • 3. Re: Reconnect on Linux
              user_250395407

              Hello Madhu,

              Some news on that issue ?

              • 4. Re: Reconnect on Linux
                Madhu Lakshmipathy

                Hi,

                 

                I am not sure if the linux libraries you have mentioned have this facility. However if you are able to send a vendor specific command this should be possible.

                 

                I am understand that you have a concern against performing the reconnect in the device. But I assure you that it should not be a problem. The host will be able to handle this very well.

                 

                Regards,

                - Madhu Sudhan

                • 5. Re: Reconnect on Linux
                  user_250395407

                  Hi Madhu,

                  Thanks for the reply but this answer is not really a solution "But I assure you that it should not be a problem. The host will be able to handle this very well."

                  I understand the only way to implement the reconnect on Linux is to implement that in the device itself upon vendor specific command AND  to send this command from the Host.

                   

                  On my side:

                  - I know how to handle a vendor command in the device

                  - I know how to send a vendor command on the host

                   

                  My questions:

                  - I'm not sure which function to use in order to do the disconnect in the device :

                         - CyFx3BootUsbConnect() from EZ-USB FX3 API linrary ?

                         - a full µC reset, in this case how to handle it with the SDK ?

                   

                  Thanks, Yannick

                  • 6. Re: Reconnect on Linux
                    user_250395407

                    Or CyU3PUsbHostPortReset() ?

                    • 7. Re: Reconnect on Linux
                      Madhu Lakshmipathy

                      You need to call CyU3PConnectState (CyFalse, CyFalse); and then CyU3PConnectState (CyTrue, CyTrue); (first API is for disconnection, second API is for reconnection.

                       

                      Regards,

                      - Madhu Sudhan

                      1 of 1 people found this helpful
                      • 8. Re: Reconnect on Linux
                        user_250395407

                        Hi Madhu,

                        Thanks for the reply.

                        I'll test that next week with another modification in the usb desc.required for win10 (a solved case from Cypress support).

                        I'll keep you informed.

                        Yannick.

                        • 9. Re: Reconnect on Linux
                          ntan

                          Are you looking for a function like "libusb_reset_device()" in libusb library?  Following is a URL for the online manual.

                           

                          Device handling and enumeration

                           

                          I know some operating system issues the "SET CONFIGURATION" request multiple time.  So, I think it is worth to connect several kind of operating system as a test.

                           

                          Regards,

                          Noriaki

                          • 10. Re: Reconnect on Linux
                            user_250395407

                            Thanks Madhu,

                             

                            The CyU3PConnectState (CyFalse, CyFalse) and CyU3PConnectState (CyTrue, CyTrue) are working well.

                             

                            For interested people what I'm doing is :

                            1- Set a flag _reconnectRequest in _USBSetupCB() callback upon a specific vendor request

                             

                            2- Reset this flag in ApplicationStart (upon CY_U3P_USB_EVENT_SETCONF event) and also in ApplicationStop (upon CY_U3P_USB_EVENT_RESET or CY_U3P_USB_EVENT_CONNECT or CY_U3P_USB_EVENT_DISCONNECT event)

                             

                            3- Check if this flag is set in a low priority parallel thread and do the reconnect request:

                            for (;;)

                            {

                                    CyU3PThreadSleep (200);

                                    if(_reconnectRequest)

                                    {           

                                        CyU3PConnectState(CyFalse, CyFalse);

                                        CyU3PThreadSleep (500);

                                        CyU3PConnectState(CyTrue, CyTrue);

                                        _reconnectRequest = 0;

                                    }

                            }