onitake / gsl-firmware

Firmware repository for Silead touchscreen controllers
320 stars 200 forks source link

I have tried to understand what it takes to add touch to Insignia Flex 2017 #117

Open CoolGames opened 5 years ago

CoolGames commented 5 years ago

The Insignia Flex firmware seems to be what I have except mine is much newer. I can't begin to understand how or why I need to recompile the kernel if "silead_ts ships with the Linux kernel since version 4.8 and is the recommended driver." I have the files attached zip from the Windows 10 1809 found at /Windows/System32/DriverStore/FileRepository/sileadtouch.inf_x86_1ceb09f9397207c1/ that work in Windows 10 but not sure why the files in this repository don't. flex11_6_2017.zip

`$ uname -a Linux coolflex11 4.15.0-46-lowlatency #49-Ubuntu SMP PREEMPT Wed Feb 6 10:23:17 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ dmesg | grep silead [ 6.726389] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply vddio not found, using dummy regulator [ 6.726459] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply avdd not found, using dummy regulator [ 6.731862] silead_ts i2c-MSSL1680:00: Silead chip ID: 0x80360000 [ 6.733179] silead_ts i2c-MSSL1680:00: Registers clear error -11 [ 6.857150] silead_ts: probe of i2c-MSSL1680:00 failed with error -11

` I used the MSSL1680 approach to place renamed as MSSL1680.fw firmware in zip in /lib/firmware/silead

Was that all that was needed or do I need to build something. This is a REAL slow CPU using the recently released ATOM 32 bit UEFI and 64 Bit Ubuntu from Blog at linuxium running on a 128 GB micro SD with the Boot directory on Windows root drive. It took two years to find it done March 4,2019. The audio needed the HDMI blacklisted in November 2018.

Please help get the touch working , too.

lilithebowman commented 5 years ago

I tried that firmware and it's not as good as the Insignia Flex firmware.fw

At least with that I have touch registering but only in the bottom right of the screen (moving the cursor to the top left randomly).

Seems like that firmware is just missing a setting or something.

lilithebowman commented 5 years ago

I downloaded your file above and ran scanwindrv on it to produce the firmware_00.fw and put that in the firmware folder with the right name and it works! Kind-of!

It only maps to half the screen and the vertical axis is flipped but it works! https://www.youtube.com/watch?v=erkn7wfRQAs

I also reset my BIOS settings to default to make sure that was not interfering.

onitake commented 5 years ago

You should be able to correct the flipped axis with a DMI override. Missing input on one side indicates unsuitable firmware, however.

lilithebowman commented 5 years ago

@onitake Thanks for the reply!

I didn't find it clear how to do a DMI override but I'll read the README again I guess.

"Missing input on one side" Well, it maps to 1/4 of the screen. So maybe they used a few different models of touchscreen for the Insignia Flex 11? Hmm...

There's no way I can change that mapping or scaling without finding a different driver?

onitake commented 5 years ago

Read this section: https://github.com/onitake/gsl-firmware#silead_ts

You don't need a different driver, but you need a firmware blob that maps exactly to your screen. You also need to pass parameters to the kernel driver that configure the touchscreen's dimensions, screen flipping and other properties.

lilithebowman commented 5 years ago

Sorry, I used the word driver when I meant firmware. Yeah no other firmware blob has produced any results but this one.

So you're saying I'm going to need to recompile my kernel on the tablet machine then? I've done that once or twice but I was hoping to avoid it. Okay.|

(Note: I have the same model of tablet as the OP of this issue.)

I don't have Windows 10 on the tablet anymore so I can't extract the drivers myself, but I did find some and collected them in a repository: https://github.com/eanbowman/Insignia-Flex-11.6-NS-P11W6100-Drivers

Would the I2C driver here be a good candidate for running scanwindrv on?

https://github.com/eanbowman/Insignia-Flex-11.6-NS-P11W6100-Drivers/blob/master/BaytrailSOC_GPIO_UART_I2C_PWM_Win10_32_122815/Drivers/x86/I2C/iaioi2c.sys

onitake commented 5 years ago

I'm afraid that's the only way to actually make the driver recognise the hardware properly. Originally, there was an effort by an Intel engineer to build proper ACPI-based configuration for Silead touchscreen controllers, but by that point, it was already too late. The market was already flooded by cheap Baytrail tablets that only work right with the preinstalled Windows or Android drivers. Some vendors offer their drivers as a separate download, and that's the only way to even get the touchscreen working on any OS, or obtain firmware for Linux.

That driver doesn't look right to me. I think it's only for the I²C controller in the SoC, not the touchscreen.

If you've already lost the original Windows installation, you might have some luck getting the drivers or a Windows image from the store where you bought the tablet.

Perhaps identifying the exact model might help, have you already run dmidecode to get the system identifiers?

lilithebowman commented 5 years ago

Like I said, it's the same tablet as the OP has. NS-P11W6100. I don't have it in front of me. Maybe W7100? Yeah the seller wiped it somehow so I'm not sure if they have an install or if they simply told Windows to revert to factory defaults. It was an eBay purchase in a generic box.

[Edit] Yeah it's the NS-P11W7100

https://github.com/onitake/gsl-firmware/tree/master/firmware/insignia/flex11

So would it be the driver from here? I tried that one first. I think firmware.fw copying to the right folder is the only other one that produced results. It was EVEN SMALLER. About 1/8th of my screen was touchable and it mapped to a 1/8th of the screen region at the top right if I tapped the bottom right.

Also, it wasn't even a linear mapping with the firmware in this repository. It was randomly jumping left and right within that tiny region at the top left when touched at the bottom right.

On the good side, I can probably just download a Windows 10 home 32 bit ISO and put it on a USB stick and install that. I'd rather not do that but in a pinch maybe.

I think MS might automatically be able to download the right driver.

I'll run dmidecode at home later.

lilithebowman commented 5 years ago

dmidecode.txt

onitake commented 5 years ago

This is what you should match:

System Information Manufacturer: Insignia Product Name: NS-P11W7100 and possibly: SKU Number: 5255800

With the firmware.fw in https://github.com/onitake/gsl-firmware/tree/master/firmware/insignia/flex11 , can you create the necessary DMI override for the kernel and see if it helps? Perhaps you simply need the right parameters to make it work.

And about the Windows driver: It's highly unlikely (but not impossible) that the manufacturer has uploaded the driver for this particular device to the Windows driver store. At least, that wasn't the case for any of the tablets I've seen so far. If you remove the preinstalled OS and the vendor doesn't offer a complete driver package on their website, you're out of luck. Maybe someone else with the same tablet can help.

lilithebowman commented 5 years ago

Do I have to re-compile the kernel or... ?

I checked how to do that for Ubuntu (running Xubuntu) and it says I might not need to but only change the headers. But the file in the instructions on the README.md does not exist in the headers.

I guess it's an unsupported situation if I recompile the kernel in Ubuntu but that's fine for just this tablet.

I'm just not sure what to do, really. It's been a while since I did it. Mostly with Gentoo.

onitake commented 5 years ago

I'm afraid that you do have to recompile the kernel.

The part that does driver pre-initialisation is not part of any kernel modules or easily replaceable code. You really have to recompile the kernel and reload it (via rebooting or kexec), so the hardware gets re-matched and all drivers get loaded with the correct parameters.

Once you get your touchscreen to work, you can submit your working firmware to this repository (into firmware/linux/silead) and and the kernel patch to the linux-input mailing list. They will review it and merge it into the mainline Linux kernel, which means that other users of the same tablet will automatically get support for it at some point.

CoolGames commented 5 years ago

Latest upgrade to Ubuntu 19.04 kernel and take these steps

Linux xxxxxxx 5.0.0-23-generic #24-Ubuntu SMP Mon Jul 29 15:36:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

sudo cp /lib/firmware/silead/silead_ts.fw /lib/firmware/silead/mssl1680.fw

Check for activation

