#------------------------------------------------------------------
#    Copyright (C) 2024 Canonical Ltd.
#
#    Author: Federico Quattrin <federico.quattrin@canonical.com>
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#------------------------------------------------------------------
# vim: ft=apparmor
#

abi <abi/4.0>,
include <tunables/global>

profile lsusb /usr/bin/lsusb {
  include <abstractions/base>

  network netlink raw,

  /dev/ r,
  /dev/bus/usb/ r,
  @{run}/udev/data/*usb:* r,
  @{run}/udev/data/c*:* r,

  @{sys}/bus/ r,
  @{sys}/bus/usb/devices/ r,
  @{sys}/class/ r,

  @{sys}/devices/**/usb[0-9]**/uevent r,
  @{sys}/devices/**/usb[0-9]**/busnum r,
  @{sys}/devices/**/usb[0-9]**/descriptors r,
  @{sys}/devices/**/usb[0-9]**/devnum r,
  @{sys}/devices/**/usb[0-9]**/speed r,
  @{sys}/devices/**/usb[0-9]**/manufacturer r,
  @{sys}/devices/**/usb[0-9]**/product r,
  @{sys}/devices/**/usb[0-9]**/serial r,

  include if exists <local/lsusb>
}
