RE: KLD and USB driver

gerarra_at_tin.it
Date: 09/05/04

  • Next message: Gleb Smirnoff: "bridge callbacks in if_ed.c?"
    Date: Sun, 5 Sep 2004 21:19:12 +0200
    To: freebsd-hackers@freebsd.org
    
    

    >I'm working on a usb device driver I've derived from existing drivers in
    >sys/dev/usb (4.10-RELEASE).
    >
    >I can successfully load and unload the module, but the usb subsystem does
    >not appear to see the driver. However if I compile my driver in the
    >kernel, the usb sub system uses the driver correctly. Unfortunately this
    >is making it time consuming to test changes to my driver code as I have
    to
    >compile the kernel each time.
    >
    >I haven't see this used in the existing usb drivers code, but I tried
    >using the "KLD Skeleton" from the FreeBSD Architecture Handbook.
    >Although I see the uprintf output at the terminal when load/unloading the
    >module, the usb subsystem does not use my driver. Like the existing usb
    >drivers, I'm using USB_DECLARE_DRIVER and DRIVER_MODULE statements.
    >
    >Is the KLD DECLARE_MODULE code really necessary for this driver (doesn't
    >USB_DECLARE_DRIVER make the driver available already)? How can I determine
    >why the driver works when compiled in the kernel, but not when dynamically
    >loaded? I'm able to load/unload the uhid and ugen drivers and they work
    as
    >expected.

    FreeBSD is dived into subsystems and every subsystem contains a certain
    number of components. To mantain specific order starting subsystems SYSINIT
    macro is provided by the kernel; very struct sysinit obj has a double-code
    priority referencing subsystem priority and priority within the subsystem
    (you can give a look to them in sys/kernel.h, enum sysinit_sub_id and enum
    sysinit_elem_order enumerations). When you code a generic KLD, DECLARE_MODULE
    macro is provided to manage linking; between the other things a struct sysinit
    obj is done (through a call to SYSINIT macro) and initialized within a specified
    subsystem and with a specified priority inside the subsystem, to let module
    start properly. DRIVER_MODULE just does that: among the other things, calls
    DECLARE_MODULE linking the new module in the DRIVERS subsystems. USB_DECLARE_DRIVER,
    instead, just defines some functions to manage your usb driver. In the end,
    the real linking is done by DRIVER_MODULE and you should not use DECLARE_MODULE
    (DRIVER_MODULE alredy does). However for a review of the code the complete
    source code might be provided.

    greetings

    rookie

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Gleb Smirnoff: "bridge callbacks in if_ed.c?"

    Relevant Pages

    • Re: [ACPI] Re: Call for help: list of machines with working S3
      ... If you stop the entire i2c subsystem from being loaded by hotplug ... > (note this is the BUS driver, not the sensors driver!), then resume works ... I just tested two USB devices after S3 resuming without having removed ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Vista fixes PCIe re-install problem ... why ?
      ... This would cause Server 2003 to avoid the power state transition ... their subsystem ID changes. ... If he sends the vendor/device IDs of the device, ... since a driver uninstall/reinstall doesn't cause the PDO to be recreated, ...
      (microsoft.public.development.device.drivers)
    • Linux IEEE 1394/ FireWire subsystem TODO list
      ... Another page related to FireWire ... driver development status is http://wiki.linux1394.org/JujuMigration. ... IEEE1394 Subsystem ... Implement MCAP and multicast support. ...
      (Linux-Kernel)
    • Re: [spi-devel-general] [Patch 1/4] Industrialio Core
      ... this subsystem is _huge_. ... how I imagine the ADC subsystem. ... then it will get moved to the main headers rather than being driver specific. ... If we know the device is an accelerometer rather than a general ADC is would be ...
      (Linux-Kernel)
    • Re: which PCI device instance ID fields never impact software?
      ... "If the manufacturer makes a modification during the life of a PCI device ... "Any bug fix, feature, or performance update that does not change the ... to the subsystem fields. ... per-unique-device-flavour driver. ...
      (microsoft.public.development.device.drivers)