Skip to content
Open
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
5 changes: 4 additions & 1 deletion packaging/70-tryx-pase-access.rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TRYX PANORAMA SE exposes a vendor protocol over a USB Printer Class
# TRYX PANORAMA exposes a vendor protocol over a USB Printer Class
# interface. Mark it for logind ACL assignment before 73-seat-late.rules.

ACTION=="add|change", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="391a", ATTR{idProduct}=="1021", OWNER="root", GROUP="lp", MODE="0660", TAG+="uaccess"

ACTION=="add|change", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="391a", ATTR{idProduct}=="1011", OWNER="root", GROUP="lp", MODE="0660", TAG+="uaccess"
18 changes: 13 additions & 5 deletions src/printerprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ constexpr qsizetype kMediaPullCancellationCheckInterval = 64 * 1024;
constexpr quint16 kTryxVendorId = 0x391a;
constexpr quint16 kTransitionProductId = 0x0006;
constexpr quint16 kPaseProductId = 0x1021;
constexpr quint16 kPanoProductId = 0x1011;
constexpr int kPollCancellationSliceMs = 100;
constexpr int kMaxSkippedResponseFrames = 256;
constexpr qsizetype kMaxSkippedResponseBytes = 4 * 1024 * 1024;
Expand Down Expand Up @@ -173,6 +174,7 @@ UdevEventPolicy udevEventPolicy(const QByteArray &subsystem,
const QByteArray normalizedProduct = product.toLower();
const bool tryxDevice =
normalizedProduct.startsWith(QByteArrayLiteral("391a/1021/")) ||
normalizedProduct.startsWith(QByteArrayLiteral("391a/1011/")) ||
normalizedProduct.startsWith(QByteArrayLiteral("391a/6/")) ||
normalizedProduct.startsWith(QByteArrayLiteral("391a/0006/"));
if (!tryxDevice && !touchesCurrentEndpoint) {
Expand Down Expand Up @@ -614,7 +616,8 @@ QList<LibusbPrinterCandidate> enumerateLibusbPrinterCandidates(
}
continue;
}
if (descriptor.idProduct != kPaseProductId) {
if (descriptor.idProduct != kPaseProductId &&
descriptor.idProduct != kPanoProductId) {
continue;
}
if (workingDeviceCount) {
Expand Down Expand Up @@ -748,7 +751,8 @@ class LibusbAsyncTransport {
if (libusb_get_device_descriptor(device, &descriptor) !=
LIBUSB_SUCCESS ||
descriptor.idVendor != kTryxVendorId ||
descriptor.idProduct != kPaseProductId ||
(descriptor.idProduct != kPaseProductId &&
descriptor.idProduct != kPanoProductId) ||
libusbStableDeviceId(device) != deviceId ||
!findLibusbPrinterInterface(device, &openedInterface)) {
continue;
Expand Down Expand Up @@ -1693,7 +1697,8 @@ bool validatePrinterEndpoint(const QString &devicePath, int openFd,
QStringLiteral("02") ||
!readHexU16(QDir(usbDevicePath).filePath(QStringLiteral("idVendor")), &vendorId) ||
!readHexU16(QDir(usbDevicePath).filePath(QStringLiteral("idProduct")), &productId) ||
vendorId != kTryxVendorId || productId != kPaseProductId) {
vendorId != kTryxVendorId ||
(productId != kPaseProductId && productId != kPanoProductId)) {
if (errorMessage) {
*errorMessage = QObject::tr("Endpoint %1 is not the expected 391a:1021 printer interface")
.arg(devicePath);
Expand Down Expand Up @@ -2141,7 +2146,8 @@ PrinterProtocol::DiscoverySnapshot PrinterProtocol::discover(const QString &sysf
countedUsbDevices.insert(usbPath);
if (productId == kTransitionProductId) {
++snapshot.rockchipGadgetDeviceCount;
} else if (productId == kPaseProductId) {
} else if (productId == kPaseProductId ||
productId == kPanoProductId) {
++snapshot.workingUsbDeviceCount;
}
}
Expand Down Expand Up @@ -2173,7 +2179,9 @@ PrinterProtocol::DiscoverySnapshot PrinterProtocol::discover(const QString &sysf
if (usbDevicePath.isEmpty() ||
!readHexU16(QDir(usbDevicePath).filePath(QStringLiteral("idVendor")), &vendorId) ||
!readHexU16(QDir(usbDevicePath).filePath(QStringLiteral("idProduct")), &productId) ||
vendorId != kTryxVendorId || productId != kPaseProductId) {
vendorId != kTryxVendorId ||
(productId != kPaseProductId &&
productId != kPanoProductId)) {
continue;
}

Expand Down