linux udev rule to load gadget module for client driver












5















I'm having a hard time automating loading a gadget module and bringing up the usb0 device as a eth interface. The interface in question is g_ether for a embedded Linux device and connecting to a PC.



I imagine there is a way to see the event from the plugin and run a script with udev. When I plug my device into a PC, I don't see any events. I tried different variations of udevadm monitor and I'm not sure how to find out what I can use as a udev rule to modprobe a gadget module.



Part of the reason I'm trying to load the otg module is because we are mostly using g_ether. I want to use avahi-autoipd but its getting an IP address before its plugged in. If I use allow-hotplug in the network interface it never automatically brings the interface up when its plugged in. So in theory, I want to plug in the device to a PC, run avahi-autoipd on the new network interface to retrieve an IP, and dhcpd to give one to the host.



Since someone else starting helping me in the stackoverflow (reposting here) I've got some more info.



/sys/bus/usb/devices$ ls
1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3
[ 4297.515400] g_ether gadget: high speed config #2: RNDIS
[ 4300.379021] g_ether gadget: high speed config #1: CDC Ethernet (ECM)
sys/bus/usb/devices$ ls
1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3


I've tried running



   udevadm monitor --environment
udevadm monitor --environment --udev
udevadm monitor
udevadm monitor --kernel
udevadm monitor --kernel --udev


unplugging and plugging the device in doesn't show anything. The manpage says it "
Listens to the kernel uevents and events sent out by a udev rule" and I have no rules on my device. So I'm assuming that's probably why nothing prints out ever, even if I try to do some things with other hardware?



I'm running an embedded Linux distribution. I imagine I might not have everything a desktop has?



Its come to my attention I might have an issue with my g_ether module? These outputs never change.
cat /sys/class/net/usb0/carrier
cat: read error: Invalid argument
cat /sys/class/net/usb0/operstate
down










share|improve this question
















