如何在关机期间为usb端口供电以便为移动充电?

我的索尼VAIO笔记本电脑有一项function,即使我的笔记本电脑关闭,我也可以保持一个USB端口供电。 这里给出了手册。 它可以从预装Windows附带的Vaio软件打开或关闭。

在过去,当我使用Windows进行双启动时,我可以通过启动进入Windows启用它,即使在多次使用Ubuntu之后它也会继续运行。 出于某种原因,它最近停止了工作。 但我不再拥有Windows了,并希望从Ubuntu重新启用它。 如果我可以从Linux手动切换它会很有趣。 我在google上挖掘了很多东西,尤其是我主板上的信息(HannStar J MV-6 94V-0),并在越南网站上提出了原理图 。 我特别提到USB充电。 但我不知道如何使用这些信息。

很多人建议可以从BIOS启用它,但我已经再次检查,并且在BIOS中看不到任何内容。 但我也观察到BIOS只有很少的字段,让我怀疑BIOSfunction可能会被隐藏。 我会尝试解锁它们。 同时, dmidecode输出附加到问题的末尾。

我不知道这个function是否需要特殊的硬件支持,但无论如何都可以在我的机器上使用。 智能手机的电池电量往往很低,你可以随时将它连接到包里的笔记本电脑上,并在你上大学或旅行时随时充电。 这不仅很酷而且方便,而且省钱,因为我不必购买移动电源。

这是收集的数据:

  • dmidecode输出
  • 内核消息(使用debug=1加载sony-laptop
  • /sys/devices/platform/sony-laptop//proc/acpi/
  • 按照3.16.0-38-generic建议升级到3.16.0-38-generic ,上传新的内核消息

    升级后,我看到usb_charge ,但值为1

     cat /sys/devices/platform/sony-laptop/usb_charge 

    但当我尝试将其切换为0仍然没有激活USB充电,但只是在我再次使用cat检查时重置为1 。 但它应该有效,因为我发现了一个c程序和一个shell脚本做同样的事情。 我注意到我只能写0和1,如果我写了其他的东西,比如假设2,我会得到:

    tee:/ sys / devices / platform / sony-laptop / usb_charge:参数无效

  • 内核升级后/sys/devices/platform/sony-laptop//proc/acpi/

我手动启动到内核3.18,但问题仍然存在。 在Sneetsher的指导下,我在这里提交了一份错误报告。

最好从其他人用sony-laptop Linux内核模块停止的地方开始。

  1. 检查它是否已加载

     lsmod | grep sony 
  2. 如果没有,请加载它

     sudo modprobe sony-laptop 
  3. 检查USB充电是否有相应的输入/function(从源usb_charge属性):

     tree /sys/devices/platform/sony-laptop/ 

    当我检查驱动程序源时,这里是相应的function(可能不适用于所有型号):

     ... static int sony_nc_usb_charge_setup(struct platform_device *pd); static void sony_nc_usb_charge_cleanup(struct platform_device *pd); ... 

    这里有完整的函数定义(来自sony-laptop.c部分)

    似乎从内核消息中检测到笔记本电脑上的0x0155 。 该模块创建了touchpadbattery_care_limiter ,只读handles ,只读battery_care_health SYSFS属性,但没有别的(包括usb_charge )。

    我检查了Ubuntu内核源代码,寻找USB充电function:

    • Ubuntu 14.04 Trusty(尚未添加),内核版本3.13

      如果您使用的是此版本,最简单的方法是安装Utopic内核:

       sudo apt-get install linux-generic-lts-utopic 
    • Ubuntu 14.10 Utopic(它就在那里),内核版本3.16

    如果它不存在,那么只有当你达到以下目标时才会有困难/风险:

     Development: ------------ If you want to help with the development of this driver (and you are not afraid of any side effects doing strange things with your ACPI BIOS could have on your laptop), load the driver and pass the option 'debug=1'. REPEAT: DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS. In your kernel logs you will find the list of all ACPI methods the SNC device has on your laptop. 

    请参阅自述文件 。

  4. 由于内核已通过OP升级到3.16.0-38-generic, usb_charge使用其他一些SYSFS属性创建usb_charge。

    阅读类似的驱动程序内核文档, sysfs-driver-samsung-laptop :

     What: /sys/devices/platform/samsung/usb_charge Date: December 1, 2011 KernelVersion: 3.3 Contact: Corentin Chary  Description: Use your USB ports to charge devices, even when your laptop is powered off. 1 means enabled, 0 means disabled. 

    要检查当前状态:

     cat /sys/devices/platform/sony-laptop/usb_charge 

    要禁用它:

     echo 0 | sudo tee -a /sys/devices/platform/sony-laptop/usb_charge 

    要启用它:

     echo 1 | sudo tee -a /sys/devices/platform/sony-laptop/usb_charge 

参考文献:

  • 索尼笔记本电脑控制驱动程序(SNC)自述文件
  • sony-laptop来源