ASI120MM on Linux (my report on RPi3/INDI)

any question related to our SDK and driver

Moderators: yang, ray, chad

Re: ASI120MM on Linux (my report on RPi3/INDI)

Postby Kuster » Sun Jan 14, 2018 8:29 am

kcobby wrote:I use chained RPI 3's running headless Ubuntu Mate. Allowed me to install Ekos on each via the ppa. You could check to see if the USB max output current is set to 1.2A, some may be set to 0.6A which is too low for the ASI120MM. If you have other USB powered devices shwring the current on the same RPI you may need to add a powered hub to provide the ASI120MM with enough current.


Hi Cobby, how do you check to see the output is 1.2A or not?
Kuster
 
Posts: 1
Joined: Tue Jan 09, 2018 8:09 am

Re: ASI120MM on Linux (my report on RPi3/INDI)

Postby chad » Thu Jan 25, 2018 7:48 am

Hi kcobby,
Please use Google to search “max_usb_current”.
I found some Chinese information, and they said that you can adjust the maximum current of USB by setting this value in config.txt.
Here is a discussion:
https://raspberrypi.stackexchange.com/q ... a-bad-idea
But I'm not sure. I haven't tested it either. So please be careful if you want to test it.
Thanks
chad
ZWO Driver Engineer
Location:lon=120.6 lat=31.3
SuZhou China
User avatar
chad
 
Posts: 233
Joined: Thu Feb 09, 2017 4:58 am

Re: ASI120MM on Linux (my report on RPi3/INDI)

Postby bacila » Tue Apr 17, 2018 8:26 pm

Hello,

chripell wrote:Ah, I see. With the compatible firmware I've never ever got a good frame in 16 bit even on a i7 laptop :-( I use the old ASI Camera for guiding so 8 bit is OK and it works. I think the limitation about maxPacketSize is because of BadUSB attacks. Here is a patch to work around it (but then, I decided to go with compatible firmware mode to avoid the hassle of recompiling my kernels because I use it only for guiding):

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index a2d90ac..107635d 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -349,10 +349,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];

if (maxp > j) {
- dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n",
+ dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d (IGNORED!)\n",
cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
+#if 0
maxp = j;
endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
+#endif
}

/*


Can someone suggest what else is required to be patched to get ASI 120MM working on a recent 4.x kernel with USB 3.0 host (xhci_hcd). The above patch with some modifications works only, when camera is connected to the USB 2.0 host (ehci-pci). If I connect camera to Thinkpad 13, I see the following in the log after I try to connect to camera:

Apr 17 23:17:17 tp13 kernel: [ 2132.027992] usb 1-1: reset high-speed USB device number 8 using xhci_hcd
Apr 17 23:17:18 tp13 kernel: [ 2132.192849] usb usb1-port1: disabled by hub (EMI?), re-enabling...
Apr 17 23:17:18 tp13 kernel: [ 2132.192869] usb 1-1: USB disconnect, device number 8
Apr 17 23:17:18 tp13 kernel: [ 2132.459165] usb 1-1: new high-speed USB device number 9 using xhci_hcd
Apr 17 23:17:18 tp13 kernel: [ 2132.601247] usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x82 has invalid maxpacket 1024, setting to 512 (IGNORED!) <<< --- This is message from the patch, so patched kernel seems to be active
Apr 17 23:17:18 tp13 kernel: [ 2132.601257] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 1024
Apr 17 23:17:18 tp13 kernel: [ 2132.602004] usb 1-1: New USB device found, idVendor=03c3, idProduct=120a
Apr 17 23:17:18 tp13 kernel: [ 2132.602013] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 17 23:17:18 tp13 kernel: [ 2132.602020] usb 1-1: Product: ASI120MM
Apr 17 23:17:18 tp13 kernel: [ 2132.602026] usb 1-1: Manufacturer: ZWOptical company


Application displays connection timeout and I usually have to replug camera to get it recognized. Same errors were occurring on a computer with 2.0 USB host before patch was applied and kernel recompiled.

Slightly updated patch for 4.13 kernel (line numbers changed):
Code: Select all
--- config.c.ORIG   2018-03-14 19:48:11.000000000 +0200
+++ config.c   2018-04-16 19:45:24.538599024 +0300
@@ -374,10 +374,12 @@
    j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];
 
    if (maxp > j) {
-      dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n",
+      dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d (IGNORED!)\n",
           cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
+      #if 0
       maxp = j;
       endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
+      #endif
    }
 
    /*


I would like not to downgrade firmware and loose longer exposure abilities. A specific patched kernel used only during image capture sessions seems to be a good compromise.

Thank you
bacila
 
Posts: 1
Joined: Tue Apr 17, 2018 8:07 pm

Previous

Return to SDK & Driver

Who is online

Users browsing this forum: No registered users and 1 guest