bumped to the homepage by Community 11 mins ago


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




















    5















    I'm having a hard time automating loading a gadget module and bringing up the usb0 device as a eth interface. The interface in question is g_ether for a embedded Linux device and connecting to a PC.



    I imagine there is a way to see the event from the plugin and run a script with udev. When I plug my device into a PC, I don't see any events. I tried different variations of udevadm monitor and I'm not sure how to find out what I can use as a udev rule to modprobe a gadget module.



    Part of the reason I'm trying to load the otg module is because we are mostly using g_ether. I want to use avahi-autoipd but its getting an IP address before its plugged in. If I use allow-hotplug in the network interface it never automatically brings the interface up when its plugged in. So in theory, I want to plug in the device to a PC, run avahi-autoipd on the new network interface to retrieve an IP, and dhcpd to give one to the host.



    Since someone else starting helping me in the stackoverflow (reposting here) I've got some more info.



    /sys/bus/usb/devices$ ls
    1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3
    [ 4297.515400] g_ether gadget: high speed config #2: RNDIS
    [ 4300.379021] g_ether gadget: high speed config #1: CDC Ethernet (ECM)
    sys/bus/usb/devices$ ls
    1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3


    I've tried running



       udevadm monitor --environment
    udevadm monitor --environment --udev
    udevadm monitor
    udevadm monitor --kernel
    udevadm monitor --kernel --udev


    unplugging and plugging the device in doesn't show anything. The manpage says it "
    Listens to the kernel uevents and events sent out by a udev rule" and I have no rules on my device. So I'm assuming that's probably why nothing prints out ever, even if I try to do some things with other hardware?



    I'm running an embedded Linux distribution. I imagine I might not have everything a desktop has?



    Its come to my attention I might have an issue with my g_ether module? These outputs never change.
    cat /sys/class/net/usb0/carrier
    cat: read error: Invalid argument
    cat /sys/class/net/usb0/operstate
    down










    share|improve this question
















    bumped to the homepage by Community 11 mins ago


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


















      5












      5








      5








      I'm having a hard time automating loading a gadget module and bringing up the usb0 device as a eth interface. The interface in question is g_ether for a embedded Linux device and connecting to a PC.



      I imagine there is a way to see the event from the plugin and run a script with udev. When I plug my device into a PC, I don't see any events. I tried different variations of udevadm monitor and I'm not sure how to find out what I can use as a udev rule to modprobe a gadget module.



      Part of the reason I'm trying to load the otg module is because we are mostly using g_ether. I want to use avahi-autoipd but its getting an IP address before its plugged in. If I use allow-hotplug in the network interface it never automatically brings the interface up when its plugged in. So in theory, I want to plug in the device to a PC, run avahi-autoipd on the new network interface to retrieve an IP, and dhcpd to give one to the host.



      Since someone else starting helping me in the stackoverflow (reposting here) I've got some more info.



      /sys/bus/usb/devices$ ls
      1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3
      [ 4297.515400] g_ether gadget: high speed config #2: RNDIS
      [ 4300.379021] g_ether gadget: high speed config #1: CDC Ethernet (ECM)
      sys/bus/usb/devices$ ls
      1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3


      I've tried running



         udevadm monitor --environment
      udevadm monitor --environment --udev
      udevadm monitor
      udevadm monitor --kernel
      udevadm monitor --kernel --udev


      unplugging and plugging the device in doesn't show anything. The manpage says it "
      Listens to the kernel uevents and events sent out by a udev rule" and I have no rules on my device. So I'm assuming that's probably why nothing prints out ever, even if I try to do some things with other hardware?



      I'm running an embedded Linux distribution. I imagine I might not have everything a desktop has?



      Its come to my attention I might have an issue with my g_ether module? These outputs never change.
      cat /sys/class/net/usb0/carrier
      cat: read error: Invalid argument
      cat /sys/class/net/usb0/operstate
      down










      share|improve this question
















      I'm having a hard time automating loading a gadget module and bringing up the usb0 device as a eth interface. The interface in question is g_ether for a embedded Linux device and connecting to a PC.



      I imagine there is a way to see the event from the plugin and run a script with udev. When I plug my device into a PC, I don't see any events. I tried different variations of udevadm monitor and I'm not sure how to find out what I can use as a udev rule to modprobe a gadget module.



      Part of the reason I'm trying to load the otg module is because we are mostly using g_ether. I want to use avahi-autoipd but its getting an IP address before its plugged in. If I use allow-hotplug in the network interface it never automatically brings the interface up when its plugged in. So in theory, I want to plug in the device to a PC, run avahi-autoipd on the new network interface to retrieve an IP, and dhcpd to give one to the host.



      Since someone else starting helping me in the stackoverflow (reposting here) I've got some more info.



      /sys/bus/usb/devices$ ls
      1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3
      [ 4297.515400] g_ether gadget: high speed config #2: RNDIS
      [ 4300.379021] g_ether gadget: high speed config #1: CDC Ethernet (ECM)
      sys/bus/usb/devices$ ls
      1-0:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 usb1 usb2 usb3


      I've tried running



         udevadm monitor --environment
      udevadm monitor --environment --udev
      udevadm monitor
      udevadm monitor --kernel
      udevadm monitor --kernel --udev


      unplugging and plugging the device in doesn't show anything. The manpage says it "
      Listens to the kernel uevents and events sent out by a udev rule" and I have no rules on my device. So I'm assuming that's probably why nothing prints out ever, even if I try to do some things with other hardware?



      I'm running an embedded Linux distribution. I imagine I might not have everything a desktop has?



      Its come to my attention I might have an issue with my g_ether module? These outputs never change.
      cat /sys/class/net/usb0/carrier
      cat: read error: Invalid argument
      cat /sys/class/net/usb0/operstate
      down







      linux usb udev ethernet






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 21 '14 at 22:26







      Kevin

















      asked Apr 18 '14 at 21:14









      KevinKevin

      263




      263





      bumped to the homepage by Community 11 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 11 mins ago


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
























          1 Answer
          1






          active

          oldest

          votes


















          0














          USB specific variables for a uevent are set in kernel function usb_uevent. You can track if this function is called or not.






          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%2f125475%2flinux-udev-rule-to-load-gadget-module-for-client-driver%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














            USB specific variables for a uevent are set in kernel function usb_uevent. You can track if this function is called or not.






            share|improve this answer




























              0














              USB specific variables for a uevent are set in kernel function usb_uevent. You can track if this function is called or not.






              share|improve this answer


























                0












                0








                0







                USB specific variables for a uevent are set in kernel function usb_uevent. You can track if this function is called or not.






                share|improve this answer













                USB specific variables for a uevent are set in kernel function usb_uevent. You can track if this function is called or not.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 12 '18 at 4:32









                V_VV_V

                1363




                1363






























                    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%2f125475%2flinux-udev-rule-to-load-gadget-module-for-client-driver%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

                    CARDNET

                    Boot-repair Failure: Unable to locate package grub-common:i386

                    濃尾地震