unknownzerx / lguf-brightness

Adjust brightness for LG UltraFine 4K display (cross platform)
60 stars 19 forks source link

Doesn't work anymore on Ultrafine 5K #1

Closed goyaweb closed 6 years ago

goyaweb commented 7 years ago

When I tested the program with my Dell XPS 15 at the apple store with the Ultrafine 5K it worked flawlessly. Having bought the device (a different one) and coming home it stopped working.

unknownzerx commented 7 years ago

The brightness is controlled by a specific USB device (integrated with the monitor).

Do you have this (VID: 034E, PID: 9A40) in Device Manager? device manager

If you drag the program to cmd and run it, it might prompt you Failed to open the device.... Is it the case?

I have only the 4K one. The 5K model is reported working.

LG has released a revised version of this display. Something might have been changed. Please list if there is something seeming related in Device Manager (additional USB device after you plug in the display).

goyaweb commented 7 years ago

Actually VID and PID are the same as your screenshot, but my REV is different: REV_0300 instead of 0214. When I run the program I just get the regular: Press '-' or '=' to adjust brightness. Press '[' or: ']' to fine tune. Press 'q' to quit. Input:

unknownzerx commented 7 years ago

See https://github.com/unknownzerx/lguf-brightness/issues/2 . You might copy the steps to see if anything is changed in the USB command for brightness controlling.

However, an authentic Mac would be required to install 'Boot Camp Support Software'.

goyaweb commented 7 years ago

hmm no mac with bootcamp around for me to capture commands with...

I wonder if the reason could be that the program somehow go linked to the screen in the apple store and kept that reference somehow?

unknownzerx commented 7 years ago

The program doesn't keep any state, and I don't think old system device record caused the problem.

As a last resort, if you don't change brightness often, you might try hackintosh on the XPS 15...

csujedihy commented 6 years ago

I tried to debug this problem. I used Device Monitoring Studio. I only found GET_DESCRIPTOR related packets captured and no control packets captured when I pressed "-", "+".

BTW, are you guoren?

unknownzerx commented 6 years ago

@csujedihy The program was not working and thus no packets were captured.

I have only the 4K display and the 12" MacBook (USB-C, not ThunderBolt 3).

If someone could hand on an authentic Mac with TB3 and the 5K one, Please

Then we can port it to ordinary PC.

csujedihy commented 6 years ago

I have all you listed. I did some tests yesterday. I will show you captured packets later.

I tested your program with 5K from my MBP. The program didn't send out control packets. The function libusb_control_transfer returned -1 which is IO error.

csujedihy commented 6 years ago

Here is the captured packets. I already ruled out unrelated packets but I uploaded another one just in case.

lg5kcapture.zip (filtered)

lg5kbr.zip (original)

csujedihy commented 6 years ago

I captured packets when using your tool but only GET_DESCRIPTOR packets are found.

lguf-br-github.zip

csujedihy commented 6 years ago

@unknownzerx Do you need more trace?

unknownzerx commented 6 years ago

Here is the pcap I've used min-to-max.pcap.zip

I hasn't noticed any difference...

It is a group of 3 packet. I got some of the arguments for libusb_control_transfer from the 1st packet

URB setup
    bmRequestType: 0x21
    bRequest: 9
    wValue: 0x0300
    wIndex: 1 (0x0001)
    wLength: 6

The second one looks likes:

USB URB
    [Source: 1.8.0]
    [Destination: host]
    USBPcap pseudoheader length: 28
    IRP ID: 0xffff938ccf29f670
    IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
    URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008)
    IRP information: 0x01, Direction: PDO -> FDO
    URB bus id: 1
    Device address: 8
    Endpoint: 0x00, Direction: OUT
    URB transfer type: URB_CONTROL (0x02)
    Packet Data Length: 6
    [Request in: 4]
    [Time from request: 0.046909000 seconds]
    Control transfer stage: Data (1)
    [bInterfaceClass: Unknown (0xffff)]
CONTROL response data: 900100000000

where the last line is the 6-byte data

unknownzerx commented 6 years ago

Could you try

csujedihy commented 6 years ago

I always run windows version with admin privilege and it doesn't work. I can't see any USB packets sent while capturing except two for GET_DESCRIPTOR.

In OSX, it works perfectly with my LG 5K.

I think the protocol is exactly the same as the one for LG 4k and in Windows, your program just didn't send those USB packets out. libusb_control_transfer just returned -1.

csujedihy commented 6 years ago

Do you run your program on Windows 10?

csujedihy commented 6 years ago

I think I found the problem. I adjusted the brightness by using HIDAPI. But I don't understand how USB communication works. In wireshark, does host mean computer or the usb device? I thought it was device but host sends the same packet everytime.

csujedihy commented 6 years ago

Thanks! I finally solved this problem by using HIDAPI.

unknownzerx commented 6 years ago

Glad to see it works. Thank you.

I do run it on Win 10. Have no idea about what is wrong.

HIDAPI is better to use.