1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

make things work with unfinished new startup procedure

This commit is contained in:
Bas Wijnen
2010-04-30 23:13:49 +02:00
parent 7c43204a7e
commit 12bfb320f7
37 changed files with 2374 additions and 1649 deletions

View File

@@ -105,37 +105,37 @@ void data::poll ():
case ~1 & 0xffff:
// No event.
break
case Directory::GET_SIZE:
case Iris::Directory::GET_SIZE:
unsigned long long size = dir.size ()
std::cerr << "sending dir size\n"
std::cerr << Directory::GET_SIZE << '\n'
std::cerr << Iris::Directory::GET_SIZE << '\n'
char *str = (char *)&size
for unsigned i = 0; i < 8; ++i:
std::cerr << " " << (unsigned)(str[i] & 0xff)
std::cerr << '\n'
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, Directory::GET_SIZE, 0, 0, (char *)&size, 8, timeout) != 8:
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, Iris::Directory::GET_SIZE, 0, 0, (char *)&size, 8, timeout) != 8:
std::cerr << "unable to send size to device: " << usb_strerror () << std::endl
usb_release_interface (handle, 0)
usb_close (handle)
handle = NULL
return
continue
case Directory::GET_NAME:
case Iris::Directory::GET_NAME:
if buffer[1] >= dir.size ():
std::cerr << "invalid file name requested" << std::endl;
usb_release_interface (handle, 0)
usb_close (handle)
handle = NULL
return
std::cerr << "sending filename\n"
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, Directory::GET_NAME, 0, 0, dir[buffer[1]].name, 16, timeout) != 16:
std::cerr << "sending filename " << dir[buffer[1]].full << "\n"
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, Iris::Directory::GET_NAME, 0, 0, dir[buffer[1]].name, 16, timeout) != 16:
std::cerr << "unable to send name to device: " << usb_strerror () << std::endl
usb_release_interface (handle, 0)
usb_close (handle)
handle = NULL
return
continue
case Directory::LOCK_RO:
case Iris::Directory::LOCK_RO:
std::cerr << "lock\n"
lock++
std::cerr << "freezing file list\n"
@@ -145,7 +145,7 @@ void data::poll ():
if !i->name.empty () && i->name[0] != '.':
dir.push_back (Name (i->name))
continue
case Directory::UNLOCK_RO:
case Iris::Directory::UNLOCK_RO:
std::cerr << "unlock\n"
if !lock:
std::cerr << "unlocking without lock" << std::endl
@@ -156,7 +156,7 @@ void data::poll ():
if !--lock:
dir.clear ()
continue
case String::GET_PAGE:
case Iris::String::GET_PAGE:
if buffer[1] >= dir.size ():
std::cerr << "reading invalid file" << std::endl
usb_release_interface (handle, 0)
@@ -178,16 +178,16 @@ void data::poll ():
handle = NULL
return
continue
case String::GET_SIZE:
case Iris::String::GET_SIZE:
if buffer[1] >= dir.size ():
std::cerr << "reading invalid file size" << std::endl
std::cerr << "reading invalid file size " << buffer[1] << " >= " << dir.size () << std::endl
usb_release_interface (handle, 0)
usb_close (handle)
handle = NULL
return
unsigned long long size = dir[buffer[1]].content.size ()
std::cerr << "sending file size " << size << "\n"
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, String::GET_SIZE, 0, 0, (char *)&size, 8, timeout) != 8:
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, Iris::String::GET_SIZE, 0, 0, (char *)&size, 8, timeout) != 8:
std::cerr << "unable to send size to device: " << usb_strerror () << std::endl
usb_release_interface (handle, 0)
usb_close (handle)
@@ -312,18 +312,18 @@ void data::boot (unsigned entry):
std::cerr << "(re)booted NanoNote\n"
static void dump_devices ():
std::cerr << std::hex << "String: " << String::ID
std::cerr << "\nWString: " << WString::ID
std::cerr << "\nDevice: " << Device::ID
std::cerr << "\nParent: " << Parent::ID
std::cerr << "\nKeyboard: " << Keyboard::ID
std::cerr << "\nBuzzer: " << Buzzer::ID
std::cerr << "\nDisplay: " << Display::ID
std::cerr << "\nSetting: " << Setting::ID
std::cerr << "\nDirectory: " << Directory::ID
std::cerr << "\nWDirectory: " << WDirectory::ID
std::cerr << "\nFilesystem: " << Filesystem::ID
std::cerr << "\nStream: " << Stream::ID
std::cerr << std::hex << "String: " << Iris::String::ID
std::cerr << "\nWString: " << Iris::WString::ID
std::cerr << "\nDevice: " << Iris::Device::ID
std::cerr << "\nParent: " << Iris::Parent::ID
std::cerr << "\nKeyboard: " << Iris::Keyboard::ID
std::cerr << "\nBuzzer: " << Iris::Buzzer::ID
std::cerr << "\nDisplay: " << Iris::Display::ID
std::cerr << "\nSetting: " << Iris::Setting::ID
std::cerr << "\nDirectory: " << Iris::Directory::ID
std::cerr << "\nWDirectory: " << Iris::WDirectory::ID
std::cerr << "\nFilesystem: " << Iris::Filesystem::ID
std::cerr << "\nStream: " << Iris::Stream::ID
std::cerr << "\n"
int main (int argc, char **argv):