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

TS464 IT8528 not found #3

Open
adyanth opened this issue Nov 21, 2024 · 28 comments
Open

TS464 IT8528 not found #3

adyanth opened this issue Nov 21, 2024 · 28 comments

Comments

@adyanth
Copy link

adyanth commented Nov 21, 2024

I was trying to build and install this on TrueNAS. I am using a privileged ubuntu docker container to build and insmod this driver.

Once I build the qnap8528.ko, I try to insmod qnap8528.ko. This fails with

$ make -C src all
$ insmod src/qnap8528.ko
insmod: ERROR: could not insert module src/qnap8528.ko: No such device
$ dmesg
[291468.952761] qnap8528 @ qnap8528_ec_hw_check: Could not locate IT8528 EC device
[291468.952777] qnap8528 @ qnap8528_init: qnap8528 device driver failed to probe, unloading

Does this mean the QNAP TS-464 does not use the embedded chip?

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Can you please provide the following:

  • Do you have a more specific model number than TS-464 (any extra letters maybe on the label?)
  • Output of /proc/ioports
  • Output of the following program:
#include <stdio.h>
#include <sys/io.h>
void main(void) {
       unsigned short ec_id;
       if (!ioperm(0x2e, 2, 1)) {
               outb(0x20, 0x2e);
               printf("First ID byte: 0x%x\n", inb(0x2f));
               outb(0x21, 0x2e);
               printf("Second ID byte: 0x%x\n", inb(0x2f));
               ioperm(0x2e, 2, 0);
       return;
   }
       printf("ioperm error\n");
}

(I should really print this in the logs when the error occurs, will add)

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Also, if possible, can you statically compile the small program (if needed) and run it directly on the host without a container?

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

  1. Not really, label says TS-x64, it is this (8G version): https://www.qnap.com/en-us/product/ts-464/specs/hardware
$ cat /proc/ioports 
0000-0000 : PCI Bus 0000:00
  0000-0000 : dma1
  0000-0000 : pic1
  0000-0000 : timer0
  0000-0000 : timer1
  0000-0000 : keyboard
  0000-0000 : keyboard
  0000-0000 : rtc_cmos
    0000-0000 : rtc0
  0000-0000 : dma page reg
  0000-0000 : pic2
  0000-0000 : dma2
  0000-0000 : fpu
  0000-0000 : ene_ir
  0000-0000 : wdat_wdt
  0000-0000 : wdat_wdt
  0000-0000 : wdat_wdt
  0000-0000 : pnp 00:01
  0000-0000 : pnp 00:00
  0000-0000 : pnp 00:00
  0000-0000 : pnp 00:00
  0000-0000 : pnp 00:00
  0000-0000 : pnp 00:00
  0000-0000 : pnp 00:00
0000-0000 : PCI conf1
0000-0000 : PCI Bus 0000:00
  0000-0000 : pnp 00:01
  0000-0000 : ACPI PM1a_EVT_BLK
  0000-0000 : ACPI PM1a_CNT_BLK
  0000-0000 : ACPI PM_TMR
  0000-0000 : ACPI PM2_CNT_BLK
  0000-0000 : pnp 00:02
  0000-0000 : ACPI GPE0_BLK
  0000-0000 : pnp 00:06
  0000-0000 : PCI Bus 0000:06
  0000-0000 : PCI Bus 0000:05
  0000-0000 : PCI Bus 0000:04
  0000-0000 : PCI Bus 0000:03
  0000-0000 : PCI Bus 0000:02
  0000-0000 : PCI Bus 0000:01
  0000-0000 : 0000:00:02.0
  0000-0000 : 0000:00:1f.4
    0000-0000 : i801_smbus
First ID byte: 0xff
Second ID byte: 0xff

I ran the same binary (since host does not have gcc) and got the same result as step 3 on the host

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

I also have the decompiled dsdt if that helps in any way.

dsdt.dsl.txt

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Unfortunately, the output of /proc/ioports is missing, (all ranges are 0000) probably due to cat running with insufficient permissions.

