plin-linux 0.0.3__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: plin-linux
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: The python-plin package is a Python wrapper for the chardev API provided by the PEAK LIN Linux Beta.
5
5
  Author-email: William Zhang <williamzhang@rivian.com>
6
6
  Project-URL: Homepage, https://github.com/rivian/python-plin
@@ -12,9 +12,10 @@ Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: ioctl_opt
15
+ Dynamic: license-file
15
16
 
16
17
  # Python PLIN library
17
- This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Beta. The PEAK Linux beta driver is required to use this library and is available [here](https://forum.peak-system.com/viewtopic.php?t=5875).
18
+ This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Driver. The PEAK LIN Linux driver is required to use this library and is available [here](https://www.peak-system.com/fileadmin/media/linux/lin.php).
18
19
 
19
20
  ## Installation
20
21
  The `plin-linux` package is available on [PyPI](https://pypi.org/project/plin-linux/) and can be directly installed with `pip install plin-linux`.
@@ -1,5 +1,5 @@
1
1
  # Python PLIN library
2
- This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Beta. The PEAK Linux beta driver is required to use this library and is available [here](https://forum.peak-system.com/viewtopic.php?t=5875).
2
+ This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Driver. The PEAK LIN Linux driver is required to use this library and is available [here](https://www.peak-system.com/fileadmin/media/linux/lin.php).
3
3
 
4
4
  ## Installation
5
5
  The `plin-linux` package is available on [PyPI](https://pypi.org/project/plin-linux/) and can be directly installed with `pip install plin-linux`.
@@ -514,23 +514,29 @@ class PLIN:
514
514
 
515
515
  def read(self, block=True) -> Union[PLINMessage, None]:
516
516
  '''
517
- Reads a PLINMessage from the LIN bus with an optional timeout in milliseconds.
517
+ Reads the next PLINMessage the driver has queued.
518
518
 
519
- A timeout value of 0 blocks until data is read. If the timeout is reached before data is read, None is returned.
519
+ Every record is returned as the device reported it, including frames whose data is all 0xFF:
520
+ that is what an unanswered header looks like (flags carry SLV_NOT_RSP / TIMEOUT), and it is
521
+ indistinguishable from a slave that answered with recessive bytes, so the caller must decide
522
+ from the flags, not the data. Non-FRAME records (SLEEP, WAKEUP, OVERRUN, ...) are returned
523
+ too; check message.type.
524
+
525
+ Returns None when a non-blocking read finds nothing queued.
520
526
  '''
521
527
  if self.fd:
522
528
  blocking = os.get_blocking(self.fd)
523
529
  os.set_blocking(self.fd, block)
524
530
  try:
525
531
  result = os.read(self.fd, PLINMessage.buffer_length)
526
- message = PLINMessage.from_buffer_copy(result)
527
- # If bytes read was invalid.
528
- if bytes(message.data) == PLIN_EMPTY_DATA:
529
- message = None
530
- except:
531
- message = None
532
- os.set_blocking(self.fd, blocking)
533
- return message
532
+ except BlockingIOError:
533
+ return None
534
+ finally:
535
+ os.set_blocking(self.fd, blocking)
536
+
537
+ if len(result) < PLINMessage.buffer_length:
538
+ return None
539
+ return PLINMessage.from_buffer_copy(result)
534
540
  else:
535
541
  raise Exception("PLIN not connected!")
536
542
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: plin-linux
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: The python-plin package is a Python wrapper for the chardev API provided by the PEAK LIN Linux Beta.
5
5
  Author-email: William Zhang <williamzhang@rivian.com>
6
6
  Project-URL: Homepage, https://github.com/rivian/python-plin
@@ -12,9 +12,10 @@ Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: ioctl_opt
15
+ Dynamic: license-file
15
16
 
16
17
  # Python PLIN library
17
- This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Beta. The PEAK Linux beta driver is required to use this library and is available [here](https://forum.peak-system.com/viewtopic.php?t=5875).
18
+ This library provides a Python interface for interacting with PEAK devices such as the PCAN-USB Pro and PLIN-USB on Linux using the chardev API provided by the PEAK LIN Linux Driver. The PEAK LIN Linux driver is required to use this library and is available [here](https://www.peak-system.com/fileadmin/media/linux/lin.php).
18
19
 
19
20
  ## Installation
20
21
  The `plin-linux` package is available on [PyPI](https://pypi.org/project/plin-linux/) and can be directly installed with `pip install plin-linux`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "plin-linux"
7
- version = "0.0.3"
7
+ version = "0.0.4"
8
8
  authors = [
9
9
  { name="William Zhang", email="williamzhang@rivian.com" },
10
10
  ]
File without changes
File without changes
File without changes
File without changes
File without changes