~xdavidwu/motion-control

acb7f978c19f378cbf30f8ecfabf300943801702 — xdavidwu 2 years ago e2f6235
follow stdlib net module changes
4 files changed, 10 insertions(+), 12 deletions(-)

M cmd/motion-control/main.ha
M cmd/pointerd/main.ha
M tools/buttonc/main.ha
M tools/pointerc/main.ha
M cmd/motion-control/main.ha => cmd/motion-control/main.ha +2 -2
@@ 81,12 81,12 @@ export fn main() int = {
	};

	const sock = match (udp::connect(addr, port)) {
	case let s: io::file =>
	case let s: net::socket =>
		yield s;
	case let err: net::error =>
		fmt::fatalf("Cannot connect() {}:{}: {}", ip::string(addr), port, net::strerror(err));
	};
	defer io::close(sock)!;
	defer net::close(sock)!;

	const ADXL345 = match (ADXL345::new(bus)) {
	case let ADXL345: ADXL345::ADXL345 =>

M cmd/pointerd/main.ha => cmd/pointerd/main.ha +2 -3
@@ 2,7 2,6 @@ use errors;
use evdev;
use evdev::uinput;
use fmt;
use io;
use net;
use net::ip;
use net::udp;


@@ 50,13 49,13 @@ export fn main() void = {

	const addr = ip::ANY_V6, port = control::DEFAULT_PORT;
	const sock = match (udp::listen(addr, port)) {
	case let sock: io::file =>
	case let sock: net::socket =>
		yield sock;
	case let err: net::error =>
		fmt::fatalf("Failed to listen on {}:{}: {}",
			ip::string(addr), port, net::strerror(err));
	};
	defer io::close(sock)!;
	defer net::close(sock)!;

	signal::handle(signal::SIGINT, &sigint);
	let buf = control::request {...};

M tools/buttonc/main.ha => tools/buttonc/main.ha +3 -3
@@ 10,7 10,7 @@ use proto::control;
use strconv;
use unix::tty;

fn send(sock: io::file, bytes: []u8) void = {
fn send(sock: net::socket, bytes: []u8) void = {
	match (udp::send(sock, bytes)) {
	case let err: net::error =>
		fmt::fatalf("Cannot send(): {}", net::strerror(err));


@@ 60,12 60,12 @@ export fn main() int = {
	};

	const sock = match (udp::connect(addr, port)) {
	case let s: io::file =>
	case let s: net::socket =>
		yield s;
	case let err: net::error =>
		fmt::fatalf("Cannot connect() {}:{}: {}", ip::string(addr), port, net::strerror(err));
	};
	defer io::close(sock)!;
	defer net::close(sock)!;

	let buf = control::request {...};


M tools/pointerc/main.ha => tools/pointerc/main.ha +3 -4
@@ 1,5 1,4 @@
use fmt;
use io;
use net;
use net::ip;
use net::udp;


@@ 9,7 8,7 @@ use strconv;
use strings;
use time;

fn send(sock: io::file, bytes: []u8) void = {
fn send(sock: net::socket, bytes: []u8) void = {
	match (udp::send(sock, bytes)) {
	case let err: net::error =>
		fmt::fatalf("Cannot send(): {}", net::strerror(err));


@@ 36,12 35,12 @@ export fn main() int = {
	};

	const sock = match (udp::connect(addr, port)) {
	case let s: io::file =>
	case let s: net::socket =>
		yield s;
	case let err: net::error =>
		fmt::fatalf("Cannot connect() {}:{}: {}", ip::string(addr), port, net::strerror(err));
	};
	defer io::close(sock)!;
	defer net::close(sock)!;

	let buf = control::request {...};