Skip to content

Hercules 4-Mx update usb.c for switching Input 1-2 to phone (instead of line in) #19

Description

@filipiff

This is not an issue with hdjd, but a quick fix if you would like to have a turntable connected to the input 1-2 to have phono levels instead of line-in levels. In windows using the DJHERCULESMIX TrayAgent is possible to change this input, but in linx is not retained.

--- usb.c-original      2026-04-28 16:44:51.434554969 +0200
+++ usb.c       2026-04-28 16:47:22.942268427 +0200
@@ -138,6 +138,18 @@
   libusb_free_transfer(xfer);
 }
+static void hercules_4mx_set_phono(struct libusb_device_handle *handle) {
+    int ret;
+    // bmRequestType: 0x40, bRequest: 5, wValue: 0x0003, wIndex: 0
+    ret = libusb_control_transfer(handle, 0x40, 5, 0x0003, 0, NULL, 0, 1000);
+
+    if (ret < 0) {
+        warn("4-Mx: Failed to set Phono mode: %s", libusb_error_name(ret));
+    } else {
+        printf("4-Mx: Hardware switched to Phono input mode.\n");
+    }
+}
+
 int
 usb_setup(char *name, size_t namelen)
 {
@@ -232,6 +244,13 @@
   ret = libusb_claim_interface(usb_dev, dev_info->interface_number);
   if (ret == 0 ) {
+
+        // --- ADDED FOR 4-MX PHONO TOGGLE ---
+        if (dev_info->product_id == 0xb109) {
+            hercules_4mx_set_phono(usb_dev);
+        }
+        // ----------------------------------
+
     if (dev_info->ep_in2 != 0x0) {
       libusb_claim_interface(usb_dev, dev_info->interface_number2);
       usb_initiate_transfer_additional();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions