Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Proposal: configure devices with their name and their connector #403

Closed
3 of 5 tasks
emersion opened this issue Nov 10, 2017 · 6 comments
Closed
3 of 5 tasks

Proposal: configure devices with their name and their connector #403

emersion opened this issue Nov 10, 2017 · 6 comments
Labels

Comments

@emersion
Copy link
Member

emersion commented Nov 10, 2017

Input devices

Currently input devices are configured with their wlr_input_device.name - but if you have two identical devices, you can't configure them independently:

[backend/libinput/events.c:73] Added Metadot - Das Keyboard Das Keyboard [9456:320]
[backend/libinput/events.c:73] Added Metadot - Das Keyboard Das Keyboard [9456:320]

Unfortunately, inputs devices don't seem to have a serial number - only a friendly name, manufacturer and model.

Proposal: being able to configure them by their connector (retrieved from udev). We could add a char *connector field to wlr_input_device for that.

  • Find a way to get the connector name of an input device and expose it
  • Allow rootston config to use this to configure input devices

Ouputs

Outputs are always identified by their connector for now: VGA-1, HDMI-1-A... However, if you have for instance two DisplayPort connectors, it can make more sense to configure outputs by their name (just like input devices right now). Also outputs have a serial number which can be used to uniquely identify them (given a valid EDID).

Proposal: being able to configure them by their name (manufacturer, model and serial). The wlr_output currently has a name field used for the connector name - we could rename it to connector and add a serial field (make and model are already here).

  • Add a serial field
  • Find a better name for the name field
  • Allow rootston config to use make, model and serial to configure outputs
@ascent12
Copy link
Member

However, if you have for instance two DisplayPort connectors, it can make more sense to configure outputs by their name

The names already describe a physical connector on a GPU so there is already no ambiguity, but I do see the value in configuring a monitor based on information about the monitor itself, instead of where you plugged it in.
Maybe you have some external monitor that is only plugged in occasionally and may not use the same connector every time. Also, DP MST can sometimes renumber the DP connectors in different ways if your setup changes, breaking your configs (There is a way to get more stable naming for these, but we currently don't do it).

None of this configuration needs to live in wlroots, though. We already make users configure it from a wlr_output, so they can make their decision based on whatever fields they want. Internally, name is meaningless.

The only thing that would actually require wlroots changes is adding a serial number, which is a pretty minor change. DRM is the only backend you could get this information. Although, I suppose it's the only backend that would find it useful too.

currently has a name field used for the connector name - we could rename it to connector

I don't see the point in doing this in particular.

@emersion
Copy link
Member Author

The names already describe a physical connector on a GPU
I don't see the point in doing this in particular.

That's why I want to rename wlr_output.name to wlr_output.connector - the name isn't the name of the output, but the name of the connector. In other words, if there's a wlr_output.name field, it should be the name of the output, not the connector. It would be more consistent with wlr_input_device (whose name field isn't a connector name but the device name) and less confusing for users.

None of this configuration needs to live in wlroots, though.

Yes, most of the work will be in rootston. We just need to add some fields in wlr_input_device and wlr_output.

@ascent12
Copy link
Member

the name isn't the name of the output, but the name of the connector

In the DRM backend, there is no distinction between output and connector.
Also, the using connector seems inappropriate for the X11 and Wayland backends, where there really is no connector involved.

@emersion
Copy link
Member Author

In the DRM backend, there is no distinction between output and connector.

Yeah, but a wlr_output is not exposed as being a connector. People don't know and don't need to know how the internals work.

Also, the using connector seems inappropriate for the X11 and Wayland backends, where there really is no connector involved.

Maybe physical_name? Do you have another idea? We should pick a name that works for both input devices and outputs.

@emersion
Copy link
Member Author

emersion commented Nov 11, 2017

Do we want to support syspaths as unique input device identifiers?

@SirCmpwn: can you add this to backend/libinput/events.c:67 and tell me if it has a different value for your keyboards?

struct udev_device *udev_dev = libinput_device_get_udev_device(libinput_dev);
const char *sysname = udev_device_get_sysname(udev_dev);
wlr_log(L_DEBUG, "sysname: %s", sysname);

emersion added a commit to emersion/wlroots that referenced this issue Dec 7, 2017
Added fallbacks in DRM backend in case EDID extension data for model and serial is missing.

Updates swaywm#403
ascent12 pushed a commit to ascent12/wlroots that referenced this issue Dec 8, 2017
Added fallbacks in DRM backend in case EDID extension data for model and serial is missing.

Updates swaywm#403
@emersion
Copy link
Member Author

Might be able to do good stuff with udev properties:

udevadm info --query=property --name=/dev/input/by-id/usb-Wacom_Co._Ltd._CTH-470-mouse 
DEVLINKS=/dev/input/by-id/usb-Wacom_Co._Ltd._CTH-470-mouse /dev/input/by-path/pci-0000:00:1a.0-usb-0:1.5.2.4:1.0-mouse
DEVNAME=/dev/input/mouse3
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2.4/1-1.5.2.4:1.0/0003:056A:00DE.0027/input/input95/mouse3
ID_BUS=usb
ID_INPUT=1
ID_INPUT_TABLET=1
ID_MODEL=CTH-470
ID_MODEL_ENC=CTH-470
ID_MODEL_ID=00de
ID_PATH=pci-0000:00:1a.0-usb-0:1.5.2.4:1.0
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_5_2_4_1_0
ID_REVISION=0100
ID_SERIAL=Wacom_Co._Ltd._CTH-470
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030102:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Wacom_Co._Ltd.
ID_VENDOR_ENC=Wacom\x20Co.\x2cLtd.
ID_VENDOR_ID=056a
MAJOR=13
MINOR=35
SUBSYSTEM=input
USEC_INITIALIZED=41587848863

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants