Firmware update with HID default mouse driver

302 views
Skip to first unread message

Lak Fu

unread,
Mar 26, 2018, 11:46:09 PM3/26/18
to Chromium OS dev
Hi, everyone~

Last time, I trying to setup my touchpad on a Chromebook, and now, I succeed for driving my touchpad with I2C-HID & default HID mouse driver (it seems will be hid-multitouch.c).
There is possible to update firmware with "firmware_request" interface without submit a specific driver? I mean, is hid-multitouch driver support to update firmware with "firmware_request" hotplug interface? Such like a generic firmware update interface.

It seems Chrome ask us to update firmware though this interface but I really don't want to submit a new driver because we actually work fine with I2C-HID and default mouse driver...

Thank everyone for helping me.

Dmitry Torokhov

unread,
Mar 27, 2018, 1:01:37 AM3/27/18
to Lak Fu, Chromium OS dev
[once again, resending from @chromium.org address so my reply makes it to the mailing list]

Hi Lak,

The firmware update procedure is controller-specific, and so there is not generic firmware update method in hid-multitouch.

The firmware update is typically done via HID transport using vendor-specific commands/reports and other touch vendors supplied us with userspace utilities that access devices via /dev/hidrawX interface and perform the updates. Please take a look at the code in https://chromium.googlesource.com/chromiumos/platform/touch_updater especially the scriptlets for Wacom and Weida HID devices.

Thanks,
Dmitry


--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Message has been deleted
Message has been deleted

Lak Fu

unread,
Mar 27, 2018, 5:18:02 PM3/27/18
to Chromium OS dev
Why do my post be deleted? 
Am I do anything wrong?

Lak Fu <lak4...@gmail.com> 於 2018年3月27日 週二 15:46 寫道:
Hi Dmitry,
It means I need to develop a executable based on HIDRAW API and provide a script to handle the firmware update.
So, I can 
1). Find my device with libudev API. (Have any other way to find my device?)
2). Open/Read/Write the dev with ioctrl (hidraw API)

Is my understand correct?

Dmitry Torokhov於 2018年3月27日星期二 UTC+8下午1時01分37秒寫道:
--
By Lak

Daniel Erat

unread,
Mar 27, 2018, 5:19:29 PM3/27/18
to Lak Fu, Chromium OS dev
No, you're not doing anything wrong. The mailing list's spam filter is just unreliable. :-(
Message has been deleted
Message has been deleted

Dmitry Torokhov

unread,
Mar 30, 2018, 3:31:35 PM3/30/18
to Lak Fu, Chromium OS dev
Hi Lak,

On Tue, Mar 27, 2018 at 12:46 AM, Lak Fu <lak4...@gmail.com> wrote:
Hi Dmitry,
It means I need to develop a executable based on HIDRAW API and provide a script to handle the firmware update.
So, I can 
1). Find my device with libudev API. (Have any other way to find my device?)

I do not think you need to use libudev to locate your device in the executable, but rather accept the device path (such as /dev/hidrawNNN) as a command line option for the executable. The scripts in the touch updater should be able to locate devices serviced by i2c-hid + hid-multitouch and find the /dev/hidrawNNN nodes corresponding to these devices and they will call your executable with that node.

Please take a look at:


and


You will need to replicate it for your controller.

Hope this helps,
Dmitry

2). Open/Read/Write the dev with ioctrl (hidraw API)

Is my understand correct?

Dmitry Torokhov於 2018年3月27日星期二 UTC+8下午1時01分37秒寫道:
[once again, resending from @chromium.org address so my reply makes it to the mailing list]

Lak Fu

unread,
Mar 30, 2018, 9:38:30 PM3/30/18
to Dmitry Torokhov, Chromium OS dev
Thank you for your help!
--
By Lak

Lak Fu

unread,
Apr 2, 2018, 2:48:27 AM4/2/18
to Chromium OS dev, lak4...@gmail.com
Hi Dmitry,
I will try to use this to find my device and call your executable with it.

Dmitry Torokhov於 2018年3月31日星期六 UTC+8上午3時31分35秒寫道:

Lak Fu

unread,
May 9, 2018, 1:00:08 AM5/9/18
to Chromium OS dev, lak4...@gmail.com
Hi everyone, 
Finally, I think I can control my device with HIDRAW interface, and actually it is pretty easy to do that, good interface.
But I encounter a new problem, when I doing my job, the HID report descriptor will be changed, but HIDRAW/HID driver don't ask the HW again. 
Is there have any interface can force the HIDRAW or HID driver re-init/re-bind my drive again?

