{"id":16991652,"url":"https://github.com/pstolarz/w1-gpio-cl","last_synced_at":"2025-03-23T17:31:11.325Z","repository":{"id":44594494,"uuid":"69383505","full_name":"pstolarz/w1-gpio-cl","owner":"pstolarz","description":"Command line configured kernel mode 1-wire bus master driver. w1-gpio standard Linux module enhancement/substitution.","archived":false,"fork":false,"pushed_at":"2024-02-17T11:23:09.000Z","size":157,"stargazers_count":24,"open_issues_count":0,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-18T22:25:07.430Z","etag":null,"topics":["bus-master","data-wire-gpio","driver","ds18b20","embedded","embedded-systems","gpio","gpio-pins","kernel","linux","linux-kernel","one-wire"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pstolarz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-27T17:50:39.000Z","updated_at":"2025-01-10T03:13:51.000Z","dependencies_parsed_at":"2024-02-04T15:36:04.394Z","dependency_job_id":"ac970b94-d271-4453-af9f-0b31d691d467","html_url":"https://github.com/pstolarz/w1-gpio-cl","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2Fw1-gpio-cl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2Fw1-gpio-cl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2Fw1-gpio-cl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2Fw1-gpio-cl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pstolarz","download_url":"https://codeload.github.com/pstolarz/w1-gpio-cl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245140918,"owners_count":20567472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bus-master","data-wire-gpio","driver","ds18b20","embedded","embedded-systems","gpio","gpio-pins","kernel","linux","linux-kernel","one-wire"],"created_at":"2024-10-14T03:26:47.226Z","updated_at":"2025-03-23T17:31:10.473Z","avatar_url":"https://github.com/pstolarz.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"w1-gpio-cl\n==========\n\nThis is a Linux kernel-mode driver, intended as an enhancement/substitution\nof the standard Linux `w1-gpio` 1-wire bus master driver. Contrary to\nthe standard driver, `w1-gpio-cl` is not a platform device driver, therefore\ndoesn't need any specific device-tree overlay nor preconfigured kernel (except\nusual 1-wire support via the `wire` module). Moreover, there is possible\ncoexistence between `w1-gpio` and `w1-gpio-cl`, provided no GPIOs conflict\nexists.\n\nModule Configuration\n--------------------\n\n`w1-gpio-cl` is fully configured via its command line parameters while loading\nthe driver. The configuration allows to launch many 1-wire bus masters\ncontrolling different GPIO pins. For parasite powering support, it is\npossible to choose the type of the strong pull-up to be used.\n\nGeneral configuration syntax is:\n```\nmodprobe w1-gpio-cl m1=\"gdt:num[,od][,bpu|gpu:num[,rev]]\" [m2=\"...\" ...]\n```\n\nNOTE: `:` and `,` syntax tokens may be replaced by `=` and `;` respectively,\nso `m1=\"gdt:4,od\"` is equivalent to `m1=\"gdt:4;od\"`, `m1=\"gdt=4,od\"` or\n`m1=\"gdt=4;od\"`.\n\n`m1`, `m2`, ... `mN` - configure up to N (where N=5 for the standard module\ncompilation) bus masters, each one controlling different 1-wire bus connected\nto its GPIO pin (specified in `gdt`). At least one bus master specification\n(that is `m1`) must be provided. It's worth to note, the `X` index in `mX`\nparameter specifies an order in which bus masters are registered in the 1-wire\nsubsystem. The index doesn't need to correspond to the bus master id assigned\nby the kernel.\n\nEach of bus master configurations consist of set of parameters listed below:\n\n* `gdt` - specifies GPIO number associated with the 1-wire data wire (the\n  1-wire bus). This parameter is obligatory for each bus master specification.\n\n* `od` - if specified, the data wire GPIO (`gdt`) is of an open drain type.\n  This parameter is deprecated and its support has been removed for kernels \u003e= v6.5.\n\n* `bpu` - if specified, parasite powering is enabled via the data wire strong\n  pull-up bit-banging. This type of strong pull-up is possible only for non\n  open-drain type of the data wire GPIO (`gdt`).\n\n* `gpu` - specifies GPIO number used for controlling strong pull-up for\n  parasite powering. The GPIO is working in the output mode and is set to the\n  low state if the strong pull-up is active, and to the high state otherwise.\n\n  The strong pull-up controlled by the `gpu` GPIO is the only possibility for\n  an open-drain type of the data wire GPIO (`gdt`). In this case the `gpu` GPIO\n  may be connected to a P-channel MOSFET gate controlling the `Vcc` strong\n  pull-up as presented on the following figure.\n\n  ![External GPIO strong pull-up](schema/gpu.png)\n\n  NOTE: In place of the MOSFET it's possible to use a PNP bipolar transistor\n  with its emitter connected to `Vcc`, collector to the data wire and base to\n  the controlling GPIO (`gpu`). Current reducing resistor shall be placed between\n  the transistor's base and `gpu` pin.\n\n* `rev` - if specified and the `gpu` parameter is provided, the `gpu` GPIO\n  logic is reversed for the strong pull-up activation: GPIO in the high state\n  if the strong pull-up is active, low state - otherwise.\n\nNOTE: Strong pull-up along with parasite powering support is effectively disabled\nif no `bpu` nor `gpu` is specified.\n\nExample of Usage\n----------------\n\n![Example](schema/example.png)\n\nIn this example, there have been configured three bus masters:\n\n* 1st one on GPIO1 controlling non-parasitically powered thermometers.\n\n* 2nd one on GPIO2 controlling parasitically powered thermometers. Strong\n  pull-up is performed via the data wire bit-banging (non open-drain data GPIO).\n\n* 3nd one devoted to handle iButton reader(s) only. Using separate 1-wire bus\n  in this case is justified by the performance reason. The iButton bus is empty\n  for most of its time, and is scanned/searched much more often than other\n  buses for presence of authorized iButtons existence.\n\nNOTE: GPIO1, GPIO2, GPIO3 are numbers specifying actual GPIO pins.\n\nCompilation and Loading\n-----------------------\n\nThe driver module may be compiled directly on the target machine or\ncross-compiled and the result to be copied into the target machine.\nIf you are not familiar with the Linux kernel building process please refer to\n[this link](https://www.raspberrypi.org/documentation/linux/kernel/building.md)\nfirst. It provides good introduction to the topic of kernel\ncompilation/cross-compilation for Raspberry Pi boards.\n\n**Prerequisites**\n\n* Building tool-set.\n\n  * For compilation on the target machine Linux kernel building tools may be\n    installed by (for Debian based systems):\n    ```\n    sudo apt-get install build-essential bc bison flex libssl-dev\n    ```\n\n  * For cross-compilation appropriate target system tool-chain need to be\n    installed on the compiling machine (e.g. package `crossbuild-essential-armhf`\n    for 32-bit or `crossbuild-essential-arm64` for 64-bit ARM). Remaining tools\n    to be installed on the compiling machine:\n    ```\n    sudo apt-get install make bc bison flex libssl-dev\n    ```\n\n* Kernel headers and `kbuild` scripts corresponding to the target kernel.\n\n  * For compilation on the target machine the required headers may be installed\n    by:\n    ```\n    sudo apt-get install linux-headers-KERNEL_RELEASE\n    ```\n    where `KERNEL_RELEASE` corresponds to the kernel release version on the\n    target (to be checked by `uname -r`). In case the package repository\n    contains kernel headers corresponding to the current kernel image the\n    following command will install appropriate headers on the target machine:\n    ```\n    sudo apt-get install linux-headers-`uname -r`\n    ```\n    In case the target's system package repository doesn't contain kernel\n    headers package in a required version (usually the case for Raspberry Pi\n    Raspbian OS) there is a need to use kernel sources as described in the\n    subsequent point.\n\n  * For cross-compilation it's recommended to use Linux kernel sources\n    corresponding to the kernel version installed on the target machine.\n    The kernel sources need to be prepared via proper configuration and\n    `modules_prepare` as follows (launched from the kernel sources directory\n    on the compiling machine):\n    ```\n    ARCH=... CROSS_COMPILE=... make CONFIG_TARGET modules_prepare\n    ```\n    where `CONFIG_TARGET` is a specific kernel target configuration (e.g. for\n    Raspberry Pi boards the configuration shall be set to `bcmrpi_defconfig`,\n    `bcm2709_defconfig`, `bcm2711_defconfig` or `bcmrpi3_defconfig` depending\n    on the platform version). `ARCH` and `CROSS_COMPILE` are required to\n    indicate target architecture and cross-compiling tool-chain.\n\n    NOTE 1: When using kernel sources while compiling on the target machine,\n    there is no need to set `ARCH` and `CROSS_COMPILE`, since the local tool-set\n    is used for compilation.\n\n    NOTE 2: When compiling for Raspberry Pi,\n    [`search_kernel_commit.sh`](https://github.com/pstolarz/rpi-tools/blob/master/search_kernel_commit.sh)\n    script may be used to find commit on the official\n    [RPi kernel repository](https://github.com/raspberrypi/linux)\n    for target's kernel version.\n\n**Compilation**\n\nGeneral compilation command syntax is as follows (launched from the `w1-gpio-cl`\nproject directory):\n```\n[KERNEL_SRC=...] [ARCH=...] [CROSS_COMPILE=...] [CONFIG_W1_MAST_MAX=...] make\n```\n\nThe result is `w1-gpio-cl.ko` driver module located in the project directory.\nAll compilation definitions (`KERNEL_SRC`, `ARCH`, ...) are optional, with the\nfollowing meaning:\n\n* `KERNEL_SRC`: specifies kernel sources directory in case they are used\n  instead of the pre-installed kernel headers (see above).\n\n* `ARCH`, `CROSS_COMPILE`: are used for module cross-compilation exactly as\n  for the Linux kernel.\n\n* `CONFIG_W1_MAST_MAX`: by default the module is compiled to support up to 5 bus\n  masters. This may be changed by setting this definition.\n\n**Installation**\n\nIf the module was compiled on the target machine it's possible to install it\ninto the destination directory by:\n```\nsudo make install\n```\nand uninstall by:\n```\nsudo make uninstall\n```\n\nIf the module was cross-compiled, copy `w1-gpio-cl.ko` module into its destination\nlocation on the target machine (`/lib/modules/KERNEL_RELEASE/kernel/drivers/w1/masters`)\nand remake the kernel modules dependencies by `sudo depmod`.\n\n**Loading**\n```\nsudo modprobe w1-gpio-cl MODULE_CONFIG\n```\nwhere the `MODULE_CONFIG` specifies 1-wire bus master(s) configuration as\ndescribed above.\n\nIf you need to load the module automatically create the following files:\n* `/etc/modules-load.d/w1-gpio-cl.conf` with content:\n```\nw1-gpio-cl\n```\n* `/etc/modprobe.d/w1-gpio-cl.conf` with content:\n```\noptions w1-gpio-cl MODULE_CONFIG\n```\nwhere the `MODULE_CONFIG` specifies 1-wire bus master(s) configuration.\n\n**DKMS**\n\nThe module may be installed as part of [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support)\nsystem. To install `w1-gpio-cl` as DKMS module launch the following commands\nfrom the module source directory:\n```\nsudo dkms add .\nsudo dkms install w1-gpio-cl/MODULE_VER\n```\nwhere `MODULE_VER` denotes module version. From now any kernel updates on the\ntarget machine will precompile `w1-gpio-cl` module accordingly.\n\nLicense\n-------\n\nGNU GENERAL PUBLIC LICENSE v2. See LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstolarz%2Fw1-gpio-cl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpstolarz%2Fw1-gpio-cl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstolarz%2Fw1-gpio-cl/lists"}