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

AnyTone D578UVII Uses Different USB VID and PID, Following Changes Read Radio #415

Open
ken-clifton opened this issue Feb 15, 2024 · 11 comments

Comments

@ken-clifton
Copy link

I noticed my AnyTone D578UVII uses different a different USB VID and PID than those defined near the top of anytone_interface.cc
Not sure of the best approach should you want to get QDMR working for both the "old" and "new" VID and PID ?
Here are the changes I implemented in 0.11 to successfully read from the radio:

  1. In /lib/anytone_interface.cc
    changed VID/PID to - VID: 2e3c PID: 5740

    Also in /lib/anytone_interface.cc
    Added line below:
    } else if ("D578UV" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UV);
    }

    As:
    else if ("D578UV2" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UVII);
    }

  2. In /lib/radioinfo.hh
    Below D878UVII,
    Added D578UVII,

    Also in /lib/radioinfo.hh
    below D578UVII,
    Added D578UV = D578UVII, // Actually a different device, Implement!

  3. In /lib/radioinfo.cc
    Below line: {"d578uv", RadioInfo::D578UV}
    Added: a comma ( , ) then on next line
    {"d578uv2", RadioInfo::D578UVII}

    Also in /lib/radioinfo.cc
    Below line: {RadioInfo::D578UV, D578UV::defaultRadioInfo()},
    Added:
    {RadioInfo::D578UVII, D578UV::defaultRadioInfo()},

  4. In /lib/radio.cc
    Below line: return new D578UV(anytone);
    Added:
    } else if ((id.isValid() && (RadioInfo::D578UVII == id.id())) || (force.isValid() && (RadioInfo::D578UVII == force.id()))) {
    return new D578UV(anytone);

  5. In /lib/d578uv.cc
    Changed the lines at the bottom below:
    RadioInfo
    D578UV::defaultRadioInfo() {
    return RadioInfo(

    To:
    RadioInfo::D578UVII, "d578uv2", "AT-D578UVII", "AnyTone", AnytoneInterface::interfaceInfo(),
    QList{
    RadioInfo(RadioInfo::D578UV, "d578uv", "AT-D578UV", "AnyTone", AnytoneInterface::interfaceInfo())
    });

@ken-clifton
Copy link
Author

Possible solution to above changes to support old Anytone VID/PID as well as new Anytone VID/PID:

  1. In /lib/anytone_interface.cc
    Changed #define USB_VID and USB_PID
    to:
    // original anytone vid & pid
    #define USB_VID1 0x28e9
    #define USB_PID1 0x018a

    And Added following two defines:
    // next are vid/pid for d578uv2
    #define USB_VID2 0x2e3c
    #define USB_PID2 0x5740

    Added a declaration for static variables above all methods near top:
    uint16_t AnytoneInterface::_at_vid = 0x0000;
    uint16_t AnytoneInterface::_at_pid = 0x0000;

    Modified AnytoneInterface::InterfaceInfo() and AnytoneInterface::detect() to
    USBDeviceInfo
    AnytoneInterface::interfaceInfo() {
    return USBDeviceInfo(USBDeviceInfo::Class::Serial, _at_vid, _at_pid);
    }

    QList
    AnytoneInterface::detect() {
    // try first usb_vid and usb_pid
    QList devices = USBSerial::detect(USB_VID1, USB_PID1);
    if (devices.count() == 1) {
    // device found...
    _at_vid = USB_VID1;
    _at_pid = USB_PID1;
    return devices;
    }
    else { // else try second usb_vid, usb_pid...
    _at_vid = USB_VID2; // save for use in AnytoneInterface::interfaceInfo()
    _at_pid = USB_PID2; // save for use in AnytoneInterface::interfaceInfo()
    return USBSerial::detect(USB_VID2, USB_PID2);
    }
    }

    Also in /lib/anytone_interface.cc
    Added line below:
    } else if ("D578UV" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UV);
    }

    As:
    else if ("D578UV2" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UVII);
    }

  2. in /lib/anytone_interface.hh
    near bottom of code in protected section just below RadioVariant _info; added
    static uint16_t _at_vid;
    static uint16_t _at_pid;

@galagithub
Copy link

This kind of bug is present on all radios where serial communication is used, why qdmr is masking this with USB ids is beyond me.

@allesand
Copy link

allesand commented Mar 17, 2024

@ken-clifton , @galagithub : Is this related to #196 and/or #370?

@ken-clifton
Copy link
Author

@allesand Yes, related to #196, but the code in the development branch does not handle the different USB VID and PID as mentioned in the title of this issue.

@allesand
Copy link

@ken-clifton : which of the models in https://www.wouxun.us/images/D578UV-Family.jpg is your radio? Or yet a different one?

@ken-clifton
Copy link
Author

@allesand in the image link you provided the radio is D578UVIII Plus. However if you read through both issue #196 and #415 it identifies itself in anytone_interface.cc code as "D578UV2". This is documented in the information I provided at the top of this issue as item 1 on Feb 14, 2024.

@allesand
Copy link

@ken-clifton : since the title of this issue reads "AnyTone D578UVII Uses Different USB VID and PID, Following Changes Read Radio" and also "I noticed my AnyTone D578UVII uses different a different USB VID and PID than those defined near the top of anytone_interface.cc" I just wanted to confirm that it is indeed a "D578UVIII Plus" according to that table and not yet another model Anytone came up with - since there is a "D578UVII" mentioned in https://www.wouxun.us/Software/AnyTone-Software/AT-D578UVII-PLUS-v2.06.2-Changelog.pdf ..

@ken-clifton
Copy link
Author

@allesand I appreciate you checking. Several of the AnyTone D578 series report as "D578UV2" in the USB information.

@allesand
Copy link

@allesand I appreciate you checking. Several of the AnyTone D578 series report as "D578UV2" in the USB information.

If different models with different options in the codeplug report the same model via USB, @hmatuschek will not be happy, since from what I understood Anytone does not encode the model in the data read from the radio. But I will leave that up to @hmatuschek, just wanted to gather as much info as possible.

@galagithub

This comment was marked as abuse.

@allesand
Copy link

Re: #285 and #389, end of discussion for me. @galagithub : good to read that you got a good laugh, maybe that will make your discussion more ham-spirit like. Side note: your "!" seems to be stuck.

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

3 participants