hubaiz / DslrDashboardServer

DslrDashboard Server for OpenWrt
GNU General Public License v3.0
160 stars 60 forks source link

Error reading total packet size: -1 #25

Open cipi1965 opened 6 years ago

cipi1965 commented 6 years ago

Hi, I'm trying to connect my Canon EOS 1300D camera to ddserver using an Easy-Link based on OpenWrt Barrier Breaker r40555.

Here's the log:


Thu Dec  1 14:06:00 2016 user.info syslog: Incoming client connection
Thu Dec  1 14:06:00 2016 user.info syslog: Awaiting client connection
Thu Dec  1 14:06:00 2016 user.info syslog: USB Devices in
Thu Dec  1 14:06:00 2016 user.info syslog: Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12980
Thu Dec  1 14:06:00 2016 user.info syslog: Number of alternate settings:
Thu Dec  1 14:06:00 2016 user.info syslog: Interface class: 6 Interface number: 0 Number of endpoints: 3
Thu Dec  1 14:06:00 2016 user.info syslog: Found USB imaging device, get vendor and product
Thu Dec  1 14:06:00 2016 user.info syslog: Device Manufacturer: Canon Inc.
Thu Dec  1 14:06:00 2016 user.info syslog: Device Product: Canon Digital Camera
Thu Dec  1 14:06:00 2016 user.info syslog: Number of possible configurations: 1 Device Class: 9 VendorID: 7531, ProductID: 2
Thu Dec  1 14:06:00 2016 user.info syslog: Number of alternate settings:
Thu Dec  1 14:06:00 2016 user.info syslog: Interface class: 9 Interface number: 0 Number of endpoints: 1
Thu Dec  1 14:06:00 2016 user.info syslog: Imaging USB devices found: 1
Thu Dec  1 14:06:00 2016 user.info syslog: USB Devices in
Thu Dec  1 14:06:00 2016 user.info syslog: Checking device with vendorId: 04a9  and productId: 32b4
Thu Dec  1 14:06:00 2016 user.info syslog: Trying to open device
Thu Dec  1 14:06:00 2016 user.info syslog: Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12980
Thu Dec  1 14:06:00 2016 user.info syslog: Number of alternate settings:
Thu Dec  1 14:06:00 2016 user.info syslog: Interface class: 6 Interface number: 0 Number of endpoints: 3
Thu Dec  1 14:06:00 2016 user.info syslog: Found USB imaging device, get vendor and product
Thu Dec  1 14:06:00 2016 user.info syslog: Device  open success
Thu Dec  1 14:06:00 2016 user.info syslog: USB device opened
Thu Dec  1 14:06:00 2016 user.info syslog: Read endpoint adress: 129
Thu Dec  1 14:06:00 2016 user.info syslog: Write endpoint adress: 2
Thu Dec  1 14:06:00 2016 user.info syslog: USB interface claimed
Thu Dec  1 14:06:00 2016 user.info syslog: vendor: 1193 product: 12980
Thu Dec  1 14:06:00 2016 user.info syslog: vendor: 43268 product: 46130
Thu Dec  1 14:06:10 2016 user.err syslog: Error reading total packet size: -1
Thu Dec  1 14:06:10 2016 user.err syslog: Stoping client
Thu Dec  1 14:06:12 2016 user.info syslog: Closing USB device
Thu Dec  1 14:06:12 2016 user.info syslog: USB interface released
hubaiz commented 6 years ago

Is that a MR3040 with a mode switch? If yes then is the mode switch set to AP mode? How long is your USB cable? Can you try another USB cable?

cipi1965 commented 6 years ago

No, is not a MR3040, the device is set to AP mode, the cable in soldered to the device and is like 10cm

hubaiz commented 6 years ago

You could add some more debug info to see where is the problem. Also check your soldering and cable shielding. Eventually try with a powered USB hub.

cipi1965 commented 6 years ago

It is not a connection problem, it works with my other camera (Canon EOS 1200D) but not with 1300D, what type of debug infos?

cipi1965 commented 6 years ago

@hubaiz have you any ideas?

parkerlreed commented 3 years ago

Seeing a similar issue with tacked on USB to a GL.iNet USB150