Thanks for your support.

Lak Fu於 2018年4月2日星期一 UTC+8下午2時48分27秒寫道:

Nicolas Boichat

unread,
May 9, 2018, 1:23:15 AM5/9/18
to Lak Fu, Chromium OS dev
Something like this should work:

cd /sys/bus/i2c/drivers/i2c_hid
ls
=> Check for symlink to figure out your_device below:
echo your_device > unbind
echo your_device > bind

Dmitry Torokhov

unread,
May 9, 2018, 1:25:59 AM5/9/18
to Nicolas Boichat, Lak Fu, Chromium OS dev
I'm pretty sure we rebind as part of firmware update procedure in thouch_updater scripts.

Dmitry Torokhov

unread,
May 9, 2018, 1:32:04 AM5/9/18
to Nicolas Boichat, Lak Fu, Chromium OS dev
See chromeos-touch-common.sh::rebind_driver() - you can call it after updating the firmware.

Lak Fu

unread,
May 9, 2018, 3:10:02 AM5/9/18
to Chromium OS Development, drin...@chromium.org, lak4...@gmail.com
wow, I see, thanks.
But I mean that I need to rebind device during updating.
I have write my script based-on rebind() function, it is work fine, but I hope I can control those thing with my program, not script..   
(If I fully rely the script, it may look like .....
...
update_tool arg1
$(rebind "$i2c_device_path")
update_tool arg2
...
And I think it is a little bit ugly... XD)

So, I can open the corresponding bind and unbind file (with open()), and write the device name like the script to trigger unbind and bind, is it right?

Dmitry Torokhov於 2018年5月9日星期三 UTC+8下午1時32分04秒寫道:

Dmitry Torokhov

unread,
May 9, 2018, 4:40:21 PM5/9/18
to Lak Fu, Chromium OS Development, drin...@chromium.org
Hmm, it is surprising that you need to rebind the device halfway though firmware update. Can you please tell me why exactly it is needed? The HID descriptors in kernel might not be updated, but when accessing through hidraw interface it should be of no concern to you...

Lak Fu

unread,
May 22, 2018, 10:32:12 PM5/22/18
to Chromium OS Development, lak4...@gmail.com, drin...@chromium.org
Hi Dmitry,
Sorry for late reply.
The reason is pretty simple, firmware requirement. I just follow the spec, it will provide another interface (HID descriptor) when host send specific commands. So I need to force kernel re-bind it again to update HID descriptor.
Actually, no matter whether it be rebind or not, I still can send my feature commands directly without check HID descriptor, but I think if I can make a check will be better.

Dmitry Torokhov於 2018年5月10日星期四 UTC+8上午4時40分21秒寫道:

Lak Fu

unread,
Jun 15, 2018, 4:50:37 AM6/15/18
to Chromium OS Development
Hi, everyone.
Finally, I create a firmware update tool (executable) for upgrade my touchpad. And I verified it on Crouton, it works very well.
Next, I copy my tool back to chronos environment and put it to /usr/local/bin/, try to execute it.

Then... I meet a link error ...
/usr/lib64/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found

I think it is because I built my executable with C++11, so is chromeos not support to execute the program with C++11?
Or am I missing anything? 

The Linux version is 4.4.112 (uname -r)

Thanks for your support.

Lak Fu於 2018年3月27日星期二 UTC+8上午11時46分09秒寫道:

Lak Fu

unread,
Jun 15, 2018, 5:14:25 AM6/15/18
to Chromium OS Development
Well, I think I fixed it with a static link. Thanks.

Lak Fu於 2018年3月27日星期二 UTC+8上午11時46分09秒寫道:

Mike Frysinger

unread,
Jun 15, 2018, 8:40:01 AM6/15/18
to Lak Fu, chromium-os-dev
if you want to run code inside of CrOS, you should build it with the CrOS toolchain instead
-mike

--

ggg

unread,
Jun 18, 2018, 7:16:54 PM6/18/18
to Chromium OS Development


On Friday, June 15, 2018 at 2:14:25 AM UTC-7, Lak Fu wrote:
Well, I think I fixed it with a static link. Thanks.