dmesg | grep silead
[    9.081715] input: silead_ts as /devices/pci0000:00/808622C1:01/i2c-1/i2c-MSSL1680:00/input/input10

Trial and error calibrate with xinput_calibrator

yields something like

# xinput set-prop 16 305 1.0, 0.0, 0.0,    0.0, -1.0, 1.0,    0.0, 0.0, 1.0
xinput set-prop "silead_ts" "libinput Calibration Matrix" 2.2, 0.0, -0.04,    0.0, -2.7, 1.0,    0.0, 0.0, 1.0
lilithebowman commented 5 years ago

@CoolGames

lilithe@signet:~$ uname -sr
Linux 5.0.0-25-generic
lilithe@signet:~$ sudo cp /lib/firmware/silead/silead_ts.fw /lib/firmware/silead/mssl1680.fw 
[sudo] password for lilithe: 
cp: cannot stat '/lib/firmware/silead/silead_ts.fw': No such file or directory
lilithe@signet:~$ 

Let's try with the firmware I have:

lilithe@signet:~$ sudo dmesg | grep silead
[    5.806841] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply vddio not found, using dummy regulator
[    5.806885] silead_ts i2c-MSSL1680:00: Linked as a consumer to regulator.0
[    5.806889] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply avdd not found, using dummy regulator
[    5.807238] silead_ts i2c-MSSL1680:00: Silead chip ID: 0x80360000
[    7.432914] input: silead_ts as /devices/pci0000:00/808622C1:05/i2c-5/i2c-MSSL1680:00/input/input14
lilithe@signet:~$ 

Calibration:

lilithe@signet:~$ sudo xinput_calibrator 
Calibrating standard Xorg driver "silead_ts"
    current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
    If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
    --> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "silead_ts"
    Option  "MinX"  "540"
    Option  "MaxX"  "31032"
    Option  "MinY"  "24308"
    Option  "MaxY"  "-5"
    Option  "SwapXY"    "0" # unless it was already set to 1
    Option  "InvertX"   "0"  # unless it was already set
    Option  "InvertY"   "0"  # unless it was already set
EndSection

Currently working on updating the DMI settings and recompiling. Just taking a while to figure out how to do it properly. I've already edited the source to add the Insignia Flex 11.6". It wasn't in there so no surprise it isn't supported out of the box.

lilithebowman commented 5 years ago

@onitake I have managed to compile the kernel and install the resulting deb files for Ubuntu Bionic including my changes.

https://gitlab.eanbowman.com/ean/ubuntu-bionic/merge_requests/1/diffs

The link above shows what I changed. It still works the same, with the taps registering for the whole screen, but they only map to the top left quarter and Y is flipped.

Am I missing something?

onitake commented 5 years ago

Thats's promising! It looks like you finally got the right firmware.

You still need to tweak the parameters though. Determine what range the X and Y coordinates have and put the correct values in. You can tune the values later with xinput_calibrator. Note that you can also specify minimum values.

As for the flipped Y axis - it looks like you should remove the touchscreen-inverted-y flag?

lilithebowman commented 5 years ago
    current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
    If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
    --> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "silead_ts"
    Option  "MinX"  "506"
    Option  "MaxX"  "31135"
    Option  "MinY"  "24555"
    Option  "MaxY"  "202"
    Option  "SwapXY"    "0" # unless it was already set to 1
    Option  "InvertX"   "0"  # unless it was already set
    Option  "InvertY"   "0"  # unless it was already set
EndSection

Hmm, maybe my values need to be more like this?

onitake commented 5 years ago

If possible, put roughly correct values into you kernel patch. That will save others from needing to recalibrate later. Note that the value range doesn't necessarily to correspond with what Xinput gives you.

Try evtest to determine the full range of the digitiser.

lilithebowman commented 5 years ago

evtest.txt I did evtest and touched the bottom left, top left, top right, and bottom right corners.

It seems that Y is closer to zero at the bottom left.

Top right is about 1920x1650 which tracks with the data on the Insignia Flex page of this repository.

