skudi / transfolio

File transfer program for Atari Portfolio and Linux/Windows machines (with centronics port) and RaspberryPi (via gpio). Created by Klaus Peichl.
22 stars 4 forks source link

Might be a stupid question but #4

Open CBusse opened 2 years ago

CBusse commented 2 years ago

I have a problem trying to get transfolio to open the usb parallel port I have.

debug log with strace:

execve("./transfolio", ["./transfolio", "-d", "/dev/usb/lp0", "-l", "c:\\"], 0x7fff0c22b600 /* 20 vars */) = 0
brk(NULL)                               = 0x55d235b24000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fffe98819d0) = -1 EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1813d7e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=22135, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 22135, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1813d78000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\237\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0i8\235HZ\227\223\333\350s\360\352,\223\340."..., 68, 896) = 68
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2216304, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1813b50000
mmap(0x7f1813b78000, 1658880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f1813b78000
mmap(0x7f1813d0d000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f1813d0d000
mmap(0x7f1813d65000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x214000) = 0x7f1813d65000
mmap(0x7f1813d6b000, 52816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1813d6b000
close(3)                                = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1813b4d000
arch_prctl(ARCH_SET_FS, 0x7f1813b4d740) = 0
set_tid_address(0x7f1813b4da10)         = 1297
set_robust_list(0x7f1813b4da20, 24)     = 0
rseq(0x7f1813b4e0e0, 0x20, 0, 0x53053053) = 0
mprotect(0x7f1813d65000, 16384, PROT_READ) = 0
mprotect(0x55d2358e4000, 4096, PROT_READ) = 0
mprotect(0x7f1813db8000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7f1813d78000, 22135)           = 0
newfstatat(1, "", {st_mode=S_IFREG|0644, st_size=2440, ...}, AT_EMPTY_PATH) = 0
getrandom("\x29\x2e\x73\x67\x91\x2f\x08\x6a", 8, GRND_NONBLOCK) = 8
brk(NULL)                               = 0x55d235b24000
brk(0x55d235b45000)                     = 0x55d235b45000
openat(AT_FDCWD, "/dev/usb/lp0", O_RDWR) = 3
write(2, "Waiting for /dev/usb/lp0 to beco"..., 48Waiting for /dev/usb/lp0 to become available...^M) = 48
ioctl(3, PPCLAIM, 0)                    = -1 ENOTTY (Inappropriate ioctl for device)
write(2, "PPCLAIM: Inappropriate ioctl for"..., 40PPCLAIM: Inappropriate ioctl for device
) = 40
close(3)                                = 0
write(2, "Try 'fuser -m /dev/usb/lp0' to s"..., 70Try 'fuser -m /dev/usb/lp0' to see if other processes use the device.
) = 70
write(2, "Cannot open parallel port!\n", 27Cannot open parallel port!
) = 27
write(1, "Transfolio 1.0.1 - (c) 2018 by K"..., 44Transfolio 1.0.1 - (c) 2018 by Klaus Peichl
) = 44
exit_group(1)                           = ?
+++ exited with 1 +++

So I got to the point that the adapter is visible in linux

Bus 001 Device 003: ID 1a86:7584 QinHeng Electronics CH340S
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x1a86 QinHeng Electronics
  idProduct          0x7584 CH340S
  bcdDevice            2.54
  iManufacturer           0
  iProduct                2 USB2.0-Print
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x004e
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      1 Unidirectional
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       2
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol    255
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

the exact output while running is

Waiting for /dev/usb/lp0 to become available... PPCLAIM: Inappropriate ioctl for device Try 'fuser -m /dev/usb/lp0' to see if other processes use the device. Cannot open parallel port! Transfolio 1.0.1 - (c) 2018 by Klaus Peichl

fuser -vm /dev/usb/lp0 shows

                     USER        PID ACCESS COMMAND
/dev/usb/lp0:        root     kernel mount /dev
                     root         19 .rc.. kdevtmpfs

what am I missing, why is this a blocking issue?

there should be nothing accessing lp0 at the moment here, no idea why tmpfs is locking this

opless commented 7 months ago

USB Printer ports don't have the same 'flexibility' as ye olde LPT ports, so the tricks that were used for those, can't be used on the USB devices, sadly