Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modification needed for Peaberry V2 SDR #1

Open
csylvain opened this issue Feb 19, 2019 · 0 comments
Open

modification needed for Peaberry V2 SDR #1

csylvain opened this issue Feb 19, 2019 · 0 comments

Comments

@csylvain
Copy link

csylvain commented Feb 19, 2019

the following patch adds a little more helpful debugging info when "-vv" is used, and tries to connect to "Peaberry SDR" if it doesn't find "DG8SAQ-I2C".
it is also worth noting the original Google Code repository for usbsoftrock is now defunct. this repository is the one i found with the most recent commit dates. thank you for keeping this one available!

diff --git a/operations.c b/operations.c
index 93c4bf2..32a6d71 100644
--- a/operations.c
+++ b/operations.c
@@ -129,7 +129,7 @@ unsigned char usbOpenDevice(usb_dev_handle **device, int vendor, char *vendorNam
           fprintf(stderr, "Warning: cannot query manufacturer for device: %s\n", usb_strerror());
         }else{
           errorCode = USB_ERROR_NOTFOUND;
-           //fprintf(stderr, "seen device from vendor ->%s<-\n", string); 
+          if (verbose>1) fprintf(stderr, "seen device from vendor ->%s<-\n", string); 
           if(strcmp(string, vendorName) == 0){
             len = usbGetStringAscii(handle, dev->descriptor.iProduct, 0x0409, string, sizeof(string));
             if(len < 0){
@@ -137,7 +137,7 @@ unsigned char usbOpenDevice(usb_dev_handle **device, int vendor, char *vendorNam
               fprintf(stderr, "Warning: cannot query product for device: %s\n", usb_strerror());
             }else{
               errorCode = USB_ERROR_NOTFOUND;
-               //fprintf(stderr, "seen product ->%s<-\n", string); 
+              if (verbose>1) fprintf(stderr, "seen product ->%s<-\n", string); 
               if(strcmp(string, productName) == 0) {
 		len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber, 0x0409, serialNumberString, sizeof(serialNumberString));
 		if (len < 0) {
@@ -145,6 +145,7 @@ unsigned char usbOpenDevice(usb_dev_handle **device, int vendor, char *vendorNam
 		  fprintf(stderr, "Warning: cannot query serial number for device: %s\n", usb_strerror());
 		}else{
 		  errorCode = USB_ERROR_NOTFOUND;
+		  if (verbose>1) fprintf(stderr, "seen S/N ->%s<-\n", serialNumberString);
 		  if ((usbSerialID == NULL) || (strcmp(serialNumberString, usbSerialID) == 0)) {
 		    break;
 		  }
diff --git a/usbsoftrock.c b/usbsoftrock.c
index 1fa7f6b..171f992 100755
--- a/usbsoftrock.c
+++ b/usbsoftrock.c
@@ -72,7 +72,8 @@
 double multiplier = 4;
 
 #define VENDOR_NAME			"www.obdev.at"
-#define PRODUCT_NAME			"DG8SAQ-I2C"
+#define PRODUCT_NAME1			"DG8SAQ-I2C"
+#define PRODUCT_NAME2			"Peaberry SDR"
 
 extern char    serialNumberString[256];
 
@@ -259,10 +260,15 @@ int main(int argc, char **argv) {
   char attempt=0, error=0;
   do {
 	attempt++;
-	error=usbOpenDevice(&handle, USBDEV_SHARED_VENDOR, VENDOR_NAME, USBDEV_SHARED_PRODUCT, PRODUCT_NAME, usbSerialID);
+	error=usbOpenDevice(&handle, USBDEV_SHARED_VENDOR, VENDOR_NAME, USBDEV_SHARED_PRODUCT, PRODUCT_NAME1, usbSerialID);
 	if(error != 0){
-	  fprintf(stderr, "Could not open USB device \"%s\" with vid=0x%x pid=0x%x, retrying\n", PRODUCT_NAME, USBDEV_SHARED_VENDOR, USBDEV_SHARED_PRODUCT);
-	  sleep(2*attempt);
+	  if (verbose) fprintf(stderr, "Did not find USB \"%s\" device, trying \"%s\"\n", PRODUCT_NAME1, PRODUCT_NAME2);
+	  error=usbOpenDevice(&handle, USBDEV_SHARED_VENDOR, VENDOR_NAME, USBDEV_SHARED_PRODUCT, PRODUCT_NAME2, usbSerialID);
+	  if(error != 0){
+	    if (verbose) fprintf(stderr, "Found USB \"%s\" device\n", PRODUCT_NAME2);
+	    fprintf(stderr, "Could not open USB Si570 device with vid=0x%x pid=0x%x, retrying\n", USBDEV_SHARED_VENDOR, USBDEV_SHARED_PRODUCT);
+	    sleep(2*attempt);
+	  }
 	}
   } while (error && attempt < USB_MAX_RETRIES);
   if (error) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant