# udev rules for gpsd
# @GENERATED@
#
# This file is Copyright by the GPSD project
# SPDX-License-Identifier: BSD-2-clause
#
# The rules in this file handle devices in subsystems "tty" and
# "gnss".

# Subsystem "gnss" includes devices handled by the "gnss" kernel
# modules.  The "gnss" devices are primarily configured using device
# tree options.  They may use I2C, DDC, gpio connections in place of,
# or in addition to, plain serial connections.  They may also allow the
# kernel to control the power state, sleep state and other properties of
# embedded devices.

# Traditional GNSS and GPS receivers, using traditional serial ports or
# USB ports use the "tty" subsystem, not the "gnss subsystem.  Unless
# you have a phone, or other embedded device using device tree, these
# rules are what you are looking for.


# SUBSYSTEM "gnss"
# The rules in this section only apply to subsystem "gnss".

SUBSYSTEM!="gnss", GOTO="gpsd_tty_rules"

ACTION=="add", SUBSYSTEM=="gnss", GROUP="@GROUP@", @UDEVCOMMAND@

# SUBSYSTEM "tty"
# The rules in this section only apply to subsystem "tty".
# Subsystem "tty" includes most of the traditional /dev/ttyXX devices.
LABEL="gpsd_tty_rules"

SUBSYSTEM!="tty", GOTO="gpsd_rules_end"

# Older GNSS receivers do not have their own USB device class. They are
# serial only devices, and use serial-over-USB devices, so what you see
# is actually the ID of the serial-over-USB chip. Fortunately, just
# two of these account for over 80% of consumer-grade GPS sensors. The
# gpsd.hotplug wrapper script will tell a running gpsd that it should
# look at the device that just went active, because it might be a GNSS
# device.
#
# Newer GNSS receivers may have a USB ID that uniquely identifies them
# as GNSS receivers.
#
# The generic serial-over-USB devices are commented out in the file to
# prevent gpsd from taking over non GNSS serial devices.  If you
# have one of these devices, and wish auto detection to work, uncomment
# them.
#
# The following setup works on Debian and Ubuntu - something similar
# will apply on other distributions:
#
#   /lib/udev/rules.d/25-gpsd.rules
#   /lib/udev/gpsd.hotplug
#
# These rules are sorted by idVenbdor and idProduct to make it easier
# to find specific rules, and prevent duplicates.

# FTDI 8U232AM / FT232 [linux module: ftdi_sio]
# rule disabled because it matches way too many generic serial converters
# and creates more harm than good
#ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="gps%n", @UDEVCOMMAND@

# ATEN International Co., Ltd UC-232A Serial Port [linux module: pl2303]
ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008", SYMLINK+="gps%n", @UDEVCOMMAND@

# Prolific Technology, Inc. PL2303 Serial Port [linux module: pl2303]
# rule disabled because it matches way too many generic serial converters
# and creates more harm than good
#ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps%n", @UDEVCOMMAND@

# This is a partial duplicate and does not follow the same style as the others?
# u-blox AG, u-blox 8 (tested with u-blox8 GNSS Mouse Receiver / GR-801)
# [linux module: pl2303]
# rule disabled because it matches way too many generic serial converters
# and creates more harm than good
#ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps%n", TAG+="systemd", ENV{SYSTEMD_WANTS}+="gpsdctl@%k.service"

# PS-360 OEM (GPS sold with MS Street and Trips 2005) [linux module: pl2303]
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", SYMLINK+="gps%n", @UDEVCOMMAND@

# Garmin International GPSmap, various models (tested with Garmin GPS 18 USB)
# linux module: garmin_gps]
ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", SYMLINK+="gps%n", @UDEVCOMMAND@

# MediaTek (tested with HOLUX M-1200E) [linux module: cdc_acm]
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="3329", SYMLINK+="gps%n", @UDEVCOMMAND@

# Cygnal Integrated Products, Inc. CP210x Composite Device
# (Used by Holux m241 and Wintec grays2 wbt-201) [linux module: cp210x]
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="gps%n", @UDEVCOMMAND@

# Cygnal Integrated Products, Inc. [linux module: cp210x]
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea71", SYMLINK+="gps%n", @UDEVCOMMAND@

# Cypress M8/CY7C64013 (Delorme uses these) [linux module: cypress_m8]
ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0100", SYMLINK+="gps%n", @UDEVCOMMAND@

# Cypress M8/CY7C64013 (DeLorme LT-40)
ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0200", SYMLINK+="gps%n", @UDEVCOMMAND@

# u-blox AG, u-blox 5 (tested with Navilock NL-402U) [linux module: cdc_acm]
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", SYMLINK+="gps%n", @UDEVCOMMAND@

# u-blox AG, u-blox 6 (tested with GNSS Evaluation Kit TCXO) [linux module: cdc_acm]
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", SYMLINK+="gps%n", @UDEVCOMMAND@

# u-blox AG, u-blox 7 [linux module: cdc_acm]
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK+="gps%n", @UDEVCOMMAND@

# u-blox AG, u-blox 8 (tested with GNSS Evaluation Kit EKV-M8N)
# [linux module: cdc_acm]
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK+="gps%n", @UDEVCOMMAND@

# u-blox AG, u-blox 9 (tested with GNSS Evaluation Kit C099-F9P)
# [linux module: cdc_acm]
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a9", SYMLINK+="gps%n", @UDEVCOMMAND@

# Telit wireless solutions (tested with HE910G) [linux module: cdc_acm]
ATTRS{interface}=="Telit Wireless Module Port", ATTRS{bInterfaceNumber}=="06", SYMLINK+="gps%n", @UDEVCOMMAND@

LABEL="gpsd_rules_end"