Good quality cable but since it's tacked on I don't have the inline resistors for the data lines.

Will update as I can test more.

IMG_20201229_211647

Tue Dec 29 00:35:37 2020 user.info : Incoming client connection
Tue Dec 29 00:35:37 2020 user.info : Awaiting client connection
Tue Dec 29 00:35:37 2020 user.info : USB Devices in
Tue Dec 29 00:35:37 2020 user.info : Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12927
Tue Dec 29 00:35:37 2020 user.info : Number of alternate settings:
Tue Dec 29 00:35:37 2020 user.info : Interface class: 6 Interface number: 0 Number of endpoints: 3
Tue Dec 29 00:35:37 2020 user.info : Found USB imaging device, get vendor and product
Tue Dec 29 00:35:37 2020 user.info : Device Manufacturer: Canon Inc.
Tue Dec 29 00:35:37 2020 user.info : Device Product: Canon Digital Camera
Tue Dec 29 00:35:37 2020 user.info : Number of possible configurations: 1 Device Class: 9 VendorID: 7531, ProductID: 2
Tue Dec 29 00:35:37 2020 user.info : Number of alternate settings:
Tue Dec 29 00:35:37 2020 user.info : Interface class: 9 Interface number: 0 Number of endpoints: 1
Tue Dec 29 00:35:37 2020 user.info : Imaging USB devices found: 1
Tue Dec 29 00:35:37 2020 user.err : Error reading total packet size: 0
Tue Dec 29 00:35:37 2020 user.err : Stoping client
Tue Dec 29 00:35:37 2020 user.info : Incoming client connection
Tue Dec 29 00:35:37 2020 user.info : Awaiting client connection
Tue Dec 29 00:35:37 2020 user.info : USB Devices in
Tue Dec 29 00:35:37 2020 user.info : Checking device with vendorId: 04a9  and productId: 327f
Tue Dec 29 00:35:37 2020 user.info : Trying to open device
Tue Dec 29 00:35:37 2020 user.info : Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12927
Tue Dec 29 00:35:37 2020 user.info : Number of alternate settings:
Tue Dec 29 00:35:37 2020 user.info : Interface class: 6 Interface number: 0 Number of endpoints: 3
Tue Dec 29 00:35:37 2020 user.info : Found USB imaging device, get vendor and product
Tue Dec 29 00:35:37 2020 user.info : Device  open success
Tue Dec 29 00:35:37 2020 user.info : USB device opened
Tue Dec 29 00:35:37 2020 user.info : Read endpoint adress: 129 max pSize 512
Tue Dec 29 00:35:37 2020 user.info : Write endpoint adress: 2 max pSize 512
Tue Dec 29 00:35:37 2020 user.info : Interrupt endpoint address: 131 max pSize 8
Tue Dec 29 00:35:37 2020 user.info : USB interface claimed
Tue Dec 29 00:35:37 2020 user.info : vendor: 1193 product: 12927
Tue Dec 29 00:35:37 2020 user.info : vendor: 43268 product: 32562
Tue Dec 29 00:35:39 2020 user.info : Closing USB device
Tue Dec 29 00:36:37 2020 kern.info kernel: [  856.460204] do_page_fault(): sending SIGSEGV to ddserver for invalid write access to 00000000
parkerlreed commented 3 years ago

@hubaiz Does ddserver depend on little-endian?

Tue Dec 29 00:35:37 2020 user.info : vendor: 1193 product: 12927
Tue Dec 29 00:35:37 2020 user.info : vendor: 43268 product: 32562

AR9331 has big endian addressing. Been wracking my head against this and that's the only thing I can think of causing the soft lock (The segfault was me power cycling the camera)

parkerlreed commented 3 years ago

For comparison a working log from Ralink RT5350

