-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run
command with --device
flag gets stuck
#326
Comments
Also, using |
That is super strange. Then I suppose two options what's happening:
I'm not sure how works isolation in nix. Is it containerisation? If so, it could be that case when OS successfully mounted drive, but container didn't get it at all. 🤷🏻♂️ Could you try please following things from nix environment for debug purposes? 0. For each of following steps. Mount device (that's easy with
Also what happening if you try to mount device with command |
The device is definitely mounted as a drive; I can explore it and need to eject the disk. |
It’s not, at least not in this case, and I’m using Nix on macOS FWIW. In this instance I’m using it as a convenient way to set up a developer shell environment, which basically just puts various things on the |
Will do, thanks! |
Wowowow! For macOs it's more than just strange! Below I dive you commands that used for linux, not for macOS. For macOS there is used |
Oh, I probably know what's happening! That is await time shorter then your OS mounting the device, I suppose. Anyway, please try commands |
Configuration env vars:
Values in milliseconds. |
|
This behaved the same as I just noticed that when both Perhaps worth noting that the output above appears to be missing a digit. For example, if my device is |
This was the same as without the |
|
|
IMHO, there is no problem. You can get real serial number from device this ways:
Serial number format if Also, to make sure and rule it out as a suspect, I just add tests for it in #329. |
Okay, now I know that you're on no latest macOS, probably on |
@paulyoung, may I ask you to connect your device and execute |
That appears to be the case, sorry for the confusion. |
I've been putting off upgrading just because I didn't want to deal with any churn that might come with it 😄 I'm on 12.2.1 |
I omitted a lot of fields for brevity and changed the names of things between angle brackets for privacy and security. I also redacted the serial number. {
"SPUSBDataType" : [
{
"_items" : [
{
"_items" : [
{
"_name" : "USB3.1 Hub "
}
],
"_name" : "USB3.0 Hub"
},
{
"_items" : [
{
"_name" : "<kvm hub>"
},
{
"_items" : [
{
"_name" : "<keyboard 1>"
},
{
"_name" : "<keyboard 2>"
},
{
"_name" : "<trackpad>"
}
],
"_name" : "USB2.0 Hub "
}
],
"_name" : "USB2.0 Hub"
}
],
"_name" : "USB31Bus"
},
{
"_name" : "USB31Bus"
},
{
"_name" : "USB31Bus"
},
{
"_items" : [
{
"_items" : [
{
"_name" : "<webcam>"
}
],
"_name" : "hub_device"
},
{
"_name" : "Playdate",
"bcd_device" : "2.00",
"bus_power" : "500",
"bus_power_used" : "100",
"device_speed" : "full_speed",
"extra_current_used" : "0",
"location_id" : "0x03200000 / 6",
"manufacturer" : "Panic Inc",
"product_id" : "0x5740",
"serial_num" : "XXXX-XXXXXXX",
"vendor_id" : "0x1331"
},
{
"_items" : [
{
"_name" : "USB Controls"
}
],
"_name" : "hub_device"
}
],
"_name" : "USB31Bus"
}
]
} |
I ran
I think |
I did this locally and got a bit further. diff --git a/support/device/src/mount/mac.rs b/support/device/src/mount/mac.rs
index 498e984..b2c5eb9 100644
--- a/support/device/src/mount/mac.rs
+++ b/support/device/src/mount/mac.rs
@@ -80,7 +80,7 @@ pub mod unmount {
pub struct SpusbInfo<Fut>
where Fut: Future<Output = Result<PathBuf, Error>> {
pub name: String,
- pub serial: String,
+ pub serial: Option<String>,
pub volume: Fut,
}
@@ -89,7 +89,9 @@ pub struct SpusbInfo<Fut>
pub async fn volume_for<Info>(dev: Info) -> Result<Volume, Error>
where Info: AsRef<nusb::DeviceInfo> {
if let Some(sn) = dev.as_ref().serial_number() {
- let res = spusb(move |info| info.serial_num == sn).map(|mut iter| iter.next().map(|info| info.volume));
+ let res = spusb(move |info| info.serial_num == Some(sn.to_string())).map(|mut iter| {
+ iter.next().map(|info| info.volume)
+ });
match res {
Ok(None) => Err(Error::not_found()),
Ok(Some(fut)) => Ok(fut),
@@ -118,7 +120,7 @@ pub async fn volumes_for_map<I>(devs: I) -> Result<HashMap<Device, Option<Volume
for info in spusb(|_| true)? {
let i = devs.iter()
.enumerate()
- .find(|(_, (_, sn))| &info.serial == sn)
+ .find(|(_, (_, sn))| info.serial == Some(sn.to_string()))
.map(|(i, _)| i);
if let Some(i) = i {
@@ -149,7 +151,7 @@ pub fn volumes_for<'i, I: 'i>(
spusb(|_| true).map(move |iter| {
iter.filter_map(move |info| {
devs.iter()
- .find(|(_, sn)| info.serial == *sn)
+ .find(|(_, sn)| info.serial == Some(sn.to_string()))
.map(|(dev, _)| (info.volume, *dev))
})
})
@@ -254,7 +256,7 @@ struct ControllerInfo {
pub struct DeviceInfo {
#[serde(rename = "_name")]
pub name: String,
- pub serial_num: String,
+ pub serial_num: Option<String>,
pub vendor_id: String,
#[serde(rename = "Media")] It eventually fails with |
Before that I see:
|
(although I would expect not to keep retrying if JSON decoding fails, perhaps that would be worth doing) |
I traced the value passed to
playdate/support/device/src/mount/mac.rs Line 101 in de8d14c
The game installed and ran on my device. I reverted the change and it still works. I'm not sure what happened before that when I got |
I know when mount point can be empty. There is fn How to reproduce it: # requires jq
cargo run -p=playdate-tool mount && \
export PD_VOLUME_UUID=$(system_profiler -json SPUSBDataType | jq '.SPUSBDataType.[] | select(._items) | ._items.[].Media.[].volumes.[] | select(._name=="PLAYDATE") | .volume_uuid' -r) && \
diskutil info -plist $PD_VOLUME_UUID There will be <key>MountPoint</key>
<string></string> Wait, <key>MountPoint</key>
<string>/Volumes/PLAYDATE</string> I hope I fixed it in #330. |
That's ok, I'm sure, because we are not interested in incomplete reports without serial-number at all. So to drop entire function is easier then continue parse, search item of interest, check is there sn existing, your know. |
Could it be previously installed cargo run -p=cargo-playdate -- package -p=playdate-system --example=set-serial-message-callback --features=sys/lang-items,sys/entry-point --device
cargo run -p=playdate-tool -- run dev target/thumbv7em-none-eabihf/debug/playdate/playdate_system-set-serial-message-callback.pdx --no-read You can update to latest from crates.io with |
@paulyoung I've added debug print of response where error caused. Branch: I'm a little bit out of ideas, I don't really understand why you're getting this error. 🤷🏻♂️ |
I tried again from |
Works great here. Not sure what happened. Thanks again. |
@paulyoung |
I'm also hitting the issue originally described here. My env:
|
Hey @paulstraw 👋🏻 |
I'm sure the last issue I posted about here was due to the wrong/old build of It happened again when I was working on the Lua API PR and had pulled in some changes from the main branch. I'm not yet sure why it happens when I do that but I was able to identify it and make sure I was using the correct build. All of that to say, this issue remains fixed for me at the moment. |
Thanks guys, appreciate the prompt and thorough responses.
When running |
@paulstraw I suppose its about changed format of To get exactly what's wrong I recommend do two steps. But first of all set Well, first step is to mount device somehow (use system_profiler -json SPUSBDataType Second is similar, but imitate used fallback method to determine mount-point: # requires jq
export PD_VOLUME_UUID=$(system_profiler -json SPUSBDataType | jq '.SPUSBDataType.[] | select(._items) | ._items.[].Media.[].volumes.[] | select(._name=="PLAYDATE") | .volume_uuid' -r) && \
diskutil info -plist $PD_VOLUME_UUID This way we can understand whether the problem is in the output format or not. |
|
Ah, yes I should have mentioned that. I have a bunch of USB devices/hubs connected to my machine, and previously the Playdate was connected two hubs deep. Trying the new build, I see the expected behavior and trace/debug output for |
* Support devices connected via USB-hub on macOs (fixes #326) * Bump bins, update deps
Thank you. Done, merged, published. |
As discussed in #314 (comment)
When I attempt to use
cargo playdate run --device
I can't get past the device showing "sharing DATA segment as USB drive" and "Eject disk to reboot".My terminal says
Running hello-world on a device
and eventually exits but the device stays the same.If I inspect the Games directory on the device while it's still mounted, the game isn't there. If I manually eject the device and then look for the game on it, it isn't there either.
The text was updated successfully, but these errors were encountered: