/usr/lib/python2.7/dist-packages/pyvisa/resources/usb.py is in python-pyvisa 1.8-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # -*- coding: utf-8 -*-
"""
pyvisa.resources.usb
~~~~~~~~~~~~~~~~~~~~
High level wrapper for USB resources.
This file is part of PyVISA.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, absolute_import
from .. import constants
from .messagebased import MessageBasedResource, ControlRenMixin
@MessageBasedResource.register(constants.InterfaceType.usb, 'INSTR')
class USBInstrument(ControlRenMixin, MessageBasedResource):
"""Communicates with devices of type USB::manufacturer ID::model code::serial number
More complex resource names can be specified with the following grammar:
USB[board]::manufacturer ID::model code::serial number[::USB interface number][::INSTR]
Do not instantiate directly, use :meth:`pyvisa.highlevel.ResourceManager.open_resource`.
"""
def control_in(self, request_type_bitmap_field, request_id, request_value, index, length=0):
"""Performs a USB control pipe transfer from the device.
:param request_type_bitmap_field: bmRequestType parameter of the setup stage of a USB control transfer.
:param request_id: bRequest parameter of the setup stage of a USB control transfer.
:param request_value: wValue parameter of the setup stage of a USB control transfer.
:param index: wIndex parameter of the setup stage of a USB control transfer.
This is usually the index of the interface or endpoint.
:param length: wLength parameter of the setup stage of a USB control transfer.
This value also specifies the size of the data buffer to receive the data from the
optional data stage of the control transfer.
:return: The data buffer that receives the data from the optional data stage of the control transfer.
:rtype: bytes
"""
return self.visalib.usb_control_in(self.session, request_type_bitmap_field,
request_id, request_value, index, length)
def usb_control_out(self, request_type_bitmap_field, request_id, request_value, index, data=""):
"""Performs a USB control pipe transfer to the device.
:param request_type_bitmap_field: bmRequestType parameter of the setup stage of a USB control transfer.
:param request_id: bRequest parameter of the setup stage of a USB control transfer.
:param request_value: wValue parameter of the setup stage of a USB control transfer.
:param index: wIndex parameter of the setup stage of a USB control transfer.
This is usually the index of the interface or endpoint.
:param data: The data buffer that sends the data in the optional data stage of the control transfer.
"""
return self.visalib.usb_control_out(request_type_bitmap_field, request_id, request_value, index, data)
@MessageBasedResource.register(constants.InterfaceType.usb, 'RAW')
class USBRaw(MessageBasedResource):
"""Communicates with to devices of type USB::manufacturer ID::model code::serial number::RAW
More complex resource names can be specified with the following grammar:
USB[board]::manufacturer ID::model code::serial number[::USB interface number]::RAW
Do not instantiate directly, use :meth:`pyvisa.highlevel.ResourceManager.open_resource`.
"""
|