Fri Nov 15 20:31:43 2019 user.info : Incoming client connection
Fri Nov 15 20:31:43 2019 user.info : Awaiting client connection
Fri Nov 15 20:31:43 2019 user.info : USB Devices in
Fri Nov 15 20:31:43 2019 user.info : Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12927
Fri Nov 15 20:31:43 2019 user.info : Number of alternate settings:
Fri Nov 15 20:31:43 2019 user.info : Interface class: 6 Interface number: 0 Number of endpoints: 3
Fri Nov 15 20:31:43 2019 user.info : Found USB imaging device, get vendor and product
Fri Nov 15 20:31:43 2019 user.info : Device Manufacturer: Canon Inc.
Fri Nov 15 20:31:43 2019 user.info : Device Product: Canon Digital Camera
Fri Nov 15 20:31:43 2019 user.info : Number of possible configurations: 1 Device Class: 9 VendorID: 7531, ProductID: 2
Fri Nov 15 20:31:43 2019 user.info : Number of alternate settings:
Fri Nov 15 20:31:43 2019 user.info : Interface class: 9 Interface number: 0 Number of endpoints: 1
Fri Nov 15 20:31:43 2019 user.info : Imaging USB devices found: 1
Fri Nov 15 20:31:43 2019 user.err : Error reading total packet size: 0
Fri Nov 15 20:31:43 2019 user.err : Stoping client
Fri Nov 15 20:31:43 2019 user.info : Incoming client connection
Fri Nov 15 20:31:43 2019 user.info : Awaiting client connection
Fri Nov 15 20:31:43 2019 user.info : USB Devices in
Fri Nov 15 20:31:43 2019 user.info : Checking device with vendorId: 04a9  and productId: 327f
Fri Nov 15 20:31:43 2019 user.info : Trying to open device
Fri Nov 15 20:31:43 2019 user.info : Number of possible configurations: 1 Device Class: 0 VendorID: 1193, ProductID: 12927
Fri Nov 15 20:31:43 2019 user.info : Number of alternate settings:
Fri Nov 15 20:31:43 2019 user.info : Interface class: 6 Interface number: 0 Number of endpoints: 3
Fri Nov 15 20:31:43 2019 user.info : Found USB imaging device, get vendor and product
Fri Nov 15 20:31:43 2019 user.info : Device  open success
Fri Nov 15 20:31:43 2019 user.info : USB device opened
Fri Nov 15 20:31:43 2019 user.info : Read endpoint adress: 129
Fri Nov 15 20:31:43 2019 user.info : Write endpoint adress: 2
Fri Nov 15 20:31:43 2019 user.info : Interrupt endpoint address: 131
Fri Nov 15 20:31:43 2019 user.info : USB interface claimed
Fri Nov 15 20:31:43 2019 user.info : vendor: 1193 product: 12927
Fri Nov 15 20:31:43 2019 user.info : vendor: 1193 product: 12927
Fri Nov 15 20:31:45 2019 user.info : Closing USB device
#Camera is connected and working here with qDSLRDash
parkerlreed commented 3 years ago

The communication seems to make heavy use of htole16, which on big endian is a wrong value (please correct me if I'm way misunderstanding this)


[parker@wolfcola DslrDashboardServer]$ grep -r htole16 .
./src/communicator.cpp: *(uint16_t *)&buf[4] = htole16(DDS_MAJOR);
./src/communicator.cpp: *(uint16_t *)&buf[6] = htole16(DDS_MINOR);
./src/communicator.cpp: ptpPacket->packet_type = htole16(packetType);
./src/communicator.cpp: ptpPacket->packet_command = htole16(packetCommand);
./src/communicator.cpp://       ptpPacket->packet_type = htole16(0x0003);
./src/communicator.cpp://       ptpPacket->packet_command = htole16(responseCode);
./src/communicator.cpp:         *(uint16_t *)&buf[4 + PTP_HEADER] = htole16(mVendorId);
./src/communicator.cpp:         *(uint16_t *)&buf[4 + PTP_HEADER + 2] = htole16(mProductId);
./src/communicator.cpp:         syslog(LOG_INFO, "vendor: %d product: %d", htole16(mVendorId), htole16(mProductId));
./src/communicator.cpp:         *(uint16_t *)&buf[offset] = htole16(imgUsbDevices.size());
./src/communicator.cpp:                 *(uint16_t *)&buf[offset] = htole16(usbDevice->iVendorId);
./src/communicator.cpp:                 *(uint16_t *)&buf[offset + 2] = htole16(usbDevice->iProductId);```