ttyACM or ttyUSB device detectionWhat can cause a usb port speed change?Ethernet to USB adapter is not...

Avoiding repetition when using the "snprintf idiom" to write text

Is it OK to say "The situation is pregnant with a crisis"?

What is the lowest possible AC?

"in 60 seconds or less" or "in 60 seconds or fewer"?

Calculus, water poured into a cone: Why is the derivative non-linear?

How to count the number of bytes in a file, grouping the same bytes?

Five 5-cent coins touching each other

Odd PCB Layout for Voltage Regulator

How far can gerrymandering go?

Are you required to spend hit dice to take a short rest?

How do I tell my girlfriend she's been buying me books by the wrong author for the last nine months?

Identifying positions of the last TRUEs in a sequence of TRUEs and FALSEs

Did NASA distinguish between the space shuttle cockpit and flight deck?

How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?

Why should I allow multiple IP addresses on a website for a single session?

Rear derailleur got caught in the spokes, what could be a root cause

Why doesn't SpaceX land boosters in Africa?

Where to connect the fuse and why?

How does the 'five minute adventuring day' affect class balance?

Why are examinees often not allowed to leave during the start and end of an exam?

Why was Pan Am Flight 103 flying over Lockerbie?

Why will we fail creating a self sustaining off world colony?

Is this house-rule removing the increased effect of cantrips at higher character levels balanced?

Simplify the code



ttyACM or ttyUSB device detection


What can cause a usb port speed change?Ethernet to USB adapter is not initialized as ttyUSB or ttyACM deviceudev rules assign same port name for a modem with 4 ttyUSB portsEthernet to USB adapter is not initialized as ttyACM devicehow to debug adb insufficient permission casePermissions incorrect on symlink to /dev/ttyACM0 created by udev ruleOpenSuse USB HDD gets device node name “/dev/sdb” of internal HDDttyUSB? No, ttyACM. How can I assign the usb-device to ttyACM, not ttyUSB?device doesn't show up dev ttyUSB0How do I do to detect both the disk (/dev/sd{x}) device and its sibling tty (/dev/ttyACM{y}) device when a composite USB ACM_MS device is inserted?













0















I develop a linux application, which works with ttyUSB*/ttyACM* devices. Now I have a task:

I have to find a way, how to restore communication with device, when connection is temporary lost. Now I see such a behaviour: if port is opened in the app, and device is re-pluged at this moment, the device's name changes, and app can not complete current operation. So, I wrote udev rule to add symlink to device, and the rule works. But app crashes all the same. The reason is that device changes it's tty (ttyACM0->tyyACM1) after re-plugging, and symlink does not help, because file descriptor becames wrong.



Does anybody know a way, how can I replug device without need to restart my app? Are there any settings in Linux to allow device to re-plug to the same tty even if it was opened in the application in the moment of disconnection?










share|improve this question
















bumped to the homepage by Community 50 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

    – Andy Dalton
    Mar 13 '18 at 14:56













  • Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

    – Олег Сидоров
    Mar 13 '18 at 15:21






  • 2





    Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

    – Andy Dalton
    Mar 13 '18 at 16:09
















0















I develop a linux application, which works with ttyUSB*/ttyACM* devices. Now I have a task:

I have to find a way, how to restore communication with device, when connection is temporary lost. Now I see such a behaviour: if port is opened in the app, and device is re-pluged at this moment, the device's name changes, and app can not complete current operation. So, I wrote udev rule to add symlink to device, and the rule works. But app crashes all the same. The reason is that device changes it's tty (ttyACM0->tyyACM1) after re-plugging, and symlink does not help, because file descriptor becames wrong.



Does anybody know a way, how can I replug device without need to restart my app? Are there any settings in Linux to allow device to re-plug to the same tty even if it was opened in the application in the moment of disconnection?










share|improve this question
















bumped to the homepage by Community 50 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

    – Andy Dalton
    Mar 13 '18 at 14:56













  • Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

    – Олег Сидоров
    Mar 13 '18 at 15:21






  • 2





    Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

    – Andy Dalton
    Mar 13 '18 at 16:09














0












0








0








I develop a linux application, which works with ttyUSB*/ttyACM* devices. Now I have a task:

I have to find a way, how to restore communication with device, when connection is temporary lost. Now I see such a behaviour: if port is opened in the app, and device is re-pluged at this moment, the device's name changes, and app can not complete current operation. So, I wrote udev rule to add symlink to device, and the rule works. But app crashes all the same. The reason is that device changes it's tty (ttyACM0->tyyACM1) after re-plugging, and symlink does not help, because file descriptor becames wrong.



Does anybody know a way, how can I replug device without need to restart my app? Are there any settings in Linux to allow device to re-plug to the same tty even if it was opened in the application in the moment of disconnection?










share|improve this question
















I develop a linux application, which works with ttyUSB*/ttyACM* devices. Now I have a task:

I have to find a way, how to restore communication with device, when connection is temporary lost. Now I see such a behaviour: if port is opened in the app, and device is re-pluged at this moment, the device's name changes, and app can not complete current operation. So, I wrote udev rule to add symlink to device, and the rule works. But app crashes all the same. The reason is that device changes it's tty (ttyACM0->tyyACM1) after re-plugging, and symlink does not help, because file descriptor becames wrong.



Does anybody know a way, how can I replug device without need to restart my app? Are there any settings in Linux to allow device to re-plug to the same tty even if it was opened in the application in the moment of disconnection?







udev ttyusb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 13 '18 at 14:48









Thomas

4,4236 gold badges15 silver badges31 bronze badges




4,4236 gold badges15 silver badges31 bronze badges










asked Mar 13 '18 at 14:44









Олег СидоровОлег Сидоров

12 bronze badges




12 bronze badges





bumped to the homepage by Community 50 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 50 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

    – Andy Dalton
    Mar 13 '18 at 14:56













  • Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

    – Олег Сидоров
    Mar 13 '18 at 15:21






  • 2





    Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

    – Andy Dalton
    Mar 13 '18 at 16:09














  • 2





    If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

    – Andy Dalton
    Mar 13 '18 at 14:56













  • Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

    – Олег Сидоров
    Mar 13 '18 at 15:21






  • 2





    Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

    – Andy Dalton
    Mar 13 '18 at 16:09








2




2





If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

– Andy Dalton
Mar 13 '18 at 14:56







If you have an open file descriptor associated with the device, and you unplug/replug it, you'd have to re-open the device. That doesn't mean you have to restart the program, per se, the program itself could handle that case.

– Andy Dalton
Mar 13 '18 at 14:56















Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

– Олег Сидоров
Mar 13 '18 at 15:21





Sad, but true. I'm afraid, you are right =) But, is there at least a way to re-plug device to the same ttyUSB* (not to the same alias)?

– Олег Сидоров
Mar 13 '18 at 15:21




2




2





Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

– Andy Dalton
Mar 13 '18 at 16:09





Can your udev rule uniquely identify the device? Will there ever be only one such device connected at a time? If so, I think you could make your udev rule always update the symlink.

– Andy Dalton
Mar 13 '18 at 16:09










1 Answer
1






active

oldest

votes


















0














Finally, I came to a conclusion, that a manual management of open/close port descriptor is the only solution to the problem.
Also, some moments may affect to the device's behaviour:




  • USB timeout settings

  • modemmanager presence

  • interval between plug and unplug the device






share|improve this answer


























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f429983%2fttyacm-or-ttyusb-device-detection%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Finally, I came to a conclusion, that a manual management of open/close port descriptor is the only solution to the problem.
    Also, some moments may affect to the device's behaviour:




    • USB timeout settings

    • modemmanager presence

    • interval between plug and unplug the device






    share|improve this answer




























      0














      Finally, I came to a conclusion, that a manual management of open/close port descriptor is the only solution to the problem.
      Also, some moments may affect to the device's behaviour:




      • USB timeout settings

      • modemmanager presence

      • interval between plug and unplug the device






      share|improve this answer


























        0












        0








        0







        Finally, I came to a conclusion, that a manual management of open/close port descriptor is the only solution to the problem.
        Also, some moments may affect to the device's behaviour:




        • USB timeout settings

        • modemmanager presence

        • interval between plug and unplug the device






        share|improve this answer













        Finally, I came to a conclusion, that a manual management of open/close port descriptor is the only solution to the problem.
        Also, some moments may affect to the device's behaviour:




        • USB timeout settings

        • modemmanager presence

        • interval between plug and unplug the device







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 12 '18 at 13:59









        Олег СидоровОлег Сидоров

        12 bronze badges




        12 bronze badges






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f429983%2fttyacm-or-ttyusb-device-detection%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...