Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions can/viewer.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
# coding: utf-8
#
# Copyright (C) 2018 Kristian Sloth Lauszus. All rights reserved.
# Copyright (C) 2018 Kristian Sloth Lauszus.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Contact information
# -------------------
Expand DownExpand Up@@ -370,11 +384,11 @@ def parse_args(args):
metavar='{<id>:<format>,<id>:<format>:<scaling1>:...:<scalingN>,file.txt}',
nargs=argparse.ONE_OR_MORE, default='')

optional.add_argument('-f', '--filter', help='R|Comma separated CAN filters for the given CAN interface:'
optional.add_argument('-f', '--filter', help='R|Space separated CAN filters for the given CAN interface:'
'\n <can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask)'
'\n <can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask)'
'\nFx to show only frames with ID 0x100 to 0x103:'
'\n python -m can.viewer -f 100:7FC'
'\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:'
'\n python -m can.viewer -f 100:7FC 200:7F0'
'\nNote that the ID and mask are alway interpreted as hex values',
metavar='{<can_id>:<can_mask>,<can_id>~<can_mask>}', nargs=argparse.ONE_OR_MORE, default='')

Expand Down
16 changes: 15 additions & 1 deletion test/test_viewer.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
#!/usr/bin/python
# coding: utf-8
#
# Copyright (C) 2018 Kristian Sloth Lauszus. All rights reserved.
# Copyright (C) 2018 Kristian Sloth Lauszus.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Contact information
# -------------------
Expand Down