if (udev_event_is_hotplug(b, event)) { if (udev_event_is_conn_prop_change(b, event, &conn_id, &prop_id)) drm_backend_update_conn_props(b, conn_id, prop_id); else drm_backend_update_heads(b, event); }
udev_device_unref(event);
return 1; }
static void drm_backend_update_heads(struct drm_backend *b, struct udev_device *drm_device) { /* collect new connectors that have appeared, e.g. MST */ for (i = 0; i < resources->count_connectors; i++) { uint32_t connector_id = resources->connectors[i];
head = drm_head_find_by_connector(b, connector_id); if (head) { drm_head_update_info(head); } else { head = drm_head_create(b, connector_id, drm_device); if (!head) weston_log("DRM: failed to create head for hot-added connector %d.\n", connector_id); } } }
아무튼 메모리 1Kb 더 먹고 hostname resolve를 제공한다는 것 같은데(resolution은 또 머야..)
그 기능만 차이가 있다면 굳이 pi를 쓸 이유는 없을 듯
TCP (IPv4) Context
The TCP backend implements a Modbus variant used for communications over TCP/IPv4 networks. It does not require a checksum calculation as lower layer takes care of the same.
The TCP PI (Protocol Indepedent) backend implements a Modbus variant used for communications over TCP IPv4 and IPv6 networks. It does not require a checksum calculation as lower layer takes care of the same.
Contrary to the TCP IPv4 only backend, the TCP PI backend offers hostname resolution but it consumes about 1Kb of additional memory.
/* The first value of each array is accessible from the 0 address. */ mb_mapping = modbus_mapping_new(BITS_ADDRESS + BITS_NB, INPUT_BITS_ADDRESS + INPUT_BITS_NB, REGISTERS_ADDRESS + REGISTERS_NB, INPUT_REGISTERS_ADDRESS + INPUT_REGISTERS_NB);
if (p->revents & POLLIN) { modbus_set_socket(ctx, p->fd); // set the socket to libmodbus answers to the right client
uint8_t query[MODBUS_RTU_MAX_ADU_LENGTH]; int rc = modbus_receive(ctx, query); if (rc <= 0) { // connection has been closed actually by the client ::close(p->fd); p = sockets.erase(p); // remove it from the poll-array continue; }
/* rc is the query size */ rc = modbus_reply_callback(ctx, query, rc); // handle the reply (via the callbacks) if (rc < 0) { // error handling - invalid request ::close(p->fd); // close client p = sockets.erase(p); continue; } }