Commits

Jérôme Vuarand  committed b6376d5

Binding for cancel_transfer.

  • Participants
  • Parent commits 6594ea8

Comments (0)

Files changed (1)

 	return 1;
 }
 
+BINDING(cancel_transfer)
+{
+	struct libusb_transfer* transfer;
+	int result;
+	
+	transfer = luausb_check_transfer(L, 1);
+	
+	result = libusb_cancel_transfer(transfer);
+	if (result != LIBUSB_SUCCESS)
+		return lua__usberror(L, result);
+	
+	lua_pushboolean(L, 1);
+	return 1;
+}
+
 BINDING(handle_events_completed)
 {
 	libusb_context* ctx;
 struct luaL_Reg libusb_transfer__methods[] = {
 	{"free", lua__libusb_free_transfer},
 	{"submit", lua__libusb_submit_transfer},
+	{"cancel", lua__libusb_cancel_transfer},
 	{0, 0},
 };