This is a very fragile "workaround": the chromeos lib version could change and the version your binary links against could change. Mike is right that the binary should be built using chrome os compillers/linkers and the lib names won't be a problem.

cheers,
grant

Lak Fu

unread,
Jun 19, 2018, 12:09:17 AM6/19/18
to Chromium OS Development, lak4...@gmail.com
Thank Mike and ggg.
Now, I built my executable with Chromeos build environment (cros_sdk). It work perfect.

Mike Frysinger於 2018年6月15日星期五 UTC+8下午8時40分01秒寫道:

Lak Fu

unread,
Aug 6, 2018, 11:02:35 PM8/6/18
to Chromium OS Development
Hi, everyone.
Now, I think that is the last steps to finish this task. 
I am preparing the commits for submit firmware update tool.
But again, I encounter a new trouble, I cannot generate manifest for my .ebuild.

I write a .ebuild (ex: my-tp-util-0.0.1.ebuild) that declare our firmware update tool (in Github), and I try to generate its manifest file with the following command but it is seems failed, the build system try to download package from Chromeos-localmirror, not Github that I specified.
    > ebuild my-tp-util-0.0.1.ebuild manifest
After checked the document, I try another command, but it is failed too.
    > sudo emerge my-tp-util

Am I missing anything?

And another question, how to build a test image for test my firmware update tool?
I know I need to register my touchpad device (I2C-HID), but I don't know how to build a image to include my update tool and how to invoke it.
Would somebody like to help me figure out about it? I would be so grateful.

Lak Fu於 2018年3月27日星期二 UTC+8上午11時46分09秒寫道:

Allen Webb

unread,
Aug 7, 2018, 10:29:13 AM8/7/18
to lak4...@gmail.com, Chromium OS dev
try:
ebuild-${BOARD} <package> --digest

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev
---
You received this message because you are subscribed to the Google Groups "Chromium OS Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-d...@chromium.org.

Lak Fu

unread,
Aug 7, 2018, 10:30:27 PM8/7/18
to Chromium OS Development, lak4...@gmail.com
Hi Allen,
Thanks, but it still failed. And, actually I have try other original package (another fw update tool, sisConsoletool), I got the same error result. So I think my command should be wrong.
(cr) ((4d9d703774f...)) lake@OA-106028 /mnt/host/source/src/third_party/chromiumos-overlay/chromeos-base/my-tp-util $ ebuild-${BOARD} my-tp-util-0.0.1.ebuild digest
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
No digest file available and download failed.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
No digest file available and download failed.

!!! Couldn't download 'my-tp-util-0.0.1.tar.gz'. Aborting.
!!! Fetch failed for my-tp-util-0.0.1.tar.gz, can't update Manifest


Allen Webb於 2018年8月7日星期二 UTC+8下午10時29分13秒寫道:

Mike Frysinger

unread,
Aug 7, 2018, 10:35:51 PM8/7/18
to Lak Fu, chromium-os-dev
set RESTRICT=nomirror in the ebuild before running digest
-mike

Lak Fu

unread,
Aug 9, 2018, 2:21:33 AM8/9/18
to Chromium OS Development, lak4...@gmail.com
Hi Mike,
Thanks, I got my Manifest file.
Now, I think I can going to make a test build...

Mike Frysinger於 2018年8月8日星期三 UTC+8上午10時35分51秒寫道:

Lak Fu

unread,
Aug 17, 2018, 4:30:12 AM8/17/18
to Chromium OS Development, lak4...@gmail.com
Hi, everyone.
After generated manifest file, upgraded portage, I built my test build image succeed.
Reference the guide (https://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md#Select-a-board), I set my build target to amd64-generic. But when I flash image to my chromebook device, I found it doesn't seems contain the project - 'touch_updater' (it means I cannot find my update tool and verify it.)

I guess the reason is because I don't select correct board (project), so I try to find the correct board of my device from https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices. But unfortunately, I cannot find it (my device is ASUS C213s).

My question is, how to configure the board settings to build a test image contain touch_updater and my update tools.
Thanks.

Note,
I have try to add below line in overlay-amd64-generic/profiles/base/make.defaults but it is seems not work.
# Include my firmware updating tool
INPUT_DEVICES="${INPUT_DEVICES} my-tp-util"


Lak Fu於 2018年8月9日星期四 UTC+8下午2時21分33秒寫道:
Reply all
Reply to author
Forward
0 new messages