Import basic rbox driver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
diff --git a/cgminer.c b/cgminer.c
index 6d45fca..620423b 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -208,6 +208,7 @@ static bool no_work;
char *opt_icarus_options = NULL;
char *opt_icarus_timing = NULL;
float opt_anu_freq = 200;
+float opt_rock_freq = 270;
#endif
bool opt_worktime;
#ifdef USE_AVALON
@@ -9011,6 +9012,20 @@ static void adjust_mostdevs(void)
most_devices = total_devices - zombie_devs;
}
+#ifdef USE_ICARUS
+bool icarus_get_device_id(struct cgpu_info *cgpu)
+{
+ static struct _cgpu_devid_counter *devids = NULL;
+ struct _cgpu_devid_counter *d;
+
+ HASH_FIND_STR(devids, cgpu->drv->name, d);
+ if (d)
+ return (d->lastid + 1);
+ else
+ return 0;
+}
+#endif
+
bool add_cgpu(struct cgpu_info *cgpu)
{
static struct _cgpu_devid_counter *devids = NULL;
diff --git a/driver-icarus.c b/driver-icarus.c
index 8bae1ca..d2f2be4 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -50,6 +50,8 @@
#include "miner.h"
#include "usbutils.h"
+#define ROCKMINER
+#define ROCKMINER_PRINT_DEBUG 0
// The serial I/O speed - Linux uses a define 'B115200' in bits/termios.h
#define ICARUS_IO_SPEED 115200
@@ -57,6 +59,7 @@
// The size of a successful nonce read
#define ANT_READ_SIZE 5
#define ICARUS_READ_SIZE 4
+#define ROCK_READ_SIZE 8
// Ensure the sizes are correct for the Serial read
#if (ICARUS_READ_SIZE != 4)
@@ -272,6 +275,84 @@ struct ICARUS_WORK {
uint8_t work[ICARUS_WORK_SIZE];
};
+#define MAX_DEVICE_NUM 100
+#define MAX_WORK_BUFFER_SIZE 2
+#define MAX_CHIP_NUM 24
+#define NONCE_CORRECTION_TIMES 3
+#define MAX_TRIES 4
+//#define NONCE_TEST
+#define RM_CMD_MASK 0x0F
+#define RM_STATUS_MASK 0xF0
+#define RM_CHIP_MASK 0x3F
+#define RM_PRODUCT_MASK 0xC0
+#define RM_PRODUCT_RBOX 0x00
+#define RM_PRODUCT_T1 0x10
+
+#ifdef NONCE_TEST
+int device_nonce_conunts[MAX_DEVICE_NUM];
+int chip_nonce_conunts[MAX_CHIP_NUM];
+int chip_work_conunts[MAX_CHIP_NUM];
+int device_nonce_corr_ok_1[MAX_DEVICE_NUM];
+int device_nonce_corr_ok[MAX_DEVICE_NUM];
+int device_nonce_corr_fail[MAX_DEVICE_NUM];
+int device_nonce_corr_fail_2[MAX_DEVICE_NUM];
+#endif
+
+typedef enum {
+ NONCE_DATA1_OFFSET= 0,
+ NONCE_DATA2_OFFSET,
+ NONCE_DATA3_OFFSET,
+ NONCE_DATA4_OFFSET,
+ NONCE_TASK_CMD_OFFSET,
+ NONCE_CHIP_NO_OFFSET,
+ NONCE_TASK_NO_OFFSET,
+ NONCE_COMMAND_OFFSET,
+ NONCE_MAX_OFFSET
+} NONCE_OFFSET;
+
+typedef enum {
+ NONCE_DATA_CMD= 0,
+ NONCE_TASK_COMPLETE_CMD,
+ NONCE_GET_TASK_CMD,
+} NONCE_COMMAND;
+
+typedef struct NONCE_DATA
+{
+int chip_no ;
+unsigned int task_no ;
+unsigned char work_state;
+int cmd_value;
+}NONCE_DATA;
+
+
+
+typedef enum {
+ ROCKMINER_RBOX= 0,
+ ROCKMINER_T1,
+ ROCKMINER_MAX
+} ROCKMINER_PRODUCT_T;
+
+typedef struct ROCKMINER_CHIP_INFO
+{
+unsigned char freq;
+int error_cnt;
+time_t last_received_task_complete_time;
+}ROCKMINER_CHIP_INFO;
+
+typedef struct ROCKMINER_DEVICE_INFO
+{
+unsigned char detect_chip_no;
+unsigned char chip_max;
+unsigned char product_id;
+float min_frq;
+float def_frq;
+float max_frq;
+ROCKMINER_CHIP_INFO chip[MAX_CHIP_NUM];
+time_t dev_detect_time;
+}ROCKMINER_DEVICE_INFO;
+
+ROCKMINER_DEVICE_INFO rmdev[MAX_DEVICE_NUM];
+
#define END_CONDITION 0x0000ffff
// Looking for options in --icarus-timing and --icarus-options:
@@ -955,6 +1036,46 @@ static bool set_anu_freq(struct cgpu_info *icarus, struct ICARUS_INFO *info)
return true;
}
+static void rock_init_last_received_task_complete_time(uint32_t dev_id)
+{
+ int i;
+ if(opt_rock_freq<rmdev[dev_id].min_frq||(opt_rock_freq>rmdev[dev_id].max_frq))
+ opt_rock_freq =rmdev[dev_id].def_frq;
+ for (i = 0; i < MAX_CHIP_NUM; ++i)
+ {
+ rmdev[dev_id].chip[i].last_received_task_complete_time = time(NULL);
+ rmdev[dev_id].chip[i].freq = opt_rock_freq/10 - 1;
+ rmdev[dev_id].chip[i].error_cnt= 0;
+ }
+ rmdev[dev_id].dev_detect_time = time(NULL);
+}
+
+struct work *g_work[MAX_DEVICE_NUM][MAX_CHIP_NUM][MAX_WORK_BUFFER_SIZE];
+
+void clear_chip_busy(int device_id)
+{
+ memset(&(g_work[device_id][0]), 0, (sizeof(g_work)/MAX_DEVICE_NUM));
+}
+
+void rock_print_work_data(struct ICARUS_WORK *p_workdata)
+{
+ char *ob_hex = NULL;
+ opt_debug = ROCKMINER_PRINT_DEBUG;
+ if (opt_debug) {
+ ob_hex = bin2hex((void *)(p_workdata), sizeof(*p_workdata));
+ applog(LOG_WARNING, "sent %s", ob_hex);
+ free(ob_hex);
+
+ rev((void *)(&(p_workdata->midstate)), ICARUS_MIDSTATE_SIZE);
+ rev((void *)(&(p_workdata->work)), ICARUS_WORK_SIZE);
+ ob_hex = bin2hex((void *)(p_workdata), sizeof(*p_workdata));
+ applog(LOG_WARNING, "revert sent %s", ob_hex);
+ free(ob_hex);
+ }
+}
+
+bool icarus_get_device_id(struct cgpu_info *cgpu);
+
static struct cgpu_info *icarus_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
{
int this_option_offset = ++option_offset;
@@ -1218,9 +1339,299 @@ shin:
return NULL;
}
+static int64_t rock_scanwork(struct thr_info *thr);
+
+static struct cgpu_info *rock_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
+{
+ int this_option_offset = ++option_offset;
+ struct ICARUS_INFO *info;
+ struct timeval tv_start, tv_finish;
+ int opt_debug = ROCKMINER_PRINT_DEBUG;
+ char *ob_hex = NULL;
+
+ // Block 171874 nonce = (0xa2870100) = 0x000187a2
+ // N.B. golden_ob MUST take less time to calculate
+ // than the timeout set in icarus_open()
+ // This one takes ~0.53ms on Rev3 Icarus
+ const char golden_ob[] =
+ "4679ba4ec99876bf4bfe086082b40025"
+ "4df6c356451471139a3afa71e48f544a"
+ "00000000000000000000000000000000"
+ "aa1ff05587320b1a1426674f2fa722ce";
+
+ const char golden_nonce[] = "000187a2";
+ const uint32_t golden_nonce_val = 0x000187a2;
+ unsigned char nonce_bin[ROCK_READ_SIZE];
+ struct ICARUS_WORK workdata;
+ char *nonce_hex;
+ int baud, uninitialised_var(work_division), uninitialised_var(fpga_count);
+ struct cgpu_info *icarus;
+ int ret, err, amount, tries, i;
+ bool ok;
+ bool cmr2_ok[CAIRNSMORE2_INTS];
+ bool anu_freqset = false;
+ int cmr2_count;
+ int correction_times = 0;
+ #if (NONCE_CORRECTION_TIMES == 9)
+ int32_t correction_value[] = {0, 1, -1, 2, -2, 3, -3, 4, -4};
+ #endif
+#if (NONCE_CORRECTION_TIMES == 3)
+ int32_t correction_value[] = {0, 1, -1};
+#endif
+ NONCE_DATA nonce_data;
+
+ uint32_t nonce;
+ //int cmd_value = 0;
+ int chip_no;
+ int dev_id;
+
+ if ((sizeof(workdata) << 1) != (sizeof(golden_ob) - 1))
+ quithere(1, "Data and golden_ob sizes don't match");
+
+ icarus = usb_alloc_cgpu(&icarus_drv, 1);
+ icarus->drv->scanwork = rock_scanwork;
+ icarus->drv->dname = "Rockminer";
+ icarus->drv->name = "LIN";
+
+ if (!usb_init(icarus, dev, found))
+ goto shin;
+
+ get_options(this_option_offset, icarus, &baud, &work_division, &fpga_count);
+
+#ifdef WIN32
+ dev_id =icarus_get_device_id(icarus);
+#else
+ dev_id =icarus->device_id;
+#endif
+
+ hex2bin((void *)(&workdata), golden_ob, sizeof(workdata));
+#ifdef ROCKMINER
+ rev((void *)(&(workdata.midstate)), ICARUS_MIDSTATE_SIZE);
+ rev((void *)(&(workdata.work)), ICARUS_WORK_SIZE);
+#endif
+ opt_debug = ROCKMINER_PRINT_DEBUG;
+ if (opt_debug) {
+ ob_hex = bin2hex((void *)(&workdata), sizeof(workdata));
+ applog(LOG_WARNING, "%s%d: send_gold_nonce %s",
+ icarus->drv->name, icarus->device_id, ob_hex);
+ free(ob_hex);
+ }
+
+ info = (struct ICARUS_INFO *)calloc(1, sizeof(struct ICARUS_INFO));
+ if (unlikely(!info))
+ quit(1, "Failed to malloc ICARUS_INFO");
+ (void)memset(info, 0, sizeof(struct ICARUS_INFO));
+ icarus->device_data = (void *)info;
+
+ info->ident = usb_ident(icarus);
+ switch (info->ident) {
+ case IDENT_ICA:
+ case IDENT_BLT:
+ case IDENT_LLT:
+ case IDENT_AMU:
+ case IDENT_CMR1:
+ info->timeout = ICARUS_WAIT_TIMEOUT;
+ break;
+ case IDENT_ANU:
+ info->timeout = ANT_WAIT_TIMEOUT;
+ break;
+ case IDENT_CMR2:
+ if (found->intinfo_count != CAIRNSMORE2_INTS) {
+ quithere(1, "CMR2 Interface count (%d) isn't expected: %d",
+ found->intinfo_count,
+ CAIRNSMORE2_INTS);
+ }
+ info->timeout = ICARUS_CMR2_TIMEOUT;
+ cmr2_count = 0;
+ for (i = 0; i < CAIRNSMORE2_INTS; i++)
+ cmr2_ok[i] = false;
+ break;
+ default:
+ quit(1, "%s icarus_detect_one() invalid %s ident=%d",
+ icarus->drv->dname, icarus->drv->dname, info->ident);
+ }
+
+ info->nonce_size = ROCK_READ_SIZE;
+// For CMR2 test each USB Interface
+
+cmr2_retry:
+
+ tries = MAX_TRIES;
+ ok = false;
+ while (!ok && tries-- > 0) {
+ icarus_initialise(icarus, baud);
+
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "tries: %d", tries);
+ #endif
+ workdata.unused[ICARUS_UNUSED_SIZE - 3] = opt_rock_freq/10 - 1;
+ workdata.unused[ICARUS_UNUSED_SIZE - 2] = (MAX_TRIES-1-tries);
+ rmdev[dev_id].detect_chip_no ++;
+ if(rmdev[dev_id].detect_chip_no >=MAX_TRIES )
+ rmdev[dev_id].detect_chip_no = 0;
+ //g_detect_chip_no[dev_id] = (g_detect_chip_no[dev_id] + 1) & MAX_CHIP_NUM;
+
+ err = usb_write_ii(icarus, info->intinfo,
+ (char *)(&workdata), sizeof(workdata), &amount, C_SENDWORK);
+ rock_print_work_data(&workdata);
+ if (err != LIBUSB_SUCCESS || amount != sizeof(workdata))
+ continue;
+
+ memset(nonce_bin, 0, sizeof(nonce_bin));
+ ret = icarus_get_nonce(icarus, nonce_bin, &tv_start, &tv_finish, NULL, 5000);
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce_bin: %02X, %02X, %02X, %02X, %02X, %02X, %02X, %02X", nonce_bin[0], nonce_bin[1], nonce_bin[2], nonce_bin[3], nonce_bin[4], nonce_bin[5], nonce_bin[6], nonce_bin[7]);
+ #endif
+ if (ret != ICA_NONCE_OK)
+ {
+#if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "detect_one get_gold_nonce error, tries = %d.\r\n", tries);
+#endif
+ continue;
+ }
+
+ //device max chip
+ if((nonce_bin[NONCE_CHIP_NO_OFFSET]&RM_PRODUCT_MASK)==RM_PRODUCT_T1)
+ {
+ rmdev[dev_id].product_id = ROCKMINER_T1;
+ rmdev[dev_id].chip_max = 24;
+ rmdev[dev_id].min_frq = 200;
+ rmdev[dev_id].def_frq = 280;
+ rmdev[dev_id].max_frq = 320;
+ }
+ else
+ {
+ rmdev[dev_id].product_id= ROCKMINER_RBOX;
+ rmdev[dev_id].chip_max = 4;
+ rmdev[dev_id].min_frq = 200;
+ rmdev[dev_id].def_frq = 270;
+ rmdev[dev_id].max_frq = 290;
+ }
+ nonce_data.chip_no = nonce_bin[NONCE_CHIP_NO_OFFSET]&RM_CHIP_MASK;
+ if (nonce_data.chip_no >= rmdev[dev_id].chip_max)
+ {
+ nonce_data.chip_no = 0;
+ }
+
+ nonce_data.cmd_value = nonce_bin[NONCE_TASK_CMD_OFFSET]&RM_CMD_MASK;
+ if (nonce_data.cmd_value == NONCE_TASK_COMPLETE_CMD)
+ {
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "complete g_detect_chip_no: %d", rmdev[dev_id].detect_chip_no);
+ #endif
+ workdata.unused[ICARUS_UNUSED_SIZE - 3] = opt_rock_freq/10 - 1;
+ workdata.unused[ICARUS_UNUSED_SIZE - 2] = rmdev[dev_id].detect_chip_no;
+ rmdev[dev_id].detect_chip_no ++;
+ if(rmdev[dev_id].detect_chip_no>=MAX_TRIES)
+ rmdev[dev_id].detect_chip_no = 0;
+
+ err = usb_write_ii(icarus, info->intinfo,
+ (char *)(&workdata), sizeof(workdata), &amount, C_SENDWORK);
+ rock_print_work_data(&workdata);
+ if (err != LIBUSB_SUCCESS || amount != sizeof(workdata))
+ continue;
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "send_gold_nonce usb_write_ii");
+ #endif
+ continue;
+ }
+
+ memcpy((char *)&nonce, nonce_bin, ICARUS_READ_SIZE);
+ nonce = htobe32(nonce);
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce: %08X", nonce);
+ #endif
+ correction_times = 0;
+ while(correction_times<NONCE_CORRECTION_TIMES)
+ {
+ nonce_hex = bin2hex(nonce_bin, 4);
+ if (golden_nonce_val == nonce + correction_value[correction_times]) {
+ clear_chip_busy(dev_id);
+ rock_init_last_received_task_complete_time(dev_id);
+
+ if (info->ident == IDENT_ANU && !anu_freqset)
+ anu_freqset = true;
+ else
+ ok = true;
+ break;
+ } else {
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "detect_one gold_nonce compare error times = %d\r\n", correction_times);
+ #endif
+ if (tries < 0 && info->ident != IDENT_CMR2) {
+ applog(LOG_WARNING,
+ "Icarus Detect: "
+ "Test failed at %s: get %s, should: %s",
+ icarus->device_path, nonce_hex, golden_nonce);
+ }
+
+ if(nonce == 0)
+ {
+ break;
+ }
+ }
+ free(nonce_hex);
+ correction_times++;
+ }
+
+ #if ROCKMINER_PRINT_DEBUG
+ if(correction_times > 0 )
+ {
+ if (correction_times < NONCE_CORRECTION_TIMES)
+ applog(LOG_WARNING, "Rockminer correction the Golden nonce success %s%d[%d]=%d",icarus->drv->name, icarus->device_id,chip_no,correction_times);
+ else
+ applog(LOG_WARNING, "Rockminer correction the Golden nonce fail %s%d[%d]=%d",icarus->drv->name, icarus->device_id,chip_no,correction_times);
+ }
+ #endif
+
+ }
+
+ if (!ok)
+ goto unshin;
+ applog(LOG_DEBUG, "Icarus Detect: Test succeeded at %s: got %s",
+ icarus->device_path, golden_nonce);
+
+ /* We have a real Icarus! */
+ if (!add_cgpu(icarus))
+ goto unshin;
+
+ update_usb_stats(icarus);
+
+ applog(LOG_INFO, "%s%d: Found at %s",
+ icarus->drv->name, icarus->device_id, icarus->device_path);
+
+ applog(LOG_DEBUG, "%s%d: Init baud=%d work_division=%d fpga_count=%d",
+ icarus->drv->name, icarus->device_id, baud, work_division, fpga_count);
+
+ info->baud = baud;
+ info->work_division = work_division;
+ info->fpga_count = fpga_count;
+ info->nonce_mask = mask(work_division);
+
+ info->golden_hashes = (golden_nonce_val & info->nonce_mask) * fpga_count;
+ timersub(&tv_finish, &tv_start, &(info->golden_tv));
+
+ set_timing_mode(this_option_offset, icarus);
+
+ return icarus;
+
+unshin:
+
+ usb_uninit(icarus);
+ free(info);
+ icarus->device_data = NULL;
+
+shin:
+
+ icarus = usb_free_cgpu(icarus);
+
+ return NULL;
+}
+
static void icarus_detect(bool __maybe_unused hotplug)
{
- usb_detect(&icarus_drv, icarus_detect_one);
+ //usb_detect(&icarus_drv, icarus_detect_one);
+ usb_detect(&icarus_drv, rock_detect_one);
}
static bool icarus_prepare(__maybe_unused struct thr_info *thr)
@@ -1269,6 +1680,109 @@ static void cmr2_commands(struct cgpu_info *icarus)
}
}
+void rock_send_task(unsigned char chip_no, unsigned int current_task_id, struct thr_info *thr)
+{
+ struct cgpu_info *icarus = thr->cgpu;
+ struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
+ int ret, err, amount;
+ struct ICARUS_WORK workdata;
+ char *ob_hex;
+ struct work *work = NULL;
+ int dev_id = icarus->device_id;
+
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "thr_info id:%d, device_thread:%d, icarus cgminer_id: %d, device_id: %d.", thr->id, thr->device_thread, icarus->cgminer_id, icarus->device_id);
+ applog(LOG_WARNING, "::::::::::::::g_work[%d][%d][%d] = 0x%x", dev_id, chip_no, current_task_id, (int)g_work[dev_id][chip_no][current_task_id]);
+ #endif
+ if (g_work[dev_id][chip_no][current_task_id] == NULL)
+ {
+ work = get_work(thr, thr->id);
+ if (work == NULL)
+ {
+ return;
+ }
+ g_work[dev_id][chip_no][current_task_id] = work;
+ }
+ else
+ {
+ work = g_work[dev_id][chip_no][current_task_id];
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "::resend work");
+ #endif
+ }
+
+ #if ROCKMINER_PRINT_DEBUG
+ //if(chip_no == 7)
+ applog(LOG_WARNING, "::::::::::::::g_work[%d][%d][%d] = 0x%x", dev_id, chip_no, current_task_id, (int)g_work[dev_id][chip_no][current_task_id]);
+ #endif
+
+ memset((void *)(&workdata), 0, sizeof(workdata));
+ memcpy(&(workdata.midstate), work->midstate, ICARUS_MIDSTATE_SIZE);
+ memcpy(&(workdata.work), work->data + ICARUS_WORK_DATA_OFFSET, ICARUS_WORK_SIZE);
+ workdata.unused[ICARUS_UNUSED_SIZE - 4] = 0xaa;
+ if((rmdev[dev_id].chip[chip_no].freq>(rmdev[dev_id].max_frq/10-1))||(rmdev[dev_id].chip[chip_no].freq<(rmdev[dev_id].min_frq/10-1)))
+ {
+ rock_init_last_received_task_complete_time(dev_id);
+ }
+ workdata.unused[ICARUS_UNUSED_SIZE - 3] = rmdev[dev_id].chip[chip_no].freq; //icarus->freq/10 - 1; ;
+ workdata.unused[ICARUS_UNUSED_SIZE - 2] = chip_no ;
+ workdata.unused[ICARUS_UNUSED_SIZE - 1] = 0x55;
+
+ opt_debug = ROCKMINER_PRINT_DEBUG;
+ if (opt_debug) {
+ ob_hex = bin2hex((void *)(work->data), 128);
+ applog(LOG_WARNING, "%s%d: work->data %s",
+ icarus->drv->name, icarus->device_id, ob_hex);
+ free(ob_hex);
+ }
+
+ #ifndef ROCKMINER
+ rev((void *)(&(workdata.midstate)), ICARUS_MIDSTATE_SIZE);
+ rev((void *)(&(workdata.work)), ICARUS_WORK_SIZE);
+
+ if (info->speed_next_work || info->flash_next_work)
+ //cmr2_commands(icarus);
+ #endif
+
+ // We only want results for the work we are about to send
+ usb_buffer_clear(icarus);
+
+
+ err = usb_write_ii(icarus, info->intinfo, (char *)(&workdata), sizeof(workdata), &amount, C_SENDWORK);
+
+ if (err < 0 || amount != sizeof(workdata)) {
+ applog(LOG_ERR, "%s%i: Comms error (werr=%d amt=%d)",
+ icarus->drv->name, icarus->device_id, err, amount);
+ dev_error(icarus, REASON_DEV_COMMS_ERROR);
+ icarus_initialise(icarus, info->baud);
+
+ if(g_work[dev_id][chip_no][current_task_id])
+ {
+ free_work(g_work[dev_id][chip_no][current_task_id]);
+ g_work[dev_id][chip_no][current_task_id] = NULL;
+ }
+
+ return;
+ }
+
+ opt_debug = ROCKMINER_PRINT_DEBUG;
+ if (opt_debug) {
+ ob_hex = bin2hex((void *)(&workdata), sizeof(workdata));
+ applog(LOG_WARNING, "%s%d: sent %s",
+ icarus->drv->name, icarus->device_id, ob_hex);
+ free(ob_hex);
+
+ rev((void *)(&(workdata.midstate)), ICARUS_MIDSTATE_SIZE);
+ rev((void *)(&(workdata.work)), ICARUS_WORK_SIZE);
+ ob_hex = bin2hex((void *)(&workdata), sizeof(workdata));
+ applog(LOG_WARNING, "%s%d: revert sent %s",
+ icarus->drv->name, icarus->device_id, ob_hex);
+ free(ob_hex);
+ }
+
+ return;
+}
+
static int64_t icarus_scanwork(struct thr_info *thr)
{
struct cgpu_info *icarus = thr->cgpu;
@@ -1523,6 +2037,429 @@ out:
return hash_count;
}
+static int64_t rock_scanwork(struct thr_info *thr)
+{
+ struct cgpu_info *icarus = thr->cgpu;
+ struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
+ int ret, err, amount;
+ unsigned char nonce_bin[ICARUS_BUF_SIZE];
+ struct ICARUS_WORK workdata;
+ char *ob_hex;
+ uint32_t nonce;
+ int64_t hash_count = 0;
+ struct timeval tv_start, tv_finish, elapsed;
+ struct timeval tv_history_start, tv_history_finish;
+ double Ti, Xi;
+ int curr_hw_errors, i;
+ bool was_hw_error;
+ struct work *work = NULL;
+
+ struct ICARUS_HISTORY *history0, *history;
+ int count;
+ double Hs, W, fullnonce;
+ int read_time;
+ bool limited;
+ int64_t estimate_hashes;
+ uint32_t values;
+ int64_t hash_count_range;
+ int correction_times = 0;
+ #if (NONCE_CORRECTION_TIMES == 9)
+ int32_t correction_value[] = {0, 1, -1, 2, -2, 3, -3, 4, -4};
+ #endif
+#if (NONCE_CORRECTION_TIMES == 3)
+ int32_t correction_value[] = {0, 1, -1};
+#endif
+ NONCE_DATA nonce_data;
+
+ int chip_no = 0;
+ time_t recv_time = 0;
+ //unsigned int task_no = 0;
+ // int cmd_value = 0;
+ int dev_id = icarus->device_id;
+ //unsigned char work_state;
+
+ if (unlikely(share_work_tdiff(icarus) > info->fail_time)) {
+ if (info->failing) {
+ if (share_work_tdiff(icarus) > info->fail_time + 60) {
+ applog(LOG_ERR, "%s %d: Device failed to respond to restart",
+ icarus->drv->name, icarus->device_id);
+ usb_nodev(icarus);
+ return -1;
+ }
+ } else {
+ applog(LOG_WARNING, "%s %d: No valid hashes for over %d secs, attempting to reset",
+ icarus->drv->name, icarus->device_id, info->fail_time);
+ usb_reset(icarus);
+ info->failing = true;
+ }
+ }
+
+ // Device is gone
+ if (icarus->usbinfo.nodev)
+ return -1;
+
+ elapsed.tv_sec = elapsed.tv_usec = 0;
+
+
+ for (chip_no = 0; chip_no < rmdev[dev_id].chip_max; chip_no++)
+ {
+ recv_time = time(NULL);
+ if (recv_time > rmdev[dev_id].chip[chip_no].last_received_task_complete_time + 1)
+ {
+ #if NONCE_TEST
+ applog(LOG_WARNING, ":::chip_no error = %d nonce timeout", chip_no);
+ #endif
+ rmdev[dev_id].chip[chip_no].last_received_task_complete_time = recv_time;
+ rock_send_task(chip_no, 0,thr);
+ break;
+ }
+ }
+
+ /* Icarus will return 4 bytes (ICARUS_READ_SIZE) nonces or nothing */
+ memset(nonce_bin, 0, sizeof(nonce_bin));
+ ret = icarus_get_nonce(icarus, nonce_bin, &tv_start, &tv_finish, thr, 3000);//info->read_time);
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce_bin: ret = %d. %02X, %02X, %02X, %02X, %02X, %02X, %02X, %02X", ret, nonce_bin[0], nonce_bin[1], nonce_bin[2], nonce_bin[3], nonce_bin[4], nonce_bin[5], nonce_bin[6], nonce_bin[7]);
+ #endif
+ if((nonce_bin[NONCE_CHIP_NO_OFFSET]&RM_PRODUCT_MASK)==RM_PRODUCT_T1)
+ {
+ rmdev[dev_id].product_id = ROCKMINER_T1;
+ rmdev[dev_id].chip_max = 24;
+ rmdev[dev_id].min_frq = 200;
+ rmdev[dev_id].def_frq = 280;
+ rmdev[dev_id].max_frq = 320;
+ }
+ else
+ {
+ rmdev[dev_id].product_id= ROCKMINER_RBOX;
+ rmdev[dev_id].chip_max = 4;
+ rmdev[dev_id].min_frq = 200;
+ rmdev[dev_id].def_frq = 270;
+ rmdev[dev_id].max_frq = 290;
+ }
+ nonce_data.chip_no = nonce_bin[NONCE_CHIP_NO_OFFSET]&RM_CHIP_MASK;
+ if(nonce_data.chip_no>=rmdev[dev_id].chip_max)
+ nonce_data.chip_no=0;
+ nonce_data.task_no = nonce_bin[NONCE_TASK_NO_OFFSET]>=2?0:nonce_bin[NONCE_TASK_NO_OFFSET];
+ nonce_data.cmd_value = nonce_bin[NONCE_TASK_CMD_OFFSET]&RM_CMD_MASK;
+ nonce_data.work_state = nonce_bin[NONCE_TASK_CMD_OFFSET]&RM_STATUS_MASK;
+#if ROCKMINER_PRINT_DEBUG
+ if(nonce_data.work_state == 2)
+ applog(LOG_WARNING, "Temperature of Device is too hign to work!");
+#endif
+
+ icarus->temp = (double)nonce_bin[NONCE_COMMAND_OFFSET];
+#if 0
+ if(icarus->temp == 128)
+ icarus->temp_have = 0;
+ else
+ icarus->temp_have = 1;
+#endif
+
+ if (nonce_data.cmd_value == NONCE_TASK_COMPLETE_CMD)
+ {
+ rmdev[dev_id].chip[nonce_data.chip_no].last_received_task_complete_time = time(NULL);
+
+ if (g_work[dev_id][nonce_data.chip_no][nonce_data.task_no])
+ {
+ free_work(g_work[dev_id][nonce_data.chip_no][nonce_data.task_no]);
+ g_work[dev_id][nonce_data.chip_no][nonce_data.task_no] = NULL;
+ }
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ chip_work_conunts[nonce_data.chip_no] ++;
+#endif
+
+ goto out;
+ }
+
+ if (nonce_data.cmd_value == NONCE_GET_TASK_CMD)
+ {
+ rock_send_task(nonce_data.chip_no, nonce_data.task_no, thr);
+ goto out;
+ }
+
+ if (ret == ICA_NONCE_TIMEOUT)
+ {
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "chip_no = %d nonce timeout, ret = %d", nonce_data.chip_no, ret);
+ #endif
+ rock_send_task(nonce_data.chip_no, nonce_data.task_no, thr);
+ }
+
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer chip_no: %d", nonce_data.chip_no);
+ #endif
+
+ work = g_work[dev_id][nonce_data.chip_no][nonce_data.task_no];
+ if (work == NULL)
+ {
+ goto out;
+ }
+
+ if (ret == ICA_NONCE_ERROR)
+ goto out;
+
+ // aborted before becoming idle, get new work
+ if (ret == ICA_NONCE_TIMEOUT || ret == ICA_NONCE_RESTART) {
+ timersub(&tv_finish, &tv_start, &elapsed);
+
+ // ONLY up to just when it aborted
+ // We didn't read a reply so we don't subtract ICARUS_READ_TIME
+ estimate_hashes = ((double)(elapsed.tv_sec)
+ + ((double)(elapsed.tv_usec))/((double)1000000)) / info->Hs;
+
+ // If some Serial-USB delay allowed the full nonce range to
+ // complete it can't have done more than a full nonce
+ if (unlikely(estimate_hashes > 0xffffffff))
+ estimate_hashes = 0xffffffff;
+
+ applog(LOG_DEBUG, "%s%d: no nonce = 0x%08lX hashes (%ld.%06lds)",
+ icarus->drv->name, icarus->device_id,
+ (long unsigned int)estimate_hashes,
+ (long)elapsed.tv_sec, (long)elapsed.tv_usec);
+
+ hash_count = estimate_hashes;
+ goto out;
+ }
+
+ memcpy((char *)&nonce, nonce_bin, ICARUS_READ_SIZE);
+ nonce = htobe32(nonce);
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce %s%d[%d/24]-%d: %08X",icarus->drv->name, icarus->device_id,nonce_data.chip_no,nonce_data.task_no, nonce);
+ #endif
+ curr_hw_errors = icarus->hw_errors;
+
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ device_nonce_conunts[dev_id] ++;
+ chip_nonce_conunts[nonce_data.chip_no] ++;
+#endif
+
+ recv_time = time(NULL);
+ if((recv_time-rmdev[dev_id].dev_detect_time )>=60)//device_chip_max[device_id]
+ {
+ unsigned char i;
+ rmdev[dev_id].dev_detect_time = recv_time;
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "AMU%d Freq: %d0MHz/ %d0MHz/ %d0MHz/ %d0MHz ",dev_id,rmdev[dev_id].chip[0].freq+1,rmdev[dev_id].chip[1].freq+1,rmdev[dev_id].chip[2].freq+1,rmdev[dev_id].chip[3].freq+1);
+#endif
+ for (i = 0; i < rmdev[dev_id].chip_max; i ++)
+ {
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "AMU%d Chip[%d] nonce=%d/%d/%d,freq:%d0MHz, ",dev_id,i,rmdev[dev_id].chip[i].error_cnt,chip_nonce_conunts[i],chip_work_conunts[i],rmdev[dev_id].chip[i].freq+1);
+ chip_nonce_conunts[i] = 0;
+ chip_work_conunts[i] = 0;
+#endif
+ if(rmdev[dev_id].chip[i].error_cnt>=12)
+ {
+ if(rmdev[dev_id].chip[i].freq>rmdev[dev_id].min_frq) //200Mhz
+ {
+ rmdev[dev_id].chip[i].freq --;
+#ifdef NONCE_TEST
+ applog(LOG_WARNING, "AMU%d Chip[%d]=%d SUB FREQ TO %d0MHz,DEF(%fMHz) ",dev_id,i,rmdev[dev_id].chip[i].error_cnt,rmdev[dev_id].chip[i].freq+1,opt_rock_freq);
+#endif
+ }
+ }
+ else if(rmdev[dev_id].chip[i].error_cnt<=1)
+ {
+ if(rmdev[dev_id].chip[i].freq<(rmdev[dev_id].def_frq/10-1))
+ {
+ rmdev[dev_id].chip[i].freq ++;
+#ifdef NONCE_TEST
+ applog(LOG_WARNING, "AMU%d Chip[%d]=%d ADD FREQ TO %d0MHz,DEF(%fMHz) ",dev_id,i,rmdev[dev_id].chip[i].error_cnt,rmdev[dev_id].chip[i].freq+1,opt_rock_freq);
+#endif
+ }
+ }
+ rmdev[dev_id].chip[i].error_cnt = 0;
+ }
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ device_nonce_corr_ok[dev_id] = 0;
+ device_nonce_corr_fail[dev_id] = 0;
+ device_nonce_corr_fail_2[dev_id] = 0;
+ device_nonce_conunts[dev_id] = 0;
+#endif
+
+ }
+
+ correction_times = 0;
+ while(correction_times<NONCE_CORRECTION_TIMES)
+ {
+ if (submit_nonce(thr, work, nonce + correction_value[correction_times]))
+ {
+ hash_count++;
+ info->failing = false;
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce :::OK:::\r\n");
+ #endif
+ break;
+ }
+ else
+ {
+ #if ROCKMINER_PRINT_DEBUG
+ applog(LOG_WARNING, "Rockminer nonce error times = %d\r\n", correction_times);
+ #endif
+ if(nonce == 0)
+ {
+ break;
+ }
+ }
+ correction_times++;
+ }
+
+ if(correction_times > 0 )
+ {
+
+ /* FIXME: Where is this i supposed to come from? Comment out instead */
+ //rmdev[dev_id].chip[i].error_cnt ++;
+ if (correction_times < NONCE_CORRECTION_TIMES)
+ {
+
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ device_nonce_corr_ok[dev_id] ++;
+ //applog(LOG_WARNING, "Rockminer correction the nonce success %s%d[%d]=%d",icarus->drv->name, icarus->dev_id,chip_no,correction_times);
+ #endif
+ }
+ else
+ {
+#ifdef NONCE_TEST// ROCKMINER_PRINT_DEBUG
+ device_nonce_corr_fail[dev_id] ++;
+#endif
+ //applog(LOG_WARNING, "Rockminer correction the nonce fail ---------%s%d[%d]=%d",icarus->drv->name, icarus->dev_id,chip_no,correction_times);
+ }
+
+ }
+
+ was_hw_error = (curr_hw_errors < icarus->hw_errors);
+
+ if (was_hw_error)
+ hash_count = 0;
+ else {
+ #if 0
+ hash_count = (nonce & info->nonce_mask);
+ hash_count++;
+ hash_count *= info->fpga_count;
+ #else
+ hash_count = (hash_count * info->nonce_mask);
+ #endif
+ }
+
+ if (opt_debug || info->do_icarus_timing)
+ timersub(&tv_finish, &tv_start, &elapsed);
+
+ applog(LOG_DEBUG, "%s%d: nonce = 0x%08x = 0x%08lX hashes (%ld.%06lds)",
+ icarus->drv->name, icarus->device_id,
+ nonce, (long unsigned int)hash_count,
+ (long)elapsed.tv_sec, (long)elapsed.tv_usec);
+
+ // Ignore possible end condition values ... and hw errors
+ // TODO: set limitations on calculated values depending on the device
+ // to avoid crap values caused by CPU/Task Switching/Swapping/etc
+ if (info->do_icarus_timing
+ && !was_hw_error
+ && ((nonce & info->nonce_mask) > END_CONDITION)
+ && ((nonce & info->nonce_mask) < (info->nonce_mask & ~END_CONDITION))) {
+ cgtime(&tv_history_start);
+
+ history0 = &(info->history[0]);
+
+ if (history0->values == 0)
+ timeradd(&tv_start, &history_sec, &(history0->finish));
+
+ Ti = (double)(elapsed.tv_sec)
+ + ((double)(elapsed.tv_usec))/((double)1000000)
+ - ((double)ICARUS_READ_TIME(info->baud));
+ Xi = (double)hash_count;
+ history0->sumXiTi += Xi * Ti;
+ history0->sumXi += Xi;
+ history0->sumTi += Ti;
+ history0->sumXi2 += Xi * Xi;
+
+ history0->values++;
+
+ if (history0->hash_count_max < hash_count)
+ history0->hash_count_max = hash_count;
+ if (history0->hash_count_min > hash_count || history0->hash_count_min == 0)
+ history0->hash_count_min = hash_count;
+
+ if (history0->values >= info->min_data_count
+ && timercmp(&tv_start, &(history0->finish), >)) {
+ for (i = INFO_HISTORY; i > 0; i--)
+ memcpy(&(info->history[i]),
+ &(info->history[i-1]),
+ sizeof(struct ICARUS_HISTORY));
+
+ // Initialise history0 to zero for summary calculation
+ memset(history0, 0, sizeof(struct ICARUS_HISTORY));
+
+ // We just completed a history data set
+ // So now recalc read_time based on the whole history thus we will
+ // initially get more accurate until it completes INFO_HISTORY
+ // total data sets
+ count = 0;
+ for (i = 1 ; i <= INFO_HISTORY; i++) {
+ history = &(info->history[i]);
+ if (history->values >= MIN_DATA_COUNT) {
+ count++;
+
+ history0->sumXiTi += history->sumXiTi;
+ history0->sumXi += history->sumXi;
+ history0->sumTi += history->sumTi;
+ history0->sumXi2 += history->sumXi2;
+ history0->values += history->values;
+
+ if (history0->hash_count_max < history->hash_count_max)
+ history0->hash_count_max = history->hash_count_max;
+ if (history0->hash_count_min > history->hash_count_min || history0->hash_count_min == 0)
+ history0->hash_count_min = history->hash_count_min;
+ }
+ }
+
+ // All history data
+ Hs = (history0->values*history0->sumXiTi - history0->sumXi*history0->sumTi)
+ / (history0->values*history0->sumXi2 - history0->sumXi*history0->sumXi);
+ W = history0->sumTi/history0->values - Hs*history0->sumXi/history0->values;
+ hash_count_range = history0->hash_count_max - history0->hash_count_min;
+ values = history0->values;
+
+ // Initialise history0 to zero for next data set
+ memset(history0, 0, sizeof(struct ICARUS_HISTORY));
+
+ fullnonce = W + Hs * (((double)0xffffffff) + 1);
+ read_time = SECTOMS(fullnonce) - ICARUS_READ_REDUCE;
+ if (info->read_time_limit > 0 && read_time > info->read_time_limit) {
+ read_time = info->read_time_limit;
+ limited = true;
+ } else
+ limited = false;
+
+ info->Hs = Hs;
+ info->read_time = read_time;
+
+ info->fullnonce = fullnonce;
+ info->count = count;
+ info->W = W;
+ info->values = values;
+ info->hash_count_range = hash_count_range;
+
+ if (info->min_data_count < MAX_MIN_DATA_COUNT)
+ info->min_data_count *= 2;
+ else if (info->timing_mode == MODE_SHORT)
+ info->do_icarus_timing = false;
+
+ applog(LOG_WARNING, "%s%d Re-estimate: Hs=%e W=%e read_time=%dms%s fullnonce=%.3fs",
+ icarus->drv->name, icarus->device_id, Hs, W, read_time,
+ limited ? " (limited)" : "", fullnonce);
+ }
+ info->history_count++;
+ cgtime(&tv_history_finish);
+
+ timersub(&tv_history_finish, &tv_history_start, &tv_history_finish);
+ timeradd(&tv_history_finish, &(info->history_time), &(info->history_time));
+ }
+out:
+
+ return hash_count;
+}
+
static struct api_data *icarus_api_stats(struct cgpu_info *cgpu)
{
struct api_data *root = NULL;
diff --git a/miner.h b/miner.h
index b74feb6..74993c0 100644
--- a/miner.h
+++ b/miner.h
@@ -986,6 +986,7 @@ extern bool opt_restart;
extern char *opt_icarus_options;
extern char *opt_icarus_timing;
extern float opt_anu_freq;
+extern float opt_rock_freq;
#endif
extern bool opt_worktime;
#ifdef USE_AVALON
diff --git a/usbutils.c b/usbutils.c
index 4e46b23..595ed05 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -583,6 +583,16 @@ static struct usb_find_devices find_dev[] = {
INTINFO(amu_ints) },
{
.drv = DRIVER_icarus,
+ .name = "LIN",
+ .ident = IDENT_LIN,
+ .idVendor = 0x10c4,
+ .idProduct = 0xea60,
+ .config = 1,
+ .timeout = ICARUS_TIMEOUT_MS,
+ .latency = LATENCY_UNUSED,
+ INTINFO(amu_ints) },
+ {
+ .drv = DRIVER_icarus,
.name = "ANU",
.ident = IDENT_ANU,
.idVendor = 0x10c4,
diff --git a/usbutils.h b/usbutils.h
index 335cb39..8e9f949 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -157,6 +157,7 @@ enum sub_ident {
IDENT_HFA,
IDENT_ICA,
IDENT_KLN,
+ IDENT_LIN,
IDENT_LLT,
IDENT_MMQ,
IDENT_NFU,