If the device uses the IT8528 the first and second ID bytes should be 0x85 and 0x28. From the configuration I have for the TS-464, I cannot see that it uses any other chip than the IT8528.

All these are the configuration files for various TS-464 devices, nothing else but IT8528:

./model_Q0930_10.conf:SIO_DEVICE = IT8528
./model_Q08S0_QY740_20_20.conf:SIO_DEVICE = IT8528
./model_Q07R1_Q08F0_20_11.conf:SIO_DEVICE = IT8528
./model_SAQ93_SBR00_10_10.conf:SIO_DEVICE = IT8528
./model_Q0910_Q08F0_21_11.conf:SIO_DEVICE = IT8528
./model_Q08S0_QY741_10_20.conf:SIO_DEVICE = IT8528
./model_Q07R6_Q08F0_21_11.conf:SIO_DEVICE = IT8528
./model_Q0910_Q08F0_20_11.conf:SIO_DEVICE = IT8528
./model_Q07R6_Q08F0_20_11.conf:SIO_DEVICE = IT8528
./model_Q07R1_Q08F0_13_11.conf:SIO_DEVICE = IT8528
./model_Q0930_20.conf:SIO_DEVICE = IT8528
./model_SAQ93_SBR00_13_10.conf:SIO_DEVICE = IT8528
./model_Q07R1_Q08F0_11_11.conf:SIO_DEVICE = IT8528
./model_Q0910_Q08F0_10_11.conf:SIO_DEVICE = IT8528
./model_Q07R6_Q08F0_11_11.conf:SIO_DEVICE = IT8528
./model_Q08S0_QY741_20_20.conf:SIO_DEVICE = IT8528
./model_Q08S0_QY740_10_20.conf:SIO_DEVICE = IT8528
./model_SAQ95_SBR00_12_11.conf:SIO_DEVICE = IT8528

It's not as "safe", but you can try to force load the module using insmod qnap8528.ko skip_hw_check=true skipping the hardware check for the chip. If the chip is working correctly, it would find a the boards model codes, and hopefully, wil match with one that exists, if it find the config (it will write it out to dmsg), then it's OK, and you can proceed to test the various controls to check that everything operates correctly.

Please report back, and attach any output from the module so I can have it as a reference.

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

Whoops, here is the ioports from the host (it is the same in the container, not sure where I copied the previous one from :))

0000-0cf7 : PCI Bus 0000:00
  0000-001f : dma1
  0020-0021 : pic1
  0040-0043 : timer0
  0050-0053 : timer1
  0060-0060 : keyboard
  0064-0064 : keyboard
  0070-0071 : rtc_cmos
    0070-0071 : rtc0
  0080-008f : dma page reg
  00a0-00a1 : pic2
  00c0-00df : dma2
  00f0-00ff : fpu
  03e0-03e3 : ene_ir
  0400-0401 : wdat_wdt
  0408-0409 : wdat_wdt
  0412-0413 : wdat_wdt
  0680-069f : pnp 00:01
  0a00-0a0f : pnp 00:00
  0a10-0a2f : pnp 00:00
  0a30-0a4f : pnp 00:00
  0a50-0a6f : pnp 00:00
  0a70-0a7f : pnp 00:00
  0a80-0a8f : pnp 00:00
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
  164e-164f : pnp 00:01
  1800-1803 : ACPI PM1a_EVT_BLK
  1804-1805 : ACPI PM1a_CNT_BLK
  1808-180b : ACPI PM_TMR
  1850-1850 : ACPI PM2_CNT_BLK
  1854-1857 : pnp 00:02
  1860-187f : ACPI GPE0_BLK
  2000-20fe : pnp 00:06
  3000-3fff : PCI Bus 0000:06
  4000-4fff : PCI Bus 0000:05
  5000-5fff : PCI Bus 0000:04
  6000-6fff : PCI Bus 0000:03
  7000-7fff : PCI Bus 0000:02
  8000-8fff : PCI Bus 0000:01
  9000-903f : 0000:00:02.0
  efa0-efbf : 0000:00:1f.4
    efa0-efbf : i801_smbus

Tried force loading the ko in the container, failed as below. Could not insmod on the host since the host does not have insmod. I did try adding it to modules.dep and modprobing it (without skip hardware check) before, and that failed in the same way too.

[294481.601216] qnap8528 @ qnap8528_probe: Skipping HW check for IT8528
[294482.289052] qnap8528: probe of qnap8528 failed with error -524
[294482.289097] qnap8528 @ qnap8528_init: qnap8528 device driver failed to probe, unloading

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

This is a bit silly, but I'm not sure where that return value is coming from. Can you edit the code and initialize ret in qnap8528_probe (line 1139) to 0? maybe it's a dirty page and the ret value is not 0-ed? (int ret = 0; instead of int ret;)

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

This is a bit silly, but I'm not sure where that return value is coming from. Can you edit the code and initialize ret in qnap8528_probe (line 1139) to 0? maybe it's a dirty page and the ret value is not 0-ed? (int ret = 0; instead of int ret;)

Originally, this was ret = qnap8528_skip_hw_check ? 0 : qnap8528_ec_hw_check(); so I did not bother with 0ing ret

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

Same output . I replaced every single instance of int ret; with int ret = 0; and it still returned -524. I think it is the kernel returning -ENOTSUPP for some operation.

[296115.217163] qnap8528 @ qnap8528_probe: Skipping HW check for IT8528
[296115.905936] qnap8528: probe of qnap8528 failed with error -524
[296115.905977] qnap8528 @ qnap8528_init: qnap8528 device driver failed to probe, unloading

Edit: Actually your code returns -ENOTSUPP in certain places. It could be that.

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

This feels like a good candidate for the place of the problem

https://github.com/0xGiddi/qnap8528/blob/master/src/qnap8528.c#L1162

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Agreed, I can only guess right now that this is the result of the qnap8528_find_config returning from if (!strnlen(mb_model, 32) || !strnlen(bp_model, 32)),

Maybe try replacing

if (!strnlen(mb_model, 32) || !strnlen(bp_model, 32))
		return 0;

with

if (!strnlen(mb_model, 32) || !strnlen(bp_model, 32))
{
		pr_info("MB Code: %s", mb_model);
		pr_info("BP Code: %s", bp_model);
		return 0;
}

To see if they are indeed empty.

I was just double checking that the code is consistent and not a random value.

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

They are indeed empty.

[296893.352168] qnap8528 @ qnap8528_probe: Skipping HW check for IT8528
[296894.028743] qnap8528 @ qnap8528_find_config: MB Code: 
[296894.028749] qnap8528 @ qnap8528_find_config: BP Code: 
[296894.028752] qnap8528: probe of qnap8528 failed with error -524

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

If you think it will help, I can try live booting ubuntu and running this kernel module to see if this is something to do with trueNAS as a last resort (tomorrow maybe), although trueNAS scale is also based on Debian.

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Hmmm... they should not be empty.

I was thinking the same thing about reboot into a known system and then with direct access on the host test fore more possibilities. I will also write later a small C program that will dump the VPD tables, see if we can get any data out of them (if they exist). I will post it here, but it will not be in the next few hours.

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

I printed the return value that sets those buffers and we are hitting this: https://github.com/0xGiddi/qnap8528/blob/master/src/qnap8528.c#L464 and getting -EBUSY. Do you know what it is trying to write and where?

