Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Agilent U2751A 4x8 switch matrix #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
35 changes: 25 additions & 10 deletions usbtmc/usbtmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ def is_usbtmc_device(dev):

if dev.idVendor == 0x0957:
# Agilent
if dev.idProduct in [0x2818, 0x4218, 0x4418]:
if dev.idProduct in [0x2818, 0x3E18, 0x4218, 0x4418]:
# Agilent U27xx modular devices in firmware update mode
# 0x2818 for U2701A/U2702A (firmware update mode on power up)
# 0x3E18 for U2751A (firmware update mode on power up)
# 0x4218 for U2722A (firmware update mode on power up)
# 0x4418 for U2723A (firmware update mode on power up)
return True
Expand All @@ -165,11 +166,15 @@ def list_resources():
if idVendor == 0x0957 and idProduct == 0x4218:
# Agilent U2722A firmware update mode
idProduct = 0x4118

if idVendor == 0x0957 and idProduct == 0x4418:
# Agilent U2723A firmware update mode
idProduct = 0x4318

if idVendor == 0x0957 and idProduct == 0x3E18:
# Agilent U2723A firmware update mode
idProduct = 0x3D18

# attempt to read serial number
iSerial = None
try:
Expand Down Expand Up @@ -202,7 +207,7 @@ def find_device(idVendor=None, idProduct=None, iSerial=None):
# Agilent U2701A/U2702A firmware update mode
if dev.idVendor == idVendor and dev.idProduct == 0x2818:
found = True

if idVendor == 0x0957 and idProduct == 0x4118:
# Agilent U2722A firmware update mode
if dev.idVendor == idVendor and dev.idProduct == 0x4218:
Expand All @@ -213,6 +218,11 @@ def find_device(idVendor=None, idProduct=None, iSerial=None):
if dev.idVendor == idVendor and dev.idProduct == 0x4418:
found = True

if idVendor == 0x0957 and idProduct == 0x3D18:
# Agilent U2751A firmware update mode
if dev.idVendor == idVendor and dev.idProduct == 0x3E18:
found = True

if not found:
continue

Expand Down Expand Up @@ -354,25 +364,30 @@ def open(self):

# initialize device

if self.device.idVendor == 0x0957 and self.device.idProduct in [0x2818, 0x4218, 0x4418]:
if self.device.idVendor == 0x0957 and self.device.idProduct in [0x2818, 0x3E18, 0x4218, 0x4418]:
# Agilent U27xx modular devices
# U2701A/U2702A, U2722A/U2723A
# U2701A/U2702A, U2722A/U2723A, U2751A
# These devices require a short initialization sequence, presumably
# to take them out of 'firmware update' mode after confirming
# that the firmware version is correct. This is required once
# on every power-on before the device can be used.
# Note that the device will reset and the product ID will change.
# U2701A/U2702A boot 0x2818, usbtmc 0x2918
# U2751A boot 0x3E18, usbtmc 0x3D18
# U2722A boot 0x4218, usbtmc 0x4118
# U2723A boot 0x4418, usbtmc 0x4318

serial = self.device.serial_number

new_id = 0

if self.device.idProduct == 0x2818:
# U2701A/U2702A
new_id = 0x2918
if self.device.idProduct in [0x2818, 0x3E18]:
if self.device.idProduct == 0x2818:
# U2701A/U2702A
new_id = 0x2918
elif self.device.idProduct == 0x3E18:
# U2751A
new_id = 0x3D18
self.device.ctrl_transfer(bmRequestType=0xC0, bRequest=0x0C, wValue=0x0000, wIndex=0x047E, data_or_wLength=0x0001)
self.device.ctrl_transfer(bmRequestType=0xC0, bRequest=0x0C, wValue=0x0000, wIndex=0x047D, data_or_wLength=0x0006)
self.device.ctrl_transfer(bmRequestType=0xC0, bRequest=0x0C, wValue=0x0000, wIndex=0x0484, data_or_wLength=0x0005)
Expand Down Expand Up @@ -680,7 +695,7 @@ def read_raw(self, num=-1):
if self.rigol_quirk and read_data:
pass # do nothing, the packet has no header if it isn't the first
else:
msgid, btag, btaginverse, transfer_size, transfer_attributes, data = self.unpack_dev_dep_resp_header(resp)
msgid, btag, btaginverse, transfer_size, transfer_attributes, data = self.unpack_dev_dep_resp_header(resp)


if self.rigol_quirk:
Expand Down