Closed peteruithoven closed 8 years ago
The application lsusb should be able to give more info about device on command, but this always gives me a segmentation fault.
Interesting information is added to logread log:
connecting arduino directly
Thu Jan 1 00:22:21 1970 kern.info kernel: [ 1341.320000] usb 1-1: new full-speed USB device number 5 using ehci-platform
Thu Jan 1 00:22:21 1970 kern.info kernel: [ 1341.490000] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
disconnecting arduino directly
Thu Jan 1 00:23:00 1970 kern.info kernel: [ 1380.470000] usb 1-1: USB disconnect, device number 5
connecting hub
Thu Jan 1 00:23:17 1970 kern.info kernel: [ 1397.470000] usb 1-1: new high-speed USB device number 6 using ehci-platform
Thu Jan 1 00:23:17 1970 kern.info kernel: [ 1397.630000] hub 1-1:1.0: USB hub found
Thu Jan 1 00:23:17 1970 kern.info kernel: [ 1397.630000] hub 1-1:1.0: 4 ports detected
connecting arduino to hub
Thu Jan 1 00:23:31 1970 kern.info kernel: [ 1411.940000] usb 1-1.4: new full-speed USB device number 7 using ehci-platform
Thu Jan 1 00:23:32 1970 kern.info kernel: [ 1412.060000] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
disconnecting hub, with arduino
Thu Jan 1 00:24:50 1970 kern.info kernel: [ 1490.540000] usb 1-1: USB disconnect, device number 6
Thu Jan 1 00:24:50 1970 kern.info kernel: [ 1490.540000] usb 1-1.4: USB disconnect, device number 7
connecting hub with arduino
Thu Jan 1 00:26:04 1970 kern.info kernel: [ 1564.760000] usb 1-1: new high-speed USB device number 8 using ehci-platform
Thu Jan 1 00:26:04 1970 kern.info kernel: [ 1564.920000] hub 1-1:1.0: USB hub found
Thu Jan 1 00:26:04 1970 kern.info kernel: [ 1564.920000] hub 1-1:1.0: 4 ports detected
Thu Jan 1 00:26:05 1970 kern.info kernel: [ 1565.210000] usb 1-1.4: new full-speed USB device number 9 using ehci-platform
Thu Jan 1 00:26:05 1970 kern.info kernel: [ 1565.330000] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
So we could for example look for the latest new full-speed USB device and check if 1-1.4 instead of 1-1 is before that.
Thu Jan 1 00:22:21 1970 kern.info kernel: [ 1341.320000] usb 1-1: new full-speed USB device number 5 using ehci-platform
vs:
Thu Jan 1 00:26:05 1970 kern.info kernel: [ 1565.210000] usb 1-1.4: new full-speed USB device number 9 using ehci-platform
This information can be found in the form of a directory tree in /sys/devices/platform/ehci-platform/usb1/1-1
(where usb1
is the so called 'root hub' and 1-1
is the device connected to the wifibox's usb port).
If the connected device is a hub and a printer is connected to it, this will be nested another level deeper.
The tree contains a lot of dynamic files as well, describing the device at hand. For instance: the file speed
will be 12 for a printer and 480 for a high-speed hub. This could be a first method of hub-detection (albeit a bit naive).
Nice.
usb1/speed
contains 480, with nothing, a high speed hub or the Ultimaker directly connected. So that's the port.
usb1/1-1/
appears when a device is connected.
usb1/1-1/speed
contains 480 with the high speed hub and 12 with the Ultimaker directly.
usb1/1-1/1-1.3/
appears when a Ultimaker is conntected.
usb1/1-1/1-1.3/speed
contains 12 with the Ultimaker connected.
less /sys/devices/platform/ehci-platform/usb1/speed
We should get our hands on a couple of different hubs and printers to test consistency.
Connecting the same Ultimaker to another hub gives usb1/1-1/1-1.4
. While both the hubs give 4 as maxchilds using:
/sys/devices/platform/ehci-platform/usb1/1-1/maxchild
So basically we could indeed give the warning when /sys/devices/platform/ehci-platform/usb1/1-1/speed
doesn't contain 480.
Started a branch, api check is implemented. https://github.com/Doodle3D/doodle3d-firmware/tree/hubcheck
I opened a separate issue for the client side of this issue: https://github.com/Doodle3D/doodle3d-client/issues/51
Should probably add this info to general info/status api response. To prevent an extra request.
You don't need to connect a USB hub anymore since recent versions of the Doodle3D firmware.
People can easily forget to use the hub, or they might not understand why it's important. It would be nice to warn people when they are connecting the printer without the hub.
I would not disable the use of the printer unless we are 100% sure all printer and hub types are properly handled by this check.