I think that my settings in the silead_dmi.c file are being completely ignored. No matter what I've changed, it does not change anything with my touch input. It works the same as the default kernel with this driver.

lilithebowman commented 5 years ago

It works! It now maps to the whole screen.

THIS is what worked for me: https://github.com/notro/fbtft/issues/445#issuecomment-354714529

Should I still bother submitting a kernel patch? I don't think it did anything...

Also noteworthy: this touchscreen is as garbage as it was in Windows, but maybe a little worse.

image

lilithebowman commented 5 years ago

image

onitake commented 5 years ago

Can you verify if the kernel is loading your "custom" firmware? You should see a line like

firmware: direct-loading firmware silead/gsl3670-insignia_flex11.fw

somewhere in dmesg output.

I think we should definitely prepare a patch so others with the same tablet get good support out of the box. Since you already figured out the correct parameters, it shouldn't be too hard to transfer them to the DMI config, once we figure out if and why the override doesn't work.

From my experience, it's usually just the wrong DMI parameters being compared.

onitake commented 5 years ago

Oh, and the second most common case of mismatches are trailing spaces or other unprintables.

lilithebowman commented 5 years ago
lilithe@signet:~$ sudo dmesg | grep Insignia
[sudo] password for lilithe: 
[    0.000000] DMI: Insignia NS-P11W7100/NS-P11W7100, BIOS 5.11 07/05/2016
lilithe@signet:~$ sudo dmesg | grep "silead"
[    5.339149] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply vddio not found, using dummy regulator
[    5.339196] silead_ts i2c-MSSL1680:00: Linked as a consumer to regulator.0
[    5.339201] silead_ts i2c-MSSL1680:00: i2c-MSSL1680:00 supply avdd not found, using dummy regulator
[    5.339505] silead_ts i2c-MSSL1680:00: Silead chip ID: 0x80360000
[    6.827278] input: silead_ts as /devices/pci0000:00/808622C1:05/i2c-5/i2c-MSSL1680:00/input/input14
lilithe@signet:~$ 

I don't think so. I'll try fixing the DMI detection. Did you see my diff above?

https://gitlab.eanbowman.com/ean/ubuntu-bionic/merge_requests/1/diffs

onitake commented 5 years ago

Yes, I saw it. But I don't see anything about the firmware in your dmesg output. Can you check again?

lilithebowman commented 5 years ago

dmesg.txt Yeah, I can't find it either. Really strange since it's working.

[sudo] password for lilithe: 
[    0.138875] Spectre V2 : Enabling Restricted Speculation for firmware calls
[    5.626202] iwlwifi 0000:01:00.0: loaded firmware version 29.1044073957.0 op_mode iwlmvm
onitake commented 5 years ago

Ah... I think I know what's going on. request_firmware only prints a warning when the firmware can't be found. Otherwise, you get debug messages. Can you run dmesg -n 8 to also get debug output?

lilithebowman commented 5 years ago

sudo dmesg -n 8 produced no output sudo dmesg -l debug produced the following:

dmesgdebug.txt

AlexRudyak commented 1 year ago

This post looks very promising, been 4 years, Is there a simpler guide I might follow ? or at least list the steps required ?

lilithebowman commented 1 year ago

@AlexRudyak https://www.lilithebowman.com/blog/2019/09/07/how-to-get-the-touchscreen-working-in-xubuntu-linux-on-an-insignia-flex-11-6-tablet/ wrote it in a blog format a long time ago.

AlexRudyak commented 1 year ago

@AlexRudyak https://www.lilithebowman.com/blog/2019/09/07/how-to-get-the-touchscreen-working-in-xubuntu-linux-on-an-insignia-flex-11-6-tablet/ wrote it in a blog format a long time ago.

Your guide is by far the most extensive ive seen and I thank you very much for the hard work you put into it,

Some details are missing for me, for example the exact operating system used, xubuntu 16?

I've found some forums that even said to recompile a custom kernel which I did but the compilation failed, unfortunately I'm still left with a non working copy (unfortunately for me of course xD)