I ask because EBUSY is Mount device busy and my host OS has its root FS mounted as RO. I could remount necessary portions as RW if that is the issue. (Maybe it has nothing to do with mounts, just fyi)

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Its breaking up the VPD entry value into the table/offset/length components (See https://github.com/0xGiddi/qnap8528/blob/v1.1/src/qnap8528.h#L27 ) and sending them to the EC for reading, it's not using a filesystem at all, all qnap8528_ec_* function are IO port operations using inb and outb.

If its getting EBUSY, it might mean that the read operations are stuck at waiting for the input buffer or output buffer of the chip to empty (which is either not happening, or not happening in time).

You can try and change the delay to 1000 for example and the retries to 5000 to see if its a timeout issue in (See https://github.com/0xGiddi/qnap8528/blob/v1.1/src/qnap8528.h#L14 )

Also, if you reboot, try going into the BIOS and checking if you can see information about the EC, it usually is displayed there (at least a version number)

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

In addition to making the retries 5000 and the sleep 1000, you might want to try this:

if (qnap8528_ec_write(reg_a, (offs >> 8) & 0xff) || qnap8528_ec_write(reg_b, offs & 0xff)) {
        if(qnap8528_ec_read(reg_c, &raw[i])) {
		return -EBUSY;
        }
}
udelay(5000);

Here

if (qnap8528_ec_write(reg_a, (offs >> 8) & 0xff) || qnap8528_ec_write(reg_b, offs & 0xff) || qnap8528_ec_read(reg_c, &raw[i]))

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Try this branch https://github.com/0xGiddi/qnap8528/tree/ts-464 it only has the delay updates, I also set to skip the HW check by default

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

That is crazy because it works now! The delay was all it needed (and skipping the hardware check, I wonder if there needs to be a delay for that too somewhere). A huge thanks to you for working through this!

[322764.036133] qnap8528 @ qnap8528_probe: Skipping HW check for IT8528
[322765.075840] qnap8528 @ qnap8528_find_config: Searching configs for a match with MB=70-0Q07R1130 BP=70-1Q08F0110
[322765.075851] qnap8528 @ qnap8528_find_config: Model codes match found, model is TS-464
[322765.075918] input: qnap8528 as /devices/platform/qnap8528/input/input6
[322765.075982] qnap8528 @ qnap8528_register_inputs: Buttons input device registered
[322765.076071] qnap8528 @ qnap8528_register_leds: LED devices registered
[322765.171199] qnap8528 @ qnap8528_register_hwmon: Hwmon device registered

Notes from my testing:

  • Only the BTN_2 works (which is what I need). I dont think this has a chassis intrusion/open sensor, but I assumed the power button would be RESET? Or is there a pinhole reset button? I thought so because the power button also does not get reported with /dev/input/event{0,1,2}.
  • I also noticed the temperature values seem arbitrary?
  • The status LED status was incorrect on initialization. The LED was on and green, but the brightness reported 0. Changing it makes it work though, so probably not a big deal. Same with panel brightness, reported 0 when it was at a 100 initially.
  • Setting blink_bicolor to 0 does not turn it off, instead the brightness needs to be set again.
  • How do I blink a regular LED without bicolor, when the readme table says blink supported, see notes? I did not see a note for it. (Minor note, that table has incorrect name for the last entry for panel brightness as USB)
  • HDD LEDs don't seem to be working correctly. They were working fine, but the brightness reported 0. I set it to 1, and LED changed color to red (was green and blinking with activity initially). Now, whatever I set the brightness to, it is stuck at red. I tested with hdd4 LED, I only have 4 drives.
  • I also have a network LED that blinks with network activity, but that is not exposed. Not sure if it is tied directly to the NIC, and not a big deal regardless.

Here are some data I was exploring, let me know if you would like to see something specific.

VPD:

root@qnas:/sys/devices/platform/qnap8528/vpd# ls | xargs -I{} bash -c 'echo {}; cat {}; echo'
backplane_date
2023-11-29 14:07:00
backplane_manufacturer
QNAP Systems
backplane_model
70-1Q08F0110
backplane_name
LF-SATA-BP
backplane_serial
72311015743
backplane_vendor
QNAP Systems
enclosure_nickname

enclosure_serial
Q23BF095953
mainboard_date

mainboard_manufacturer
QNAP Systems
mainboard_model
70-0Q07R1130
mainboard_name
STAT-6G-MB
mainboard_serial
72311014208
mainboard_vendor
QNAP Systems

EuP

root@qnas:/sys/devices/platform/qnap8528/ec# ls
cpld_version  fw_version
root@qnas:/sys/devices/platform/qnap8528/ec# cat cpld_version ; echo
0x2
root@qnas:/sys/devices/platform/qnap8528/ec# cat fw_version ; echo
Q07RL008

Buttons info

root@qnas:/sys/devices/platform/qnap8528/input/input6/capabilities# ls | xargs -I{} bash -c 'echo {}; cat {}'
abs
0
ev
3
ff
0
key
7 0 0 0 0
led
0
msc
0
rel
0
snd
0
sw
0
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat properties             
0
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat min 
0
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat max 
100
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat name
qnap8528
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat phys 
qnap8528/input0
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat poll 
100
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat poll 
100
root@qnas:/sys/devices/platform/qnap8528/input/input6# cat uevent 
PRODUCT=19/0/0/0
NAME="qnap8528"
PHYS="qnap8528/input0"
PROP=0
EV=3
KEY=7 0 0 0 0
MODALIAS=input:b0019v0000p0000e0000-e0,1,k100,101,102,ramlsfw
root@qnas:/sys/devices/platform/qnap8528/input/input6/power# ls | xargs -I{} bash -c 'echo {}; cat {}'
autosuspend_delay_ms
cat: autosuspend_delay_ms: Input/output error
control
auto
runtime_active_time
0
runtime_status
unsupported
runtime_suspended_time
0
root@qnas:/sys/devices/platform/qnap8528/input/input6/id# ls | xargs -I{} bash -c 'echo {}; cat {}'
bustype
0019
product
0000
vendor
0000
version
0000

Button test

root@qnas:/# evtest /host/dev/input/event6 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "qnap8528"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 256 (BTN_0)
    Event code 257 (BTN_1)
    Event code 258 (BTN_2)
Properties:
Testing ... (interrupt to exit)
Event: time 1732197325.242336, type 1 (EV_KEY), code 258 (BTN_2), value 1
Event: time 1732197325.242336, -------------- SYN_REPORT ------------
Event: time 1732197325.554340, type 1 (EV_KEY), code 258 (BTN_2), value 0
Event: time 1732197325.554340, -------------- SYN_REPORT ------------

Fan Control

root@qnas:/sys/class/hwmon/hwmon4# cat fan1_input 
1126
root@qnas:/sys/class/hwmon/hwmon4# cat pwm1 
94
root@qnas:/sys/class/hwmon/hwmon4# echo 100 > pwm1
root@qnas:/sys/class/hwmon/hwmon4# cat pwm1 
99
root@qnas:/sys/class/hwmon/hwmon4# cat fan1_input 
1154
root@qnas:/sys/class/hwmon/hwmon4# echo 50 > pwm1 
root@qnas:/sys/class/hwmon/hwmon4# cat pwm1 
48
root@qnas:/sys/class/hwmon/hwmon4# cat fan1_input 
562
root@qnas:/sys/class/hwmon/hwmon4# echo 94 > pwm1  
root@qnas:/sys/class/hwmon/hwmon4# ls temp* | xargs -I{} bash -c 'echo {}; cat {}'
temp11_input
2000
temp12_input
2000
temp1_input
42000
temp6_input
34000

LED

root@qnas:/sys/class/leds# cat qnap8528\:\:usb/brightness 
0
root@qnas:/sys/class/leds# echo 1 > qnap8528\:\:usb/brightness 
root@qnas:/sys/class/leds# cat qnap8528\:\:usb/brightness 
1
# ^ This actually turned the LED on and off
root@qnas:/sys/class/leds# cat qnap8528\:\:status/brightness 
0
root@qnas:/sys/class/leds# echo 2 > qnap8528\:\:status/brightness 
root@qnas:/sys/class/leds# echo 1 > qnap8528\:\:status/brightness 
root@qnas:/sys/class/leds# echo 0 > qnap8528\:\:status/brightness 
root@qnas:/sys/class/leds# echo 1 > qnap8528\:\:status/brightness 
# ^ Changes color correctly to green/red
root@qnas:/sys/class/leds# cat qnap8528\:\:panel_brightness/brightness 
0
root@qnas:/sys/class/leds# echo 50 > qnap8528\:\:panel_brightness/brightness 
root@qnas:/sys/class/leds# echo 10 > qnap8528\:\:panel_brightness/brightness 
root@qnas:/sys/class/leds# echo 100 > qnap8528\:\:panel_brightness/brightness 
root@qnas:/sys/class/leds# cat qnap8528\:\:hdd4/brightness 
0
root@qnas:/sys/class/leds# echo 1 > qnap8528\:\:hdd4/brightness 
root@qnas:/sys/class/leds# echo 2 > qnap8528\:\:hdd4/brightness 
root@qnas:/sys/class/leds# echo 3 > qnap8528\:\:hdd4/brightness 
root@qnas:/sys/class/leds# echo 0 > qnap8528\:\:hdd4/brightness 
root@qnas:/sys/class/leds# echo 0 > qnap8528\:\:hdd4/brightness 
# ^ Stuck at RED now, even 1 set it to red.

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

That is crazy because it works now! The delay was all it needed (and skipping the hardware check, I wonder if there needs to be a delay for that too somewhere). A huge thanks to you for making this!

Amazing, Did you add any additional delays like I commented or did you use the ts-464 branch? Just so I know what exact delays and where worked.

Notes from my testing:

  • Only the BTN_2 works (which is what I need). I dont think this has a chassis intrusion/open sensor, but I assumed the power button would be RESET? Or is there a pinhole reset button? I thought so because the power button also does not get reported with /dev/input/event{0,1,2}.

Reset is the pinhole button (on my model), I have not checked if power button is reported at all.

  • I also noticed the temperature values seem arbitrary?

This might happen, as they are enumerated dynamically (any channel with a temperature between 0 and 128 is valid), if you check the README, you will see that temp channels 11 and 12 are for redundant power temp sensors, so they are invalid, but reporting a state I cannot discriminate against. Also, be wary of temp1, as this is supposed to be "CPU", but CPU is temp reported by other modules (such as k10temp on my AMD device, and temp1 does not match k10 temp reports)

  • The status LED status was incorrect on initialization. The LED was on and green, but the brightness reported 0. Changing it makes it work though, so probably not a big deal. Same with panel brightness, reported 0 when it was at a 100 initially.
  • Setting blink_bicolor to 0 does not turn it off, instead the brightness needs to be set again.

Yes, the brightness reported back from the kernel is entirely software based (part of the led subsystem), so initially they will all be 0.

  • How do I blink a regular LED without bicolor, when the readme table says blink supported, see notes? I did not see a note for it. (Minor note, that table has incorrect name for the last entry for panel brightness as USB)

LED blinking is done with standard Linux triggers (echo <timer|oneshot> > /sys/class/leds/qnap8528\:\:status/trigger), usually, this requires ledtrig_timer, ledtrig_oneshot or other kernel triggers (ledtrig_* family) to be registered. This way, if hardware blink is not available the kernel will trigger the blinking via SW.

Maybe I should add a custom attribute to set the HW blink even if not triggers are available?

  • HDD LEDs don't seem to be working correctly. They were working fine, but the brightness reported 0. I set it to 1, and LED changed color to red (was green and blinking with activity initially). Now, whatever I set the brightness to, it is stuck at red. I tested with hdd4 LED, I only have 4 drives.

From the information you provided, your codes are Q07R1 and Q08F0, which out of all the TS-464 devices, is the one that for some reason does not have EC indexes for setting the green LED, if that the case, the values 1 and 2 are treated as RED led. I thought that since I do not turn off the green LED (https://github.com/0xGiddi/qnap8528/blob/master/src/qnap8528.c#L611) it would revert to green when turning off red.

The LEDs are a pain for the brain, currently, they only way to get them back would be to restart the NAS. I will push another change to TS-464 branch that will try and set the green LED even if does not exist, maybe this is a mistake in QNAPs config I was parsing.

  • I also have a network LED that blinks with network activity, but that is not exposed. Not sure if it is tied directly to the NIC, and not a big deal regardless.

There is no (known) interface for the network LED, it seems to be hardwired as far as I can tell.

Thank you for the data much appreciated.

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Please pull the latest TS-464 branch (https://github.com/0xGiddi/qnap8528/tree/ts-464) and check if you can set the LEDs to green.

More info about the change:
This is the information about disks slots from the TS-464 config for your device:

[System Disk 3]
DEV_BUS = B00:D28:F2
DEV_PORT = 2
ERR_LED = EC:1
LOCATE_LED = EC:1
SLOT_NAME = Disk 1
SLOT_POWER_CONTROL = EC:1
SLOT_PRESENCE_DETECTION = EC:1
[System Disk 4]

Compare that to my device for example:

[System Disk 3]
DEV_BUS = B00:D01:F7
DEV_PORT = 0
BLINK_LED = EC:1
ERR_LED = EC:1
PRESENT_LED = EC:1
LOCATE_LED = EC:1
SLOT_NAME = Disk 1

You can see the missing PRESENT_LED and BLINK_LED entries in your config. On my device when testing, if I set the red led when the green was on, and only turned off the red LED, the green would come back (as it was never "off"). Myabe I have a logical bug in the slot LED handling code? Ill need to read through it.

For now, I have just added the green LED into the config, so would "support" green slot LEDs, but I dont know if this is OK since QNAP specifically omitted it from the config. But its worth the test. A reset of the device should set all LEDs back yo their default state.

Changes made to qnap8528 config:
6099e36

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

First ID byte: 0xff
Second ID byte: 0xff

I ran the same binary (since host does not have gcc) and got the same result as step 3 on the host

Note to self: This seems to be device with ENE ECs

https://nascompares.com/review/qnap-ts-464-nas-drive-review-hardware-heavy/
https://nascompares.com/wp-content/uploads/2022/04/QNAP-TS-464-NAS-Review-8.jpg
https://nascompares.com/wp-content/uploads/2022/04/QNAP-TS-464-NAS-Review-Hardware-10-Medium.jpg

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Update: I think I found the bug:
https://github.com/0xGiddi/qnap8528/blob/ts-464/src/qnap8528.c#L614
I'm checking active and not error. maybe the config change isn't needed. I'll revert the change to the config and fix the setting

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

Please pull https://github.com/0xGiddi/qnap8528/tree/ts-464 and try again

@adyanth
Copy link
Author

adyanth commented Nov 21, 2024

There was a hardware refresh beginning of 2024. That might be when it changed. I can try the changes later today and report back.

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 21, 2024

I have pushed all the changed to master branch and tag v1.2 if you want to work with the changed I'm adding to see if it will now work with no extra debugging steps.

@adyanth
Copy link
Author

adyanth commented Nov 22, 2024

Amazing, Did you add any additional delays like I commented or did you use the ts-464 branch? Just so I know what exact delays and where worked.

I was using the branch.

LED blinking is done with standard Linux triggers

Oh I see, that makes sense. I expected something else to be exposed since I saw the bicolor_blink. This is fine for me.

With v1.2:

It still does not pass the initial probe with:

[365596.139361] qnap8528 @ qnap8528_ec_hw_check: Could not locate IT8528 EC device
[365596.139376] qnap8528 @ qnap8528_init: qnap8528 device driver failed to probe, unloading

I have not restarted the NAS after the previous testing. Currently, echoing 0 to the HDD LED caused it to go back to like it was before (green and blinking) and 1 caused it to go red. I think that is how it is intended and works well.

Was there anything else you wanted me to test? Outside of needed to skip the hardware check, I am resolved with this issue. I'll leave the issue open to see if you needed any further follow ups/tests from me.

@0xGiddi
Copy link
Owner

0xGiddi commented Nov 22, 2024

I did not remove the ec check from the main branch, I will add more information in the supported models table and the install process for exceptions like the ts-464.

Im happy everything is resolved, nothing else for now, I’ll keep the issue open just to remind me to go over everything and check that I have covered all things that came up either documentation.

feel free to open another for any other problem and thank you for all the feedback.

